Created
February 14, 2023 10:04
-
-
Save gabonator/ae078b636b6990e1126330b689a0f77d to your computer and use it in GitHub Desktop.
make fat12/fat16/fat32 fs image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
set -x | |
# FAT12 - min 64KB: | |
# dd if=/dev/zero of=test.img count=64 bs=1K | |
# mkfs.vfat -v -F 12 -S 512 -s 4 test.img | |
# FAT16 - min 9MB: | |
# dd if=/dev/zero of=test.img count=9 bs=1M | |
# mkfs.vfat -v -F 16 -S 512 -s 4 test.img | |
# FAT32 - min 256MB (cannot allocate): | |
# dd if=/dev/zero of=test.img count=256 bs=1M | |
# mkfs.vfat -v -F 32 -S 512 -s 4 test.img | |
rm -rf temp | |
rm -f test.img | |
dd if=/dev/zero of=test.img count=64 bs=1K | |
fdisk test.img <<- EOM | |
o | |
n | |
p | |
1 | |
t | |
c | |
w | |
EOM | |
mkfs.vfat -v -F 12 -S 512 -s 4 test.img | |
mkdir temp | |
guestmount -a test.img -m /dev/sda temp | |
echo ahoj, toto je pokus > temp/ahoj.txt | |
echo cau, toto je druhy pokus > temp/cau.txt | |
echo `date` > temp/date.txt | |
cat > temp/lorem.txt <<- EOM | |
Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod? | |
Tempor incididunt ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud. | |
Exercitation ullamco laboris nisi ut aliquip. | |
Ex ea commodo consequat duis aute irure dolor in reprehenderit in voluptate velit esse cillum. | |
Dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat non. | |
Proident sunt in culpa qui officia deserunt mollit anim. | |
Id est laborum sed ut perspiciatis unde omnis iste natus error sit. | |
Voluptatem accusantium doloremque laudantium totam rem aperiam eaque ipsa quae ab. | |
Illo inventore veritatis et quasi architecto beatae? | |
Vitae dicta sunt explicabo. | |
EOM | |
umount temp | |
# give some time to sync | |
sleep 2 | |
rm -rf temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment