Resize ext3 partition of linux VM

Example for a non-root partition /dev/sdb1 mounted on /srv/backup

  • Resize the harddrive in your virtualisation application
  • Umount the partitions that requires to be resized
    • umount /srv/backup
  • Make a Filesystem check in  your partition on that device
    • fsck -n /dev/sdb1
  • Now the partition is clean but it is still using Ext3. Ext3 can not be resize but ext2 can. So we need to convert the partition ext3 to ext2. The conversion is basically done disabling journal on ext3
    • tune2fs -O ^has_journal /dev/sdb1
  • Now we need to make another filesystem check on ext2 format
    • e2fsck -f /dev/sdb1
  • Delete partition /dev/xvdb1 and create it again with the new size
    • cfdisk /dev/sdb
  • Do a filesystem check to make sure that everything is running smoothly
    • fsck -n /dev/sdb1
  • Run the resize command so ext2 knows about the enlarged size of the partition
    • resize2fs /dev/sdb1
  • Turn on journal again (Making it ext3)
    • tune2fs -j /dev/sdb1
  • Remount the parttion
    • mount /srv/backup
  • Check the size
    • df  -h