Which is the most important component connected to your PC? Think!
Think what will happen if your graphics card suddenly decides not to work, your processor declares its retirement, your new BluRay optical drive comes up with an apology letter?
Still the most important component on anyone’s PC has to be their Hard Drive. For rest stuff you can buy a new piece to replace them, but our Hard Drive contains our important data which becomes too crucial if you haven’t had a recent backup of its data.
With new technology such as SSDs, the way we need to handle this device has change, here is our complete guide to the commands we need to use while operating this precious device, the concept of partitioning a drive in Windows and Linux operating systems
A hard drive needs structure before anybody could start storing files on it. In the simplest concept, drives are made up of sectors, which are the smallest units of data storage at fixed locations on the hard disk. There can possibly be millions of sectors in a drive, which are organized into meaningful groups at multiple levels.
Today, most PCs come up with just a single, large partition that occupies a large share of the hard drive. This appears as C: drive, many manufacturers such as Hewlett Packards makes a second partition which they call “recovery” partition, which contains the licensed Operating System along with the essential drivers. Partitions are created to separate various data areas. Take this for a hint, when you install a Linux OS on your Windows installed PC, Linux installer typically shrinks the Windows partition to make room for itself.
Master Boot Record (MBR)
It is the tiny part of the disk that contains the first part of the boot codes of all the operating systems installed on that hard drive. It also contains the partition table, and helps Operating Systems to know about the various partitions available on that drive.
Linux root (/) partition
It holds the operating system and all the application files of a Linux distro. It often is joined with the next partition.
Linux /home partition
The other files of the user like movies, songs, documents and other personal data are stored in this partition.
It is a NTFS partition that contains the Windows OS system files.
This is an interesting concept. This partition is used for virtual memory, it doesn’t poses files like what a normal partition does. The Linux kernel uses it as a larger, yet slower reservoir of RAM for idle tasks. You can make it as large as you want, but practically no more than 4 GBs are suggested to anyone.
One of the most popular and terse, minimal and readily available partitioning tool that is present in almost every Linux distro, fdisk is a powerful tool to remap your hard drive partitions.
In a typical Linux distribution, sda1 is the first partition on the on the first drive and with the same logic, sdb2 is the second partition on the second drive.
/dev/sda refers to the first hard drive.
/dev/sdb refers to the second hard drive, and so on.
To get started, log in as root user, and type
To delete a partition, enter D and you will be prompted for the number.
To add a new partition, enter N.
If you ever find this rocket science tough, always select primary in the proceeding dialogue box, but remember you can only create 4 primary areas.
To create ID, enter T, with the partition number, and then Shift + L to list the available types. Enter 83 for Linux partition, 82 for a swap partition, and 7 for a Windows (NTFS) partition.
The most important directories
The root (/) directory itself contains lots of directories, that you might not be familiar with much.
|/bin||Stores the binary files, or more specifically executables that are used by the base system. However, it doesn’t contain large applications, such as Chromium.|
|/boot||Files holding the booting information, such as the Linux kernel.|
|/dev||Device related files, such as drivers. More specifically files that are used to access hardware devices.|
|/etc||Configuration files (reserved for the system)|
|/media||Removable devices, such as USB keys are often mounted here.|
|/mnt||Another place for mounting drives, it mounts hard drives and network shares|
|/opt||Optional application packages. Such as KDE or LibreOffice can be found here.|
|/proc||Process Information. An admin can monitor a program’s resource consumption.|
|/sbin||Critical executables for running the system, but those programs can only be accessed by admins (root users)|
|/usr||It contains non critical files, such as large applications. Inside /usr/lib you can find most of the libraries used by those software,|
|/var||It contains file such as databases, mail spools and system logs report. Yes, the variable files whose data keeps changing.|
Before getting to it, let’s discuss about some of the features of the filesystem.
Without the filesystem, the hard drive is just storing a jumble of data. It is the filesystem that helps the operating system to make sense of the disk. It helps them to figure out the starting point of the hard drive, where the start, where they end, and which directories they belong to. For instance, in DOS FAT filesystem, we have table in the sirst few sectors, describing where all the files on the hard disk are located.
The most common filesystem in the Linux distro’s is ext4, which is an excellent, reliable, general purpose filesystem for hard drives. NTFS is used widely in Windows. It’s a quite surprise to see a relatively quiet older filesystem, such as FAT32 in this modern technology era. New hard drives and USB drives are still being shipped pre-formatted in this filesystem.