Fixing partition size mismatch error

Many times, after cloning a partition using dd, we get warnings and error messages about a size mismatch between the physical partition size and the one contained in the partition table.

To alleviate the issue, apart from using gparted, parted, partx and whatnot, we can use a terminal, to

  • First make sure the partition is unmounted (run “mount” and look for it or “df” or whatever handy)
  • Run:
    sudo e2fsck -f /dev/xxx
    resize2fs /dev/xxx
    (where xxx is the partition that you want to handle)