-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit db8e6c8
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
|
||
Copyright (C) 2004 Sam Hocevar <[email protected]> | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# cursedfs | ||
|
||
Make a disk image formatted with both ext2 and FAT, at once. | ||
|
||
```bash | ||
~/cursedfs% wget 'https://github.com/NieDzejkob/cursedfs/releases/download/v1.0/cursed.img' | ||
~/cursedfs% sudo mount -o loop -t ext2 cursed.img mountpoint/ | ||
~/cursedfs% ls mountpoint/ | ||
mkfs.cursed | ||
~/cursedfs% sudo umount mountpoint/ | ||
~/cursedfs% sudo mount -o loop -t msdos cursed.img mountpoint/ | ||
~/cursedfs% ls mountpoint/ | ||
gudnuse.ogg | ||
``` | ||
|
||
# Why? | ||
|
||
[I got nerd-sniped](https://twitter.com/Foone/status/1217162186130198529?s=20) | ||
|
||
# How? | ||
|
||
It turns out this is surprisingly simple to do: just create a FAT volume with a | ||
lot of reserved sectors and put the ext2 into the reserved sectors. This works | ||
because the filesystems choose different places to put their superblock: FAT | ||
uses the very first sector, while ext2 leaves the first kilobyte unused. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
|
||
SIZE_EXT2=128 # sectors, max is 65535 | ||
|
||
set -euxo pipefail | ||
EXT2_TMP="$(mktemp)" | ||
trap "rm $EXT2_TMP" EXIT | ||
|
||
truncate -s 4M cursed.img | ||
truncate -s "$((512*$SIZE_EXT2))" $EXT2_TMP | ||
mkfs.ext2 $EXT2_TMP | ||
mkfs.fat -R $SIZE_EXT2 cursed.img | ||
dd if=$EXT2_TMP of=cursed.img bs=512 skip=1 seek=1 conv=notrunc |