7

I would like to create an image of a Linux Mint disc.

Then I'd like to copy it to a bigger disc and extend its partition to the full size of the disc.

I have already copied the disc using WinImage to another PC, wrote the data on a bigger disc and turned it on.

I have been searching for some mechanism to extend a partition with Linux without success.

With GParted it works perfectly, but I would like to do it in a console. I have been trying to do this using parted, GPart or lvextend but I cannot find any option which allows me to extend a partition size without unmounting it.

EDIT

Type of file system is ext4, which I checked with parted command.

1
  • I guess, LVM is what you are looking for
    – SHW
    Jul 14, 2014 at 6:07

1 Answer 1

3

Extending (but not shrinking) an ext4 partition works without unmounting it:

Check that the corresponding entry in the partition table has already the target size (for example by using fdisk). Then it could then be needed to force the OS to reread the partition table with e.g. partprobe from the parted package (for more option, see https://serverfault.com/questions/36038/reread-partition-table-without-rebooting ).

For the final resizing, call

resize2fs /dev/sdXY

It should automatically known the new partition size.

1
  • resize2fs doesn't seem to work if the partition is mounted, though. So you still need to unmount for that to work :-(
    – Frans
    Apr 19, 2023 at 8:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .