Creating Fixed Disk Partition

There are many ways to create fixed partitions on hard drive. Most people prefer fdisk command to create partitions.
In following example we have one hard drive /dev/xvdb. Our aim is to create three partitions on this disk of size 200 MB each. After formatting we will mount this partitions as below,
200 MB DOS Compatible Drive will be mounted in /mydisk/dos Folder
200 MB DOS Compatible Drive will be mounted in /mydisk/win Folder
200 MB DOS Compatible Drive will be mounted in /mydisk/linux Folder
Below are the steps to create this one.
1. Use fdisk command as below and check the partitions and space available. We can have 63 partitions on normal disk like PATA and SATA, but on SCSI Drive only 15 partitions are possible.
FixedPartition-1.png (208801 bytes)
2. Use p Option to print existing partition table.
FixedPartition-2.png (20848 bytes)
3. The above case is very simple. There are no existing partitions here. So we will create one primary drive and remaining two drive will be created as logical drives in extended patition
4. Primary Drive is created.
FixedPartition-3.png (123134 bytes)
5. Let us create extended partition.
FixedPartition-4.png (134156 bytes)
FixedPartition-5.png (26530 bytes)
6. Now let us create two more drives of 200 MB Each as logical drives. By default all drives created using fdisk command are Linux Compatible. We will change the Partition ID later on.
FixedPartition-6.png (211974 bytes)
7. Below is partition table of the hard drive.
FixedPartition-7.png (199379 bytes)
8. The drives /dev/xvdb1, /dev/xvdb5 and /dev/.xvdb6  are newly created drives but they are Linux compatible. We will now change the partition id as per our needs. We will mark /dev/xvdb1 as DOS Drive,  The drive /dev/xvdb5 will be Windows Fat32 Bit
Drive and lat drive /dev/xvdb6 will be Linux Drive.
9. This requires change in Partition ID. We can use t option to change the Partition ID, but before we move ahead, lwt us check Partition ID List using l command in fdisk.
FixedPartition-8.png (411252 bytes)
10. Now change the ID using  t option.
FixedPartition-9.png (14136 bytes)
11. After change, your partition table should look like as below.
FixedPartition-10.png (42197 bytes)
12. If everything is OK the using w option you can save the changes to MBR. This will quit fdisk command but make sure that you will be updating the changes in Partition table to kernel using partprobe command as below.
FixedPartition-11.png (10249 bytes)
13. All partitions are now created and we should format them using mkfs command.
14. There are command like mkfs.msdos, mkfs.vfat, mkfs.ext4 to format partition. If you have installed minimum OS then you need to install dosfstools Package first. This package will install all dos / windows related format commands.
15. Below are the screen shot of the commands.
FixedPartition-12.png (157257 bytes)
16. Now create mount points for these partitions.
FixedPartition-13.png (3504 bytes)
17. Mount the drives and check the same.
FixedPartition-14.png (113796 bytes)
That’s All !