Resize fat32 filesystem to fill partition using parted
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Distribution: Fedora, Knoppix, Slackware, openSuse, and SystemRescueCD
Posts: 9
Rep:
Resize fat32 filesystem to fill partition using parted
Here's my story: I'm having to re-image Windows XP boxes using PartImage, but not all of the machines have the same size hard drive. This will be done with no human interaction at all, and I've come across a snag. Since we don't know how big the hard drive or partition will be, the image we are using will be just big enough to hold Windows, and then we will expand the file system to match.
I know this is done easily with ntfs by using ntfsresize... But we cannot use ntfs (some of the machines use solid state drives, and ntfs's journaling will prematurely wear them out--they run 24-7-365 x n). I've been pouring through the parted documentation, and I'm not sure if it will do the same thing or not...
Will using parted (device) resize (current start) (current end) actually resize the file system to match the partition size? Or am I going about this the wrong way?
Thanks to anyone who can point me in the right direction!
Distribution: Fedora, Knoppix, Slackware, openSuse, and SystemRescueCD
Posts: 9
Original Poster
Rep:
For posterity's sake, I'll let you know what I found out:
After partimage was done copying the image on to the partition I was left with a 40GB partition that had a 5GB file system on it. Linux could "see" the partition at the correct size, while Windows could not.
What I did in my bash script was I grabbed the $STARTPOINT and $ENDPOINT of the partition and passed them into parted:
(DRIVETYPE being either hda or sda, depending on the computer's hardware) Apparently, since parted resizes the file system when it resizes a partition, it will grow the file system to match. Nice.
As I mentioned before, this was for fat32. NTFS will not work, but that's why we have ntfsresize, eh?
Distribution: Fedora, Knoppix, Slackware, openSuse, and SystemRescueCD
Posts: 9
Original Poster
Rep:
Revisited
Hate to beat a dead horse, but...
Now I have an issue with a warning that says "Warning: File system reports free space as XXXX clusters, not XXXX clusters."
In script mode, it does not prompt to Ignore/Cancel. It simply cancels. But typically if you use it, and it comes up with the error and you choose ignore, parted will work just fine with no problems... is there any way at all to get it to select ignore? It defeats the purpose of having a script mode, doesn't it?
I've tested using parted in interactive mode using Here-Documents, to no avail. Are there any other tools in Linux that allow scripting to grow a fat32 file system to fill a partition's free space? What gets me is that on the machine I'm testing on, it does not always fail. Sometimes it does, sometimes it doesn't. Arg.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.