
In this article you will learn how to create a simple partition from command line. We would use a simulated exam question.
Example Question : -
Add a new logical partition having size 100MB and create the /data directory which will be the mount point for the new partition.
To accomplish this task you must be login form root account. So first login from root and verify hard disk status with fdisk –l command ( This command will show that where your hard disk is mounted. You should use the mount point which show in the output of this command. For example if you see /dev/hda then you should use fdisk /dev/hda in next command. Or if you see /dev/sdb then you should use fdisk /dev/sdb in next command.
As you can see in image shown below that My hard disk is mounted as /dev/sda so I will use fdisk /dev/sda)

Follow these steps at command prompt in same sequence
n
press enter
+100MB
press enter
w
#partprobe /dev/sda

fdisk commands is used to create new partitions. partprobe command is used to inform kernel about this change.
Create a /data folder and mount the partition with these commands

lost+found is a partition specific folder that will appear only in those directory that represent an active partitions.
Create a entry for newly created partition in /etc/fstab so that it can be mount automatically after reboot as shown in image

Reboot the system with this command
#reboot -f
After reboot run fdisk -l command to verify that partition has successfully mounted.

You have effectively accomplished the task given you now its time to remove these partition.

don't forget to remove entry from /etc/fstab files also otherwise you will get error on next boot.
![]()

Search more about
Search in Google for
