Skip to content

Small script to create sparse vfat drive images from a directory without being root.

License

Notifications You must be signed in to change notification settings

nexus511/make_vfat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

make_vfat.py

This is a simple script that packs a set of files into a drive image containing a vfat formated partition by creating a sparse file to comsume as small disk space as possible.

Requirements

The script requires a few packages being installed:

  • mtools
  • util-linux
  • dosfstools
  • python3

To make sure those tools are installed, you can use the following command on ubuntu/debian:

sudo apt install util-linux mtools dosfstools python3

Usage

Let's say you created a directory called files containing the files you want to see on the disk image, you can use the following command to create the image file:

python3 make_vfat.py files output.img

This will create a 32GB image named output.img. You can modify the size for the image using the --size parameter. The size can be provided in MB only. You can also set a label for the vfat partition, using the --label parameter.

The script will check, if the output file already exists. Using --force will delete the output file, before starting to write.

This command will create a 8192MB sized image containing a partition with the filesystem label TRANSFER holding all the files from the usb directory:

python3 usb/scripts/make_vfat.py --size=8192 --label=TRANSFER --force usb output.img

About

Small script to create sparse vfat drive images from a directory without being root.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages