[sf-lug] problem using gnu parted
Aaron D Borden
adborden at a14n.net
Tue Jan 30 16:16:51 PST 2018
Quoting Alex Kleider (2018-01-30 10:08:50)
>
> 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
My guess is that parted is not using sectors at the unit by default.
Have you tried specifying the unit explicitly (adding an "s" to the
value)?
$ parted -s /dev/loop0 resizepart 2 5574007s
> ...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)
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
> Information about SF-LUG is at http://www.sf-lug.org/<br>
> Related Information <br>
> http://www.shallowsky.com/blog/<br>
> http://explainshell.com/ <br>
--
Aaron D Borden
Human and Hacker
More information about the sf-lug
mailing list