[sf-lug] problem using gnu parted

Alex Kleider akleider at sonic.net
Tue Jan 30 10:08:50 PST 2018


I'm working on a script that can shrink an .img file created by 'dd'ing 
an sd card to the .img file.
'parted' is telling me something that seems inconsistent with the facts- 
here's some output to illustrate:

"""
Partition 2 file system size is now (684975 * 4096) 2805657600 bytes.
Use GNU parted to list partitions...
   $ parted /dev/loop0  unit 's' print
...and pipe it into ./get_parted_info.py  (a script to extract the 
sector boundaries)
For each partition:
   #  Begin    End
   1  8192     93236
   2  94208     7744511
About to run following command:
   $ parted -s /dev/loop0 resizepart 2 5574007
...to resize the second partition.
Error: The location 5574007 is outside of the device /dev/loop0.
Error setting last sector of 2nd partition!
"""
... but 5574007 is considerably less than 7744511!!

I switched from fdisk to parted so that I could automate the procedure 
(with in a script.) When doing it manually using fdisk, it went fine. 
Using parted manually resulted in the same error.

Any ideas welcome!
-- 
Alex Kleider
(sent from my current gizmo)



More information about the sf-lug mailing list