Suppose your disk layout looks like this:
(parted) print Disk geometry for /dev/hda: 0.000-1000.000 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.063 500.000 primary ext2 2 500.000 625.000 primary linux-swap
There is 375 Mb of free space at the end of the disk (after partition 2). Partition 1 has an ext2 file system, which is the root device. Partition 2 is a swap device.
Suppose you wanted to use the free space at the end of the disk for the file system on partition 1. You could do the following:
# parted /dev/hda
(parted) rm 2
(parted) mkpartfs primary linux-swap 875 999.9 (parted) print Disk geometry for /dev/hda: 0.000-1000.000 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.063 500.000 primary ext2 2 875.000 1000.000 primary linux-swap
(parted) resize 1 0.063 874.9All done!
(parted) print Disk geometry for /dev/hda: 0.000-1000.000 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.063 874.999 primary ext2 2 875.000 1000.000 primary linux-swap
Go to the first, previous, next, last section, table of contents.