0

There are plenty of guides to resize a partition or even this question - How to to resize an ext4 partition from the command line?, however I'd like to know how to do safely this using a command line tool (this is for a rescue type environment).

Is it possible to be done with parted? It seems to have no knowledge of the used/free space within a partition (which is not safe). Is there way to resize this effectively and minimize potential mistakes / errors that could lead to data loss?

Usually I use Gparted for this sort of thing - but as I have no GUI I'd like to do this via command line.

  • If you are increasing the size of the partition and filesystem, it's a safe operation. If you are reducing, must take extra care. I have never lost data when reducing partition. To reduce partition, you should reduce the filesystem first, and then the partition. If possible you may take a disk image of the partition in another ssd/hdd before partitioning. – GMaster Mar 30 at 0:20
  • Exactly - 'extra care' when shrinking a partition. I'd want a command line tool to tell me if I'm shrinking the partition smaller than the existing data on it currently. And potentially other things that I'm NOT aware of. Which as mentioned exists with gparted. – Chris Stryczynski Mar 30 at 9:52
  • Have you tried using LVM? – user14755 Mar 30 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.