What is linux partition type

Linux Partitioning Recommendations

Manual disk partitioning can be confusing for new Linux users. In this post, we will provide you our Linux partitioning recommendations. We’ll address both EFI partitioning for dual-boot with Windows and Linux-only installation schemes.

Content

Partitioning for Linux-only Installation

Disk Selection

I’ll use Ubuntu 20.04 LTS installer to demonstrate partitioning, but the same process applies to every Linux distro. We need to get to the manual partition settings of the installer, it is located under the “Something else” label in the Ubuntu installer:

Manual partitioning selected in Ubuntu installation

This is how Ubuntu’s installer partition manager looks like:

Ubuntu installer partitions listing

As we can see, I have two hard drives, which are named alphabetically:

If you also have several hadrd drives on your system, you can select the one you need based on its size.

These are brand-new hard drives that are not partitioned yet. I’ll install my system with /dev/sda disk for my Ubuntu installation. For that we first need to create a partition table on it. A partition table will store information about our partitions.

Select your disk → New Partition Table → Continue

Creating Partitions

Now that we have created a partition table, it’s time to create partitions. You can think of partitions as slicing our disk into parts, each for different purpose.

The first partition will be for the bootloader. Bootloader is responsible for loading the operating system and is critical part of every computer. UEFI and BIOS (legacy) are the two common bootloaders for computers. You can find out what bootloader is supported by your hardware in the motherboard firmware specs. Recent hardware uses the UEFI and we recommend to install Linux in the EFI mode, while older hardware can only be used in the legacy mode.

For the EFI mode, we recommend to create four different partitions:

  • efi (UEFI bootloader)
  • / (Linux system)
  • /home (personal user data)
  • swap (temporary storage)

Click the “+” button, and create them in order.

efi (UEFI bootloader)

Starting with the efi partition, 100MB is usually more than enough. The type of partition should be primary. Select “EFI System Partition” in the “Use as” dropdown menu.

Читайте также:  Arch linux update keys

Ubuntu installer creating EFI partition

/ (Linux system)

Now select the rest of the free space to create the root partition. Ubuntu recommends at least 15GB for the system partition. However, if you want to play games and install many programs, I recommend 50GB or even 100GB. It depends on the size of your hard drive and your needs.

Select Ext4 journaling file system if it’s not already selected by default and mount point to be root (i.e., forward slash /).

Ubuntu installer creating system partition

/home (personal user data)

Next, select the free space again and click the “+” button to create /home partition. Home partition is used to store personal files like images, downloads, music, videos, etc. Again, depending on your needs, choose the size accordingly. I’ll go with 30 GB because it is only for the demonstration purpose.

Ubuntu installer creating home partition

Select Ext4 journaling file system if it’s not already selected by default and mount point to be /home.

swap (temporary storage)

Last, we have a swap partition. The system automatically uses a swap partition in case RAM gets filled. This way, it doesn’t have to forcibly close processes to free up RAM/prevent a system crash. We have a dedicated post that goes in-depth about Linux swap, so make sure to check it out if you are interested in learning more about it.

There are no strict rules on how large a swap partition should be. With that being said, there are general guidelines that the community follows. If you have less than 8GB of RAM, the swap should be two times that size. Otherwise, the swap can be the same size as RAM.

Once you have selected the right size, make sure to mark the partition as a swap in the “Use as” dropdown menu, and that’s it!

Ubuntu installer creating swap partition

Partitioning table summary

Here’s how my partitioning table looks like after the above changes.

Ubuntu installer finished partition table

Complete the rest of the steps and fire up the installation once you are ready! Your distro should boot without any issues!

Feel free to run the following command in the newly installed system to check your partition table, and everything should match:

Post-installation manual partitioning confirmation with fstab

Congratulations! You have installed Ubuntu with manual partitioning, which gives you a lot more flexibility. For example, you can completely wipe the system partition ( / ) and install another distribution on it while all your personal data in /home stays intact. Just remember NOT to format the /home partition during the re-installation.

