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. |
![]() |
2. Use p Option to print existing partition table. |
![]() |
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. |
![]() |
5. Let us create extended partition. |
![]() |
![]() |
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. |
![]() |
7. Below is partition table of the hard drive. |
![]() |
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. |
![]() |
10. Now change the ID using t option. |
![]() |
11. After change, your partition table should look like as below. |
![]() |
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. |
![]() |
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. |
![]() |
16. Now create mount points for these partitions. |
![]() |
17. Mount the drives and check the same. |
![]() |
That’s All ! |