How to resize FAT32 partition from command line?

Using applications, configuring, problems
Post Reply
Message
Author
did18
Posts: 417
Joined: Wed 19 Nov 2014, 22:27

How to resize FAT32 partition from command line?

#1 Post by did18 »

Hello

I copied a fat 32 image of 2GB on a 32GB usb key.
Of course, there is a lot of empty space on the usb key ...
I would like to extend the partion (and file system) of the copied image to all media.

- I do not want to use GParted.
- I will only want to do it on the command line.

I saw that it existed "fatresize", but this command no longer seems maintained and despite the updates, I always get error messages when I try to use it (segmentation error or other messages which I do not understand very well the meaning (my English is very bad sorry-fortunately google translation exists ;-))

I tried (after updating) the parted command.
Here too it does not seem possible to extend a fat32 partition.

What's in the key is not important (I can easily erase and recreate it with the "dd" command) and it's a test key.

Can you help me solve this problem, if possible with sample orders or other orders to use ...?

Thank you.

Have a good day.
Attachments
fatresize1.jpg
(30.65 KiB) Downloaded 315 times
fatresize2.jpg
(15.88 KiB) Downloaded 206 times
parted2.jpg
(50.13 KiB) Downloaded 318 times
parted3.jpg
(38.07 KiB) Downloaded 321 times

Sailor Enceladus
Posts: 1543
Joined: Mon 22 Feb 2016, 19:43

#2 Post by Sailor Enceladus »

Interesting. Which puppy are you using? I have not tried a command line tool to resize partitions (I have always had success with GParted and like the way it shows me what's happening visually) but might try later and show you what version of these command line tools my slacko puppies have. Maybe the partition has to be unmounted first, and maybe the rest of the drive unallocated. I remember when my fat32 partition was over 2GB, scandisk in Dos would always claim the parts beyond 2GB were corrupted, I think I eventually found a scandisk version that worked beyond 2GB - maybe it was a legacy problem from fat16.

edit: Yeah I don't think using command line is a good idea. Better to use GParted that shows you what it's doing.

did18
Posts: 417
Joined: Wed 19 Nov 2014, 22:27

#3 Post by did18 »

Hello

Sailor Enceladus : Thank you for this quick response...

Apparently, there is also and above all a problem of size ...

Wikipedia states that: "formatting in FAT32 is limited to 32 GiB".
Here as the usb key is 32GB should be appropriate, but with the advent of larger media, it will resolve to go through another type of format (ntfs or the excellent ext2, 3, 4) that manage better the rights, are less expensive in terms of resources and above all allow larger sizes ...

To return to GParted (which is not to present and whose reputation is fully justified), actually some of the orders appears.
But only part!
For example (in vfat32) if we do a "verification" it is the command:
dosfsck -a -w -v ''etiquette'' /dev/name of the partition that is displayed.
But during an enlargement or reduction of partition there is simply a comment:
"use of libparted" without further specification ...

- I use ToOpPy v2.2.
- When I work on the usb key (as a support example /dev/sdb), I always ask for its "dismounting", so the partitions /dev/sdb1, /dev/sdb2 etc ... are normally dismounted.
- In my example, I use only one partition (/dev/sdb1) and after using "dd" I confirm that the rest of the space of the key is free (and not formatted)

Have a good day.

User avatar
Burn_IT
Posts: 3650
Joined: Sat 12 Aug 2006, 19:25
Location: Tamworth UK

#4 Post by Burn_IT »

You missed ExFAT for larger media
"Just think of it as leaving early to avoid the rush" - T Pratchett

did18
Posts: 417
Joined: Wed 19 Nov 2014, 22:27

#5 Post by did18 »

Hello,

Yes Burn_IT, indeed there is also "exfat"...
But as shown in the screenshot of GParted, this type of partition is partially supported, in addition to other types of formats, GParted does not show the tools used (right column).

Have a nice day.
Attachments
171122_162427_787x657_easyshot.jpg
(72.97 KiB) Downloaded 220 times

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#6 Post by Peterm321 »

did18 17 November 2017, 13:42 wrote: I saw that it existed "fatresize", but this command no longer seems maintained and despite the updates, I always get error messages when I try to use it (segmentation error or other messages which I do not understand very well the meaning (my English is very bad sorry-fortunately google translation exists Wink)
Segmentaion fault seems to translate into the French more or less as in English, erreur de segmentation. It is a generic term usually related to some kind of memory allocation failure or a dodgy pointer, "pointeur dangereux?"

https://fr.wikipedia.org/wiki/Erreur_de_segmentation

I have a copy of the this commandline program, and I tested it by creating a zero filled 50 Megabyte file, formatted it with mkfs.vfat then fatresized it to 40M.

My first suspect would be the libraries fatresize depends on, particularly libparted-fs-resize there may be incompatibilities. The ldd command displays on a terminal a program's dependencies. Note that it is also possible to download in error a 32 bit program and run it in a 64 bit system or vice versa. The "file" command e.g

Code: Select all

file <path to program>
will say what bit size and system the program was compiled for.

If you can't resolve the problem, but still want to use the fatresize program I would be very surprised if it wasn't on one of these system rescue CD/DVDs that can be downloaded and burned to a DVD and run as a live CD.
Attachments
FATRESIZE.JPG
Screen dump of the commandline program fatresize
(57.04 KiB) Downloaded 199 times

did18
Posts: 417
Joined: Wed 19 Nov 2014, 22:27

#7 Post by did18 »

Hello.

In fact, I think there are several problems...
Fatresize does not appear to be installed in the same location (screenshot 1).
If the version number is the same, the date is different (is it very important?).
Dependencies are not identical.

To find fatresize, I used "pfind"... (screenshot 2)
Since dependencies did not appear in the terminal, I used "crearch"... (screenshot 3)
I was able to see that fatresize needed 11 dependencies (on my system)

The list of the 11 dependencies... (screenshot 4)

Have a nice day.
Attachments
171126_120233_550x463_easyshot.jpg
(34.83 KiB) Downloaded 177 times
171126_120426_1096x448_easyshot.jpg
(61.59 KiB) Downloaded 186 times
171126_120534_645x608_easyshot.jpg
(59.24 KiB) Downloaded 157 times
171126_120910_645x608_easyshot.jpg
(50.23 KiB) Downloaded 165 times

Peterm321
Posts: 411
Joined: Thu 29 Jan 2009, 14:09
Location: UK

#8 Post by Peterm321 »

did18 Yesterday, at 11:35 wrote: In fact, I think there are several problems...
Fatresize does not appear to be installed in the same location (screenshot 1).
If the version number is the same, the date is different (is it very important?).
Dependencies are not identical.
Hello

Yes there are some difference between my system and yours. That is one reason I suggested trying one of these rescue CDs, eg System Rescue CD

https://en.wikipedia.org/wiki/SystemRescueCD

(Not sure if fatresize is on it - I would expect at least some of these rescue CDs would have it)

https://en.wikipedia.org/wiki/List_of_d ... y_software

The date on my version of fatresize is by reason I compiled it myself. The compiler would have linked up with what dependencies were available. That rather long list of dependencies could be one reason for the segfaults. Compiling, though, does requre you to download and install the relevant devx squashed file system for your version of Puppy. Puppy linux typically does not provide the gcc compiler by default built-in.

By the way, on your system the fatresize is located in /usr/sbin so the ldd command could work by

Code: Select all

 cd /usr/sbin  ; ldd ./fatresize 
If you do want to investigate your system you could try the strace command which displays on the screen the APIs called by a program. It produces a lot of output which will stop at the segfault.

Another alternative to a live CD is to search the forums or pkgs.org or rmpfind.com and find an alternate version of fatresize that is either statically compiled or with different dependencies that won't segfault.

Post Reply