Understanding Ubuntu Server partition scheme is critical for any enthusiast setting up a Ubuntu Home Server. Ubuntu Server, sits at the top of our list of home server operating systems. Yesterday, Ubuntu Server 16.04 LTS Xenial Xerus was released. My previous post explained how to install Ubuntu Server 16.04 in detail with screenshots and videos. One of the important steps in installation is Ubuntu partition scheme. Should you partition entire disk to use Ubuntu? Should you create a swap partition? How do you mount existing hard drives? In this Ubuntu Server partitioning guide, I will try to provide you with just enough information to partition your drives for Home Server setup. Keep in mind that this is just a general guideline and there are several other ways of setting up partitions for Ubuntu Linux.
Ubuntu Server Partition Scheme – Prework
Before you can proceed with partitioning hard drive for Ubuntu installation, Ubuntu installer will detect any existing partitions and ask your permission to unmount them. On my Home Server / HTPC Combo Build 2016, I use a 4 TB HDD as a second hard drive to store my media. This second drive is already formatted to EXT4 and contains data. As shown in the picture below, this drive will be recognized as
sdb and the installer prompts you to unmount the partitions. Umounting any existing partitions is required for disk partitioner to work on the drive.
If have more than one hard drive, press “Yes” to unmount all existing partitions. Without further ado let us learn to partition hard disk for Ubuntu Server installation. [Read: How to run a Ubuntu home server on VirtualBox VM?]
Step 1: Choose Manual Ubuntu Partitioning
When the Ubuntu installer prompts you to partition disks, I recommend choosing the “Manual” partitioning method. Don’t worry, manual partitioning is not that difficult.
Step 2: Partition New Drives for Ubuntu Server Installation
You should now see a list of all existing hard disks and partitions. In the example shown below, there are two disks:
- sda – 32.2 GB
- sdb – 5.6 GB
Note that the drive capacities presented above are just examples. A typical home server these days has several TBs of capacity.
There are no partitions in the first disk (sda). It is a new drive that will be partitioned to contain the Ubuntu operating system (on my Home Server this is an SSD). The second disk (sdb), already appears to contain one primary partition of 5.4 GB formatted as EXT4. First, we are going to choose sda to format it for Ubuntu Server installation. We will look at mounting and using the existing media partition in sdb, later in this Ubuntu partition guide. [Read: Install GUI on Ubuntu server 14.04 Trusty Tahr]
Step 3: Create New Partition Table
Since this is a brand new drive, you will first have to create a partition table. Press “Yes” and continue. If you drive already has partitions then you may not see this screen.
Step 4: Create New Partition from Empty Space
Once you create a new partition table, you see the amount of free space available in the selected drive. In this example, there is 32.2 GB of free space available in the new hard drive.
Select the free space to create a new partition.
Step 5: Create a New Partition
Nothing much to explain here. Just select “Create a new partition” to create the Ubuntu root partition.
Step 6: Set Ubuntu Root Partition Size
Ubuntu operating system can be split-installed into several separate partitions (the default is all OS in one partition). Many advanced Linux server administrators prefer installing the OS into multiple partitions. This allows easier maintenance and repairs. In this basic Ubuntu Server partitioning guide, I am not going to go crazy with partitioning. However, I do recommend installing Ubuntu Server in 2 separate partitions: one for root (/) and the other for home (/home).
First, let us create a root partition. Enter the size of the root partition. I recommend at least 10 GB for a headless server and 15 GB for a server with desktop environment.
There is no real need for a typical Ubuntu home server to have more than 20 or 25 GB for root (/) partition.
Step 7: Set Root Partition as Primary
While, Ubuntu is robust and not picky about the type of partition (primary vs logical), I recommend setting the root partition to “primary”.
Step 8: Select Root Partition Location
Next, select the location of the root partition in the hard drive. Either option is OK. I typically set up root partition in the beginning.