1

How can I create a 500 Mb partition formatted on ext4 via command line ? Is this possible ? I'm trying to get accustomed with the terminal on Ubuntu 14.04.

0

1 Answer 1

1

The utility that you want to use is fdisk however you should use it with sudo in orded to have permission to do such administrative task. You can use sudo fdisk -l or even more specific sudo fdisk - l dev/sda to take a look on the current state of your hdd( size, partitions,free space,etc).

Now for creating a new parttion.Use sudo fdisk dev/sda(assuming you only have one hdd) you will be prompted with a small menu (you can alway use m for help).What you want to do is to use the n option to create a new partition. Choose p for primary or simply press Enter(it's the default option).For the first sector you can leave it empty(it will be the default option). it is on the last sector where you really choose the partition size. +500M is what you want to tpye(In other cases it could be +10G, or +200M,...) press ENTER. Now you just created a partition and you are back to the fdisk main menu.Press w to "save changes".

The next utility you want to use is called mkfs more specific mkfs.ext4(there is also mkfs.btrfs or mkfs.ntfs , mkfs.fat you got it...) sudo mkfs.ext4 /dev/sdax(where x is the number of the new created partiton(the last one if you do a fdisk -l /dev/sda again)) this will add the ext4 fs. on top fo your partition. Done!

0

Not the answer you're looking for? Browse other questions tagged .