How to create a disk partition in Linux.
Fdisk Utility in Linux
Run fdisk –l command to list the available partitions and also to identify the disk definition.
After obtaining this information, I will be adding a new partition on my disk /dev/sda.
Run fdisk /dev/sda to launch the fdisk utility. You can invoke m (depicts manual) to give you a list of the options available within the utility. Then type n option and hit enter to create a new partition. Enter p for primary partition. Then enter the partition number accordingly.
For my case, the disk /dev/sda has 2 partitions already, i.e. /dev/sda1, and /dev/sda2. So the new partition to be created should be /dev/sda3. Please note that the disk names can differ. Instead of /dev/sda, your disk can be reading a different name. e.g. /dev/sdb.
Then, accept the default values offered by just hitting enter until you return to the prompt.
Finally, type w to write changes to disk and finally exit from the fdisk utility.
We are going to reboot the VM now so that the new partition can be read and availed after the VM is up.
Execute fdisk –l to list all the partitions inclusive of the newly added partition. We can see /dev/sda3 which is our new partition.
Comments
Post a Comment