Disk Partitioning and Making filesystem


It is important to select disk drives that match the interfaces of the system on which they will be installed.

  • IDE (Integrated Drive Electronics) {also known as PATA Parallel Advanced Technology Attachment} was developed as a simple, low cost interface for PCs. It put the hardware controller in the same box as the disk platters and used a relatively high-level protocol for communicating between the computer and the disks.
  • SATA (Serial Advanced Technology Attachment) is the successor to IDE because electromagnetic interference and other electrical issues begun to cause reliability concerns at high speeds in PATA. SATA simplifies connectivity with tidier cabling and a longer maximum cable length. SATA eliminate the need for master and slave designations because only a single device can be connected to each channel.
  • SCSI (Small Computer System Interface)is a set of standards for physically connecting and transferring data between computers and peripheral devices. The SCSI standard does not specify how a disk is constructed or laid out, only the manner in which it communicates with other devices.
  • Fiber Channel is serial interface that is gaining popularity in the enterprise environment. Fiber channel can speak several different protocols including SCSI and even IP.
  • USB (Universal Serial Bus) has become popular for connecting devices such as keyboard and mouse, it's current versions have enough bandwidth to support disk drive and CD-ROM.
Partitioning is a means to divide a single hard drive into many logical drives. A partition is a contiguous set of blocks on a drive that are treated as an independent disk. A partition table is an index that relates sections of the hard drive to partitions.

  • The ROOT Partition is the partition which store everything needed to bring the system up to single-user mode is kept here.
  • A SWAP Partition stores pages of virtual memory when not enough physical memory is available to hold them.

The organizational structure inside a partition is called a file system. With Linux, the standard file system is ext2 and ext3. The ext3 file system is ext2, plus a log of disk writes called a journal. The journal allows the system to recover quickly from accidental power outages, among other things. 

Difference between primary partition and logical partition is primary partition no need a boot loader and logical partition need a boot-loader to boot.

In linux we can create 3 primary partition. All other extended Partition collectively call hda4 or sda4.




hda4 or sda4 Extended partition
MBR 512bytes
hda1 or sda1
hda2 or sda2
hda3 or sda3
hda5 or sda5
hda or sda6
hda or sda7

HDA=IDE.

SDA=sata/ssd/skesy. 

#fdisk -l or #df To view all disk.


root@debian:/home/varun# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd412e3f8

Device Boot Start End Blocks Id System
/dev/sda1 2048 23631871 11814912 82 Linux swap / Solaris
/dev/sda2 * 23631872 195506175 85937152 83 Linux
/dev/sda3 195508222 976771071 390631425 5 Extended
/dev/sda5 195508224 976771071 390631424 83 Linux


If user want know more about particular partition.

#fdisk -l /dev/{sda*}, * is the number of partition. 

For partitioning a disk,

#fdisk /dev/sda*

root@debian:/home/varunq# fdisk /dev/sda5

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help):

If user give 'n' it will as whether 'p (Primary)' or 'e (Extended)'. Default partition system ID will be 83. Press 'l' for available system ID.

82 Linux swap/Solaris

83 Linux

If system ID want to toggle, press 't' and give new system ID.

After that press 'wq' for write and quite. If give 'q' only all the process will quite without take effect. 

#mkswap /dev/{sda1,2..} that HDD partition become swap partition. After formated on swap we must enable swap partition.

#swapon dev/{sda1,2..}

#mkfs -t ext3 /dev/{sda1,2...} Through this command user can format the partition using ext3. If we want format using ext2 #mkfs -t ext2 /dev/{sda1,2...}. 

Through these process only inode table will deleted.

After that reboot by giving #init 6. The new partition will save.


No comments:

Post a Comment