Question: How does one define the size of a FAT16 / FAT 32 file system with mkdosfs
in Linux
I want to create a, say 2 GB FAT16|32 filesystem on a partition in the size of 8 GB or more?
This is how far I got:
- created a partition with
fdisk
mkdosfs -F 16 /dev/sdb1
creates a FAT16 file system over the WHOLE partition – as long as this isn't larger tha 4 GB, I knowmkdosfs -F 32 /dev/sdb1
creates a FAT32 filesystem over the WHOLE partition. I know that this is the default and that I wouldn't neet to specify-F 32
but for the sake of completeness and style…- according to
man mkdosfs
the size of the file system is to be defined as the last argument - HOW?! So far all of my attempts to define the size returned error messages. All of them.
Guessing that I just ran into a massice misunderstanding and being frustrated about not being able to solve such a simple question all by myself I really wonder where the heck did I miss something in defining the size?!
Best Answer
This worked for me:
An alternative approach, in case the
mkfs
does not have an option to limit the size, is to create a loop device with limit:Of course, if it's a partition, you could also shrink the partition, then enlarge it again.