Resize a non-LVM ext3 Partition After Increasing Size of Virtual Drive

Steps to resize a (non-LVM) ext3 partition that is the only partition on a disk after increasing the size of the (virtual) disk.  The same steps are used if the partition to be resized is the last partition on disk though starting block must be exactly the same when creating the partition table!  Accepting the defaults as outlined will increase the size of the filesystem to fill the capacity of the drive.
  1. Resize the virtual disk
  2. Reboot
    1. yes it can be done without a reboot but guys far smarter than myself strongly discourage it!
  3. Unmount the drive
    1. umount /dev/sxxp
  4. Delete and recreate the partition table
    1. fdisk /dev/sxx
    2. d to delete (do not write)
    3. n to create new
    4. p for primary
    5. 1 for 1st partition
    6. accept remaining default for first and last blocks
    7. w to write
  5. Reread partition table
    1. hdparm -z /dev/sxx
  6. Check the filesytem
    1. e2fsck -f /dev/sxxp
  7. Resize the filesystem
    1. resize2fs /dev/sxxp
  8. Mount the filesystem, prostate assumes mount definition is in /etc/fstab
    1. mount /dev/sxxp

4 thoughts on “Resize a non-LVM ext3 Partition After Increasing Size of Virtual Drive

  1. Thank you for the description. But:

    5. Reread partition table
    1. hdparm -z /dev/sxx

    does not work if it is the root filesystem:

    /dev/sda:
    re-reading partition table
    BLKRRPART failed: Device or resource busy

    Is there any way to get around a reboot?

Comments are closed.