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.