Skip to main content

Expanding parititions

Backup partition table

fdixk -x /dev/<dev>
sfdisk -d /dev/<dev> > partition.dump

Shrinking EXT(2,3,4) file system to minimum size

e2fsck -f /dev/<dev partition>
resize2fs -M /dev/<dev parition>

Editing partition table and restore

After shining the last partition you need to:

  1. Image it (see the other pages) and any other portions that need to be moved.
  2. Use fdisk to delete the resized last partition.
  3. Move other partitions (keeping exact size).
  4. Expand the target partition (keep starting sector unchanged).
  5. Copy data from images into moved and last partition.
  6. Resize the target partition and the last partition to max size with resize2fs /dev/<dev parition>.

Use fdisk's expert mode (x) to print full partition information and to restore partitions UUID, name and attributes.

To resize vfat (FAT32) partition you can useĀ fatresize -s max /dev/<dev partition> (from parted package).