For example 1GiB disk with GPT:
echo ", +10M" | ./sfdisk -N 1 /dev/sdc ... Old situation: Device Start End Sectors Size Type /dev/sdc1 2048 206847 204800 100M Linux filesystem New situation: Device Start End Sectors Size Type /dev/sdc1 2048 227327 225280 110M Linux filesystemthe first partition (-N 1) has been enlarged from 100MiB to 110MiB.
You can also move begin of the partition:
echo "+2M" | ./sfdisk -N 1 /dev/sdc ... Old situation: Device Start End Sectors Size Type /dev/sdc1 2048 227327 225280 110M Linux filesystem New situation: Device Start End Sectors Size Type /dev/sdc1 6144 231423 225280 110M Linux filesystemand it's possible to enalarge as much as possible:
echo ", +" | ./sfdisk -N 1 /dev/sdc ... Old situation: Device Start End Sectors Size Type /dev/sdc1 6144 231423 225280 110M Linux filesystem New situation: Device Start End Sectors Size Type /dev/sdc1 6144 2047966 2041823 997M Linux filesystemthe '+' means "all available space". And vice-versa you can reduce the size of the partition; it's possioble to specify the size in absolute numbers (without +/- signs), or in sectors. The next example reduce size to 100MiB and move to old good offset 2048:
echo "2048,100M" | ./sfdisk -N 1 /dev/sdc ... Old situation: Device Start End Sectors Size Type /dev/sdc1 6144 2047966 2041823 997M Linux filesystem New situation: Device Start End Sectors Size Type /dev/sdc1 2048 206847 204800 100M Linux filesystemNote that fdisks are too low-level to care about filesystems when resize, it's all about partition tables only.
These features saved my life where I was unable to use any GUI tool. Thanks a lot.
ReplyDeleteThank you, helped me with a win10 imaging project for work
ReplyDeleteمكافحة حشرات nudQYtt7Hx
ReplyDeleteشركة مكافحة حشرات بالجبيل XSf01gliAA
ReplyDeleteشركة رش حشرات بالاحساء Y2DbB0rMMx
ReplyDelete