Sunday, July 7, 2013

Linux Partitions

This is a supplementary notes on Linux partitions. It is for those who are new to Linux and wishes to know more about how Linux configure their partitions.

What are Partitions?
Partitions are the logical divisions of a single hard disk. When you bought a new hard disk and installed into a computer, you can treat the whole physical disk as one partition or you may want to split into separate partitions.

A partition is also a boundary specification to tell the computer where to start writing data and where to end. Without partition information a computer don't know where to start writing data, even if you use the entire physical hard disk as a single partition, you still need to configure the partition information. The partition information divide the hard disk into different numbered blocks so that the computer knows where the information stored.

File System
While partition information defines start and the end of a disk range, you'll need a file system to mark where is the start of a file and where is the end of a file. When you configure a partition, you also need to define the file system this computer should use. In Linux, the default file system is ext4. You may find older Linux system using ext3. Mac OS X uses HPF Plus. Windows uses NTFS, while the older PC uses FAT or FAT32.

Partition Naming
While Windows system named its partition as C:, D: and so on. In Linux, it named partitions as sda1,  sda2 or sdb1. Linux recognized each physical hard disk or optical drive or USB Drive as sda, sdb, sdc and so on.
Within each physical drive, each partitions are named sda1, sda2 and so on. Let say if you have a hard disk with 3 partitions, a DVD drive and a USB drive. Your hard disk is named sda1, sda2 and sda3. Your DVD drive should be sdb1. Your USB drive should be sdc1. If you've partition your USB drive into 2 partitions. Then it should have sdc1 and sdc2.

What you need to know about Fedora Partitions?

Partition Scheme
In Fedora, there are three partition scheme, they are "LVM", "Standard Partitions" and BTRFS. BTRFS is a very new partition type actively develop by Oracle and can be quite unstable according to wiki. I do not have enough information to judge. 

LVM partition is the default partition type, it allows user to add addition hard disk space by adding a physical drive and extend the logical partition across multiple physical hard disk. Under LVM mode, your /home partition might be store physically across several hard disk. I would recommend LVM partition for file server. However, I would prefer standard partition for home user especially if you have plenty of hard disk space. The only disadvantage in LVM partition is that if the OS is corrupted and unable to boot, it is almost impossible to retrieve the data by using another copy of the same OS booting from CD or USB drive. The logical partition is closely tie to a particular installation. This disadvantage can be a security measure for a file server.

Therefore, I would recommend "Standard Partition" for home user and desktop user.


File System
Almost all Linux distribution uses ext4. If you are using an older system with an old partition, you might encounter ext3 file system. If you are using a mixed system that includes Windows operating system, please be aware that Windows used NTFS. Most of the smaller size removable hard drive use FAT32. Most USB drive uses FAT.

My advise is do not touch any partition that is NTFS, FAT or FAT32 unless you intentionally want to remove them.


Partitions Configuration
All Linux system requires a minimum of 3 partitions, they are /boot (use booting up the system), /swap (use for virtual memory) and / (the root directory contains the entire system). With each partition, the mount point is where the partition located logically in the Linux system. Mount points are /boot, /swap, / or /home.

The following are the recommend disk size:
  • /boot - about 500MB is sufficient
  • /swap - traditionally it is recommended to have twice the size of your RAM size. However, with sufficient RAM in most system. The swap file is hardly use. I would recommend 4GB is sufficient for most system.
  • / - root directory contains the entire system so you should commit the rest of your hard disk space to it.

If you want to separate the system folder with user data, you can configure an additional mount point for user data such as /home. You can allocate whatever hard disk space necessary for user data. You can even configure such that /home is mounted on a separate hard disk.


Caution
Please be very careful when you are configuring partitions manually. In certain cases where you need to remove certain partition to allow space for installation of the new system, please be careful about which partition you should remove as it may result in data loss if wrong partition is deleted.


*****


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.