how to create a partition in free space using GNU Parted
Number Start End Size File system
......................................
468GB 520GB 52.4GB Free Space
Well, as you can see Start is 468GB
and End is 520GB
. Now, parted
defaults to MB
so you'll have to specify the unit
:
unit GB mkpart primary ntfs 468 520
or append unit suffix to the start/end numbers:
mkpart primary ext2 468GB 520GB
Alternatively, you can list the values in MB
with
unit MB print free
and then use the start/end values without any unit/suffix e.g.
mkpart primary ext2 468012 520008
Another solution would be to use percentage unit (%) to specify sizes:
sudo parted -s /dev/sdX mkpart primary 0% 100%
If a label is not present in the disk device, you will need to create it first. For example:
sudo parted -s /dev/sdX mklabel msdos
Caution! 0% and 100% points correspondingly to the start and to the end of entire physical disk, and not just free space. So if you run sudo parted -s /dev/sdX mkpart primary 0% 100%
, this will destroy all existing partitions.