Planning disk partitions on a dedicated server

A good partition plan keeps logs from filling the root filesystem and puts each kind of data on the drive that suits it.

What layout does a new server have?

A standard one built by the installer: an EFI system partition on each drive, a boot area, a root filesystem and usually swap, mirrored with software RAID on models with two drives. Read it before you plan anything; the commands below show partitions, file systems, mount points and array membership in two screens.

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
cat /proc/mdstat
df -hT -x tmpfs -x devtmpfs

On a model with 2x 960 GB SSD NVMe, Soft RAID, for example, you would see two NVMe devices, matching partitions on both, and md devices for /boot and /, with the root filesystem taking most of the space.

Is one large root filesystem a bad idea?

Not for most servers. One big filesystem on an SSD mirror wastes no space and needs no resizing later. Separate volumes pay off in specific cases: a database that should not compete with logs for space, a mail or upload directory that could fill up, or data on different drives from the system. Put limits where a runaway process could hurt, not everywhere.

Mount pointSeparate it whenTypical choice
/var/lib/mysql or /var/lib/postgresqlThe database is large or busyOwn LVM volume, XFS or ext4
/var/logVerbose applications or long retentionOwn volume, or strict log rotation
/srv/dataBulk files on hard drivesRAID on the HDDs, XFS
/var/lib/vz or VM storageVirtualisation hostLVM thin pool or ZFS

How much swap should a server have?

A little, as a safety margin rather than extra memory. With 64 GB or more of RAM, 4 to 8 GB of swap lets the kernel move idle pages out and gives you time to react before the out-of-memory killer acts. Set vm.swappiness to 10 on database servers so active data stays in RAM. A swap file works as well as a partition on ext4 and XFS and is easier to resize.

fallocate -l 8G /swapfile && chmod 600 /swapfile
mkswap -L swap0 /swapfile && swapon -p 5 /swapfile
printf '/swapfile none swap defaults,pri=5 0 0\n' >> /etc/fstab

How do I add a data volume on a Storage machine?

Build an array on the hard drives, then a filesystem on top, mounted by UUID. On a Storage machine such as STORAGE-1 with 2x 480 GB SSD SATA (system) + 4x 14 TB HDD SAS, Soft RAID, the SSDs carry the system and the four hard drives are free for data. RAID 10 on four drives gives half the raw space with fast rebuilds; RAID 6 gives more space and survives two failures. Our RAID levels explained article compares them.

mdadm --create /dev/md10 --level=6 --raid-devices=4 /dev/sd[c-f]
mkfs.xfs -L bulk /dev/md10
mkdir -p /srv/data
echo "UUID=$(blkid -s UUID -o value /dev/md10) /srv/data xfs defaults,nofail 0 2" >> /etc/fstab
mount /srv/data

Check device names with lsblk first; the hard drives are not always sdc to sdf. The nofail option lets the server boot even if this array has a problem.

Should I use LVM?

It helps when you want to split space later without repartitioning. LVM sits on top of the RAID device and lets you create, grow and snapshot logical volumes while the system runs. Leave some space unallocated in the volume group so you can grow whichever volume fills first.

pvcreate /dev/md10
vgcreate vgdata /dev/md10
lvcreate -L 4T -n pgdata vgdata
mkfs.ext4 -L pgdata /dev/vgdata/pgdata
lvextend -r -L +1T /dev/vgdata/pgdata   # later, grows the filesystem too

Can I shrink or rearrange the root filesystem?

Only offline, and only for ext4: XFS cannot shrink. To move from one big root to a split layout, boot rescue mode from the console, shrink the ext4 filesystem with resize2fs, shrink the partition or md device to match, then create the new partition in the freed space. This works but is the riskiest operation in this guide; a full backup first is not optional. Often it is simpler to reinstall from the console and restore data onto a layout you build from rescue mode, or to keep root as it is and place new volumes on spare space.

Which file system should I pick?

ext4 for general use and anything you may want to shrink; XFS for large files and big arrays; ZFS when you want checksums, snapshots and compression in one tool, as described in ZFS on a storage server. Btrfs is the default on Fedora Server and works well for snapshots of the system. Mount with noatime on busy volumes to save writes, and keep at least 10 to 15 percent free on every filesystem; performance drops sharply on nearly full volumes.

Machines with different drive layouts

ModelProcessorCoresMemoryDrivesPortPer month
ESSENTIAL-4AMD EPYC 73131664 GB2x 960 GB SSD NVMe1 Gbps unmetered$106.20
STORAGE-1AMD Ryzen 7 Pro 3700832 GB2x 480 GB SSD SATA + 4x 14 TB HDD SAS1 Gbps unmetered$109.80
STORAGE-2 2024AMD EPYC 4344P832 GB2x 960 GB SSD NVMe + 2x 22 TB HDD SAS3 Gbps unmetered$187.80
STORAGE-3 2024Intel Xeon Gold 6554S36128 GB2x 960 GB SSD NVMe + 24x 22 TB HDD SAS10 Gbps unmetered$1,037.40

Related pages

Software RAID with mdadm

Read, create, monitor and tune Linux software RAID arrays with mdadm: status fields, email alerts, scrubs and the write-intent bitmap.

Read more

RAID levels explained

RAID 0, 1, 5, 6 and 10 compared with usable capacity worked out for our storage chassis.

Read more

ZFS on a storage server

Building a ZFS pool on our large disk chassis: mirrors or RAIDZ2, usable capacity arithmetic, memory for the cache and scrubs.

Read more

Storage servers

High capacity hard disk servers from 44 TB to 576 TB raw.

from $109.80 a monthRead more

Questions and answers

Can I choose a custom partition layout at install?

The console installs a standard layout. For a custom one, build it from rescue mode or add volumes on spare drives after delivery.

How much swap does a server need?

4 to 8 GB is a sensible safety margin on machines with 64 GB or more of RAM. A swap file is as good as a partition.

Can I shrink an XFS filesystem?

No. XFS can grow but not shrink. Use ext4 where you may need to shrink later.

Why mount data volumes with nofail?

So a problem on a data array does not stop the server from booting. You can then fix the array over SSH.

Do I need LVM?

Not always. It is useful when you want to split and grow space later without repartitioning or need snapshots.