Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Disk Storage Management in Linux

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Disk Storage Management in Linux

The hard disk is a very important hardware resource in every computer since it stores operating system as well
as all user data. How to manage them effectively is directly related to performance of the whole system. In
Windows there is a utility called disk management which allows the administrator to create and manage the
partition on hard disk drive. Similarly, Linux also gives some tools which you can use to manage the disk.

What is a Partition?

Partition is a logical container which is used to house filesystems, where operating systems, applications, and
data is stored on. A single partition may span the entirety of a physical storage device.

What is a File System?

A file system provides a way of separating the data on the drive into individual pieces, which are the files. It
also provides a way to store data about these files for example, their filenames, permissions, and other
attributes. The file system also provides an index which is a list of the files on the drive and where they are
located on the drive, so the operating system can see what’s on the drive in one place rather than combing
through the entire drive to find a file.

Your operating system needs to understand a file system so it can display its contents, open files, and save files
to it. If your operating system doesn’t understand a file system, you may be able to install a file system driver
that provides support or you just can’t use that file system with that operating system.

Why Partition your Disk?

Consider that your company is moving into a new building that is setup like a warehouse. There are no internal
walls, it is just one big room for everybody to work in. The first thing the boss is going to do is build an office
for himself (he wouldn’t want to associate with you workers). So, he will have a partition set up, an internal
wall to separate him from you. Next, each worker will get a cabin in the big room with smaller partitions to
separate you from the person next to you.

Hard drives work the same way. The disk gets partitioned into smaller, separate pieces which can belong to
different owners. In our case, Windows might own some and Linux will own others. On hard drives, the word
“partition” does not refer to the wall itself, it refers to the logically separated space.
After creating a partition, the partition is formatted with a file system — like the NTFS file system on
Windows drives, FAT32 file system for removable drives, HFS+ file system on Mac computers, and the ext3,
ext4 file system on Linux. Files are then written to that file system on the partition.

Benefits of Multiple Partitions

Creating more than one partition has the following advantages:

 Separation of the operating system and program files from user files. This allows image backups (or clones) to be
made of only the operating system and installed software.

 Having a separate area for operating system virtual memory swapping/paging.

 Keeping frequently used programs and data near each other.

 Having cache and log files separate from other files. These can change size dynamically and rapidly, potentially
making a file system full.

 Multiple partitions allow user to install multiple operating systems in one computer. For example, one could
install Linux, Mac OS X, Microsoft Windows etc. on different partitions of the same HDD and have a choice of
booting into any compatible operating system at power-up.

 Protecting or isolating files, to make it easier to recover a corrupted file system or operating system installation. If
one partition is corrupted, other file systems may not be affected.

 Raising overall computer performance on systems where smaller file systems are more efficient. For instance, large
HDDs with only one NTFS file system typically have a very large sequentially accessed Master File Table (MFT)
and it generally takes more time to read this MFT than the smaller MFTs of smaller partitions.

Partitioning is good however it also has some disadvantages like increased fragmentation and wasted disk
space. The more partitions you create, the more usable disk space you waste. So it is always a good idea to
create 2-3 partitions if you have only one operating system installed.

On Windows, the disk partitioning scheme is pretty clearly cut: OS lives on your disk, usually on one partition,
and that’s all. If you have other drives, and they have a compatible file system, then it will read them as
well. If not, it will usually ignore them, or offer you the ability to reformat. But in Linux and Unix world, it
doesn’t work that way.

The way Linux works is that it puts everything onto a hierarchical tree. If you have another partition or disk, it
gets “mounted” as a branch in a specific folder, usually /media or /mnt. The directory that a partition gets
mounted to is called a “mount point”. This method works better with Linux’s tree structure, and you can
mount partitions as folders nearly anywhere. In Windows, this is not so easily done; new partitions generally
show up as separate drives. In addition, Linux can work with many more types of file systems natively than
Windows.

The older hard disks use sectors of 512-byte size and the MBR (Master Boot Record) partition table. The
limitation of MBR disk is that it allows 4 primary partitions only on one disk. If you want more partitions,
you need to create an extended partition which reduces the number of primary partitions to 3, and then
create logical partitions inside extended partition. The limit of MBR based disks is that it does not support
drives of more than 2TB capacity. If you have a drive with 4TB capacity, you can only use 2TB of space in
MBR partitioning scheme or you have to convert the disk to GPT.

To address the limitations of MBR disk, the GPT (GUID Partition Table) is introduced which uses the sectors
of 4096-byte.

Disk Partitioning Scheme

There are no strict rules for partitioning a hard drive, although one may follow the general guidance given
below. A disk partitioning scheme is determined by various factors such as desired flexibility, speed, security,
multi-boot requirement as well as the limitations imposed by available disk space. It is essentially personal
preference.

I will favor to stick with the default partitioning scheme especially for beginners or if you are installing Linux
on your desktop for personal use. If you are installing a server that will serve multiple users simultaneously
and provide a lot of services, you might need to create the seven or more partitions. But for a healthy Linux
installation, I would recommend four partitions: root, boot, swap, and home.

root (/) Partition

The root file system is represented by a forward slash (/). It is the top of the directory tree, and contains Linux
and everything that you install with Linux. This is roughly equivalent to your “C:” drive under Windows.
You must create a partition for the root directory.

The size of your root partition will vary depending on what you install or plan to install. The best bet is to
check your distribution’s documentation, and reserve enough space for a maximum installation, plus at
least 1GB more for temporary space and installation of new software. If you plan to download and try out lots
of software, leave more space. If you have a small hard drive, you can trim back on your installed packages to
save space. Since hard drives are getting massive and cheap these days, this should not be a problem. Isn’t it?

A 3.0 GB root (/) partition allows you to install a minimal installation, while a 5.0 GB root partition lets you
perform a full installation, choosing all package groups but I would recommend 10 – 15 GB. I know it sounds
a lot but opting for a really small size for root partition can give problems later. The /root directory is the
home directory of the user account for system administration.

/boot Partition

The /boot partition contains the operating system kernel which allows your system to boot the Linux, along
with files used during the bootstrap process. For most users, a 250 MB boot partition is sufficient. Note that
normally the /bootpartition is created automatically by the installer. However, if the /root partition is larger
than 2 TB and UEFI is used for booting, you need to create a separate /boot partition that is smaller than 2 TB
to boot the machine successfully.

Swap Partition

You need one partition that will be used as Linux swap space. This is space on your hard drive that can be used
as virtual memory. Virtual memory allows your computer to run large programs and perform complex tasks
even if it does not have enough physical RAM to do the job. It is lot slower than physical RAM, but it still
works.

Historically, the general rule for swap partition size was to allocate twice the amount of physical RAM. But as
computers have now gained larger memory capacities, this rule is outdated. The basic idea is that if you are
short on RAM with plenty of drive space, go large. If you’re short on drive space and have lots of RAM, go
small.

/home Partition

This partition will hold /home directory of your Linux system. This is the place where all the user files are
stored. It is roughly equivalent to the “My Documents” folder on a Microsoft Windows desktop. Each user will
have her own subdirectory under /home.

Frankly speaking, it is not necessary to create a separate partition for /home. If you do not create, it will reside
on the root partition like everything else.
But I will recommend creating a separate /home partition. Whether you are new or experienced user of Linux,
you will be going to play with files and make some experiments. And as you know in Linux, everything is a
file; if not, it is a process. In your experiments you might break something so badly that you will need to
reinstall the operating system, or you might want to reinstall in order to try a different Linux distribution.
Having a separate /home partition makes it very easy to wipe out and reinstall Linux without losing any of
your data.

You might also like