Читайте также:  Ubuntu software center on linux mint

Partitioning to dual-boot Linux and Windows

Freeing up Space for Linux

While I primarily use Linux as my operating system, it can fall short in specific scenarios. That’s why some users prefer to dual-boot Windows and Linux. This partitioning recommendation will work exacltly for such users.

First, load the Linux installation live system. This time though, select “Try Ubuntu” instead of “Install Ubuntu”. That’s because we need to free up space for Linux before running the installation.

To that end, we’ll use GParted. GParted is the most advanced partition manager for Linux. It’s a lot more capable than the partition manager in the installer.

There is only Windows installed and it occupies the whole disk. That’s the most common scenario for people looking to try Linux but would like to keep Windows.

Windows-only partition table

The only partition that we can modify is the “Basic data partition”. It’s usually the largest partition, and in my case, it’s /dev/sda3. We are going to resize that partition to free up some space for our Linux system.

Right-click on the basic data partition → Resize → Type the new (smaller) size for that partition

I’ve decided to shrink the basic data partition to 30GB and I was left with 90GB of free space for my Linux system. You need to do similar shrink on your system.

Windows-only partition table with NFTS basic data partition shrinked

Creating Linux Partitions

We already have an efi partition that was created by the Windows installer, so we don’t need to create it.

We only need to create the remaining three partitions:

The detailed steps on doing this can be found by scrolling up to the “Creating Partitions” section above. The only difference is that GParted has an “Add” button instead of “+” like the installer’s partition manager and you do not need to add mount points in GParted.

Linux alongside Windows partitions in GParted

After you have provided the new partition scheme in Gparted, all changes are “virtual”, meaning that your drive is still intact. It’s a fantastic feature of GParted that allows us to see how the drive would look with our changes. Once you’re happy with your changes, click the checkmark button on the top menu to apply the changes.

Читайте также:  Linux echo переменные окружения

Depending on the size of your drive, it may take some time for changes to complete. Nevertheless, once it’s done, we can proceed with the installation. Launch the installer from the desktop menu and go to the partitioning step. (it’s called “Installation type” in Ubuntu’s installer)

Select manual partition or “Something else”, as Ubuntu calls it and you will see the newly create partition scheme. Now we only need to edit our system ( / ) and /home partitions to specify the mount points for root / and /home respectively.

Linux partition alongside Windows installation

Proceed with the installation steps, and that’s it! Once you reboot the system, the GRUB menu should show up, asking you to select which operating system to boot.

Linux and Windows selection in GRUB

Note: If it doesn’t show up, don’t panic! Go to the boot manager in BIOS (usually F8 at the boot) and shift Ubuntu to be first in the list.

Partition a New Drive for data storage

Another scenario would be that you have purchased a hard drive and would like to add it to your Linux system as a data storage. Similar to the above, we’ll use GParted, the bets Linux partitioning tool.

Open GParted → Select your new disk → Device → Create New Partition Table → Select type msdos → Apply

Formatting disk with MSDOS partition table

Now we can partition the hard drive. If you would like to have use this hard drive with Linux exclusively, you can create one ext4 file system partition that occupies the whole disk.

Alternatively, you can split the drive into two partitions: one for Linux with the ext4 filesystem and another one for Windows with the ntfs filesystem. When you are done with partitioning, don’t forget to click “Apply” for GParted to apply changes.

Linux and Windows data partitions in GParted

Opening files manager confirms that the partitions have been created.

Linux and Windows data partitions on the same disk

Conclusion

We have finally addressed one of the most common sources of confusion regarding manual Linux partitioning. This was a more advanced topic, so kudos to you for reaching it to the end!

Let me know in the comments below if you would like to see more advanced Linux tips. Also, don’t forget to subscribe to our newsletter, so you don’t miss out on the latest posts!

Источник

Оцените статью
Adblock
detector