4

I've recently run into an issue where I need to resize a partition on a server, but the issue is, it has no GUI so I cannot use gparted. What should I do in this case?

So I get it that you should use parted. However, how exactly do you use the parted command? What does it mean by start and end?

Braiam
  • 69,112

1 Answers1

2

Use parted:

parted device resize minor start end

Resizes the partition with number minor from device device. The partition will start start from the beginning of the disk, and end end from the beginning of the disk. resize never changes the minor number. Extended partitions can be resized, so long as the new extended partition completely contains all logical partitions.

Note that parted does not require a file system to be "defragged" (parted can safely move data around if necessary).

Supported file systems:

  • ext2, ext3 - restriction: the new start must be the same as the old start.
  • fat16, fat32
  • linux-swap
  • reiserfs (if libreiserfs is installed)

Example:

sudo parted -i /dev/sda resize 3 200 850

Resize partition 3 from /dev/sda, so that it begins 200 megabytes and ends 850 megabytes from the beginning of the disk. -i (--interactive) prompt for your intervention, where necessary.

Source: Parted User's Manual.

See also man parted for more info.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407