There was a problem loading the comments.

Partitioning Windows and Linux Servers

Support Portal  »  Knowledgebase  »  Viewing Article

To partition a hard disk drive (HDD) is to divide a single physical disk into multiple logical storage units so that a different file system can be implemented in each partition. Though there are different kinds available, the two partition schemes usually used in x86-compatible systems are the Master Boot Record (MBR) and GUID Partition Table (GPT).

The MBR is the most widely used partitioning scheme in x86 machines. Current computing needs however are finding it limiting as its maximum addressable storage space in a disk is only 2TB. The GPT scheme is in the process of superseding MBR in newer computers. We are seeing this transition as GPT co-exists with MBR to provide some backward compatibility to older systems.

When GPT is implemented in a machine together with MBR, the HDD must be initialized using the GPT scheme if its capacity is over 2TB; if capacity is lower, either MBR or GPT can be used.

Note: Windows systems cannot boot from GPT partitions if the system is being booted with legacy BIOS code. Only EFI systems can be booted from GPT partitions.

Another limitation of the MBR scheme is the number of partitions that you can create in it. In MBR, you can choose to create either of the two options: option 1 - four (4) primary partitions, option 2 - three (3) primary partitions and one (1) extended partition with MBR table in a single drive, which can be further divided into logical partitions. In comparison, the GPT scheme by default has a table with 128 entries for partitions. This table can then be extended further as needed.

Remember to align all partitions based on physical drive block size to get the best performance out of your disk drive. The starting address of a partition should be divided by physical block size without a remainder. Most HDDs have a physical block size of 4KB while solid-state drives (SSD) usually have 128KB (some Samsung devices are even known to have 1.5MB block sizes). This means that your first partition should usually start at 1MB address for SSD (1x1024x1024, divides without a remainder on 4KB, 128KB, 256KB, and 512KB drives) and 4KB address for HDD (4x1024). You can also opt to select a higher appropriate value—6MB, for example, is probably the safest variant for Samsung SSDs.

For Windows

We recommend using at least three (3) partitions for servers running Windows:

  1. Boot/system partition with no drive letter assigned; automatically created in Windows installer when you try to create a partition for the system. Note that this needs an additional 128MB Microsoft reserved partition (MSR) for GPT.
  2. Windows partition (drive C:) with an allocation of 100GB. This should be enough space for most of your programs while still leaving room for future installations.
  3. Data partition (drive D:) all unallocated space left after making first two partitions.
It is also a good practice to have a recovery partition of at least 2GB size, giving room for the inclusion of the Windows recovery image (install.wim) and enough free space that can let it be captured by backup utilities.

Do monitor the RAM/disk space consumed thus far, especially if you have a swap file (system pagefile) on a drive C: (usually stored there by default) with an undefined size. You could either move this system file to drive D: or put a hard limit to its size by doing the following steps:

  1. Choose the system item via Control Panel then go to Advanced system settings > Advanced > Performance > Advanced > Virtual memory.
  2. Set the size.
  3. If you decreased the size, restart your computer. If you increased the size, there is no need to reboot for the change to take effect.

For Linux

Linux supports various types of partition schemes—from plain file system partition schemes to ones that are especially designed for Linux like software RAID and Logical Volume Management (LVM).

LVM is more flexible than usual partition schemes because of the following reasons:

  • It allows the use of any number of disks as one big disk.
  • The logical volumes (LV) can stretch over several disks.
  • It allows the creation of small logical volumes, which it then resizes dynamically as they get filled up.
  • It can resize LVs regardless of their order in the volume group of the disk. This means that there is no need to ensure free space in the surrounding volumes.
  • You can resize, create, and delete logical and physical volumes online. Note though that the file systems in these volumes still need to be resized in the usual way (only a few like the ext4 support online resizing).
  • You can do online and live migration of LVs being used by services to different disks without needing to restart services.
  • You can keep service downtime to a minimum as snapshots allow you to backup a frozen copy of the file system.
  • It supports various device-mapper targets; including transparent file system encryption and caching of frequently used data.
Note that Red Hat Enterprise Linux (RHEL) and CentOS prior to version 7 cannot use GPT partitioning for system boot drives because the default bootloader (Grub legacy) does not support GPT.

We recommend two (2) partitions for servers running Linux:

  1. /boot partition with 250MB or more space implementing an ext4 file system. Remember to delete old kernel version packages from time to time as they are not deleted during system updates. If you will boot via EFI, you can opt to have an additional /boot/efi partition with a FAT32 file system or an entire /boot partition with a FAT32 file system.
  2. LVM partition that occupies all the unallocated space with LVs set aside for the following smaller partitions:
  • Swap partition occupying at least 0.5 RAM space (for RAMs 8GB or higher)
  • / partition with at least 10GB
  • One or more partitions for services data– Some examples:
    • Create /var if you plan on using a database and a web server,
    • Create /var or /home if you will use the server as an email server
    • Create /var and /home if the server will be used for shared hosting
You can skip creating separate partitions for /var and /home, but you need to create a file system for your root partition with a certain percentage of space reserved only for the root user (ext4 is created with 5% file system space by default; -m option for mkfs).

You should also have an active monitoring tool, like Zabbix or Zenoss, installed to alert you when run out of space. Do not let it get to a point when you cannot even log in to your system because all available space has been used.

You can create partitions when installing the system for the first time. You can also do manual partitioning via consoles and GUI utilities like fdisk, cfdisk, parted, gparted, and gdisk.

Share via
Thank you for your feedback on this article.

Related Articles


Add Comment

Replying to  

Self-Hosted Help Desk Software by SupportPal