There are 4 partitions on the disk.
parted /dev/sda --script -- print
...
1 1049KB 50.0GB ... ext4
2 50GB 82GB ... linux-swap
3 82GB 100GB ... ext4
4 100GB 1000GB ... ext4
My goal is to modify the starting position of 4, then expand 3, at the same time without losing data. I know using gparted it would be quite easy but it is within an automatic script and cannot launch UI.
After some search, it seems to use "cfdisk" to delete and create new partition, then do "resize2fs". But the trick is, if I modify the starting position of a partition, the "ext4" property is gone and "resize2fs" complain unknown super-block.
Thank you for the help.