[raspberry-vi] Re: trouble shrinking partition

  • From: Kelly Prescott <kprescott@xxxxxxxxxx>
  • To: raspberry-vi@xxxxxxxxxxxxx
  • Date: Sun, 3 Jan 2021 00:14:54 -0500 (EST)

You certainly can script the fdisk command.
It does not require manual input.
You could also use bc or other tools to do the calculations and 
conversions for you.
You could write the entire script in bash, python, perl, or any other 
language that you like.
The hard part would be all the error checking and device selection code.




On Sun, 3 Jan 2021, Mewtamer wrote:

I have a script for writing/creating Pi Images with dd because it's
one of those commands whose syntax is a bit too complex and usage a
bit too infrequent for me to memorize the important bits.

That said, I think the hard part of converting the shrinkage
instructions to a script might lie in that at least part of the
instructions involve using fdisk(and possibly other utilities)
interactively, which doesn't lend itself well to scripting and that
there are some steps where you take a number outputted from one
command and use it as a parameter elsewhere, often with a unit
conversion in-between, and I'm not sure piping alone can handle that.

I'm sure a script could be written to automate the process, and
failing that, a program could be written to do it, but I think the
former is beyond my current knowledge of Bash scripting, and the
latter is well beyond my knowledge in C++, the programming language
I'm most comfortable with.

Though, one would think there would already exist a tool for this... I
mean, setting up one machine and then creating an image that can be
written to other machines to save time isn't anything new, nor did it
come along with the first models of the Raspberry Pi and
removable/network  storage for distributing the image was more limited
in the past than today, so keeping images small would be important
even if you could be sure all the target machines had at least as much
storage as the master.

As an aside, the summer following when I graduated with my Associates
Degrees, I got an internship with my community college's Computer
Administration team and helped them deploy images to the computer labs
used for the college's IT, Programming, and CAD courses, totalling
close to 200 machines across more than half-a-dozen labs.
===========================================================
The raspberry-vi mailing list
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of 
the Foundation.

Mike Ray, list creator, January 2013


=========================================================== 
The raspberry-vi mailing list 
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of the 
Foundation.

Mike Ray, list creator, January 2013

Other related posts: