2

I have an SD card with 3 partitions: FAT32, EXT4 and swap. I shrank and moved them recently, but due to a bug in GParted (segfault while resizing FAT32) it is left like this:

Size: 5.87 GiB

Used: 623 MiB

Unused: 4.37 GiB

Unallocated: 915 MiB

GParted suggests me to repair the partition with Partition -> Check, but there's that bug. Any other tools which can do the same thing - expand fat32 size to the same as in the partition table? I tried dosfsck/fsck.vfat and MS chkdsk, none of them helped.

GAD3R
  • 66,769
pfoof
  • 23
  • FWIW, using flash memory for swap space may reduce its lifespan. OTOH, if you have enough RAM, swap will rarely be used. It's nice to have some swap space, just in case you do need it, but it's much better to use a partition or file on a real disk, if possible. Also, it may impact the proper operation of an SD card if you reformat it. But if you do reformat it's a good idea to mount the partition with the noatime option, to avoid writes to the card on every access. – PM 2Ring May 15 '16 at 15:20
  • It's for Android booted from SD on a phone, I know it doesn't need swap, but well, I can always add some to be mounted manually on boot for kernel and /bin executables. – pfoof May 15 '16 at 15:40
  • Ok. Android probably uses noatime by default. And hopefully it won't thrash your swap partition. – PM 2Ring May 15 '16 at 15:56

1 Answers1

3

Use fatresize. Be sure to tell it the right partition size, beware of rounding and of different units (SI vs 1024-based). Run grep sdb1 /proc/partitions to get the size of the partition in units of 1024 bytes, and run fatresize -s NNNki /dev/sdb1 (change sdb1 to the actual name of the partition of course).

  • This didn't work. I tried entering larger numbers to fatresize, but nothing changed. fatresize -i /dev/sdc1 says: Size: 5347737600 Min size: 655062016 Max size: 7969177600 even after sudo fatresize -s 6159360ki /dev/sdc1 – pfoof May 15 '16 at 15:30
  • Ok, it worked, but I had to use a card reader (somehow the phone was preventing fatresize to work). Thanks ;) – pfoof May 16 '16 at 16:10