Created
March 4, 2015 14:10
-
-
Save vpack/b78f7237872fdc4fbe70 to your computer and use it in GitHub Desktop.
Mounting a file as a filesystem
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
# Create a new file | |
dd if=/dev/zero of=my_fs bs=1M count=1024 | |
Or | |
truncate -s 30M my_fs | |
# Check if the device is not already in use before using it | |
sudo losetup /dev/loop0 | |
sudo losetup /dev/loop0 my_fs | |
# Make a file system and mount it | |
sudo mkfs -t ext3 -m 1 -v /dev/loop0 | |
sudo mount -t ext3 /dev/loop0 /mnt/new | |
# Done. Now let tear it down !! | |
sudo unmount /mnt/new | |
sudo losetup -d /dev/loop0 | |
# Gone !! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment