How to grow file system to fill EFI system partition [duplicate]

I am trying to resize a fat 32 partition in my linux machine. Following are the specs of the system.

  1. This is not a PC hence UI based tools are not applicable.
  2. This memory partition which I am trying to resize is already having data in the form of files. I can't lose them.
  3. I am trying to shrink the partition to used space alone and move the remaining space to another partition.
  4. Preferably without rebooting of system, unmounting of partition would be fine.

Edit: Backing up data from this partition is not what I am looking for. I am trying to see if there is a way that I can try without losing data. Its more like an analysis rather than task.

What I tried till now: Tried using parted tool as gparted needs an UI. Even though I am able to shrink this partition, it is leading to unnecessary problems due to file fragmentation. For example, after shrinking when I run file system check I am getting errors like chain not found for few files.

I cant use tools like resizee2fs as it supports only ext file systems (correct me if I am wrong here).

I tried using tool fatresize, even though I am able to successfully get it install it in my debian I am not able to get an installable for arm, whatever link I am getting is throwing an error on line 1 statement itself.

Can someone help me with any information they could?


Well, first if you "already having data in the form of files. I can't lose them" your very first step is to back them up before you do anything else.

Resizing and moving partitions does not often result in data loss, and if all else fails you can almost always revover files with photorec - http://www.cgsecurity.org/wiki/PhotoRec - it is a pain to do so.

Second you can not resize or move partitions that are in use. This is the main reason people advise you do these operations from a live usb.

So , no matter what, you can not move or resize your root partition without booting to a live USB (an exception would be adding to LVM).

So long as the partitions in question are not in use, ie unmounted, you can move and resize them :

See How do I resize partitions using command line without using a GUI on a server?

Otherwise your question is likely to be closed due to :

  1. You are running Debian

  2. Lack of information - You did not post your partitioning scheme, tell us what you want to move, what partitions are mounted, and what command and error message you are getting.


You had better copy the data in the form of files to a safe place (call it backup if you wish), but in this case also a temporary location, because I think you have to accept that you cannot shrink the FAT file system with linux tools. You might be able to do it with Windows tools (FAT32 is a Microsoft file system.)

So after you have copied the data in the form of files to a safe place, you can

  • boot from another drive and unmount all partitions in this drive, that you want to change

  • edit the partition (easiest to remove the FAT32 partition and create a new partition with the size you want.

  • create a FAT32 file system in the new partition

  • do the other modifications to the partition table ...

  • copy the files from the safe place to the new FAT32 partition.