You can create an image with ext3 filesystem, and use it like you do an iso-image, with the exception that you can both read and write to it. It's fairly simple. First create a file with the size you want. Let's create a 10MB file, file.img, filled with zeroes.
Code:
$ dd if=/dev/zero of=file.img bs=10000000 count=1
1+0 records in
1+0 records out
10000000 bytes (10 MB) copied, 0,104802 s, 95,4 MB/s
The dd-command above reads 1 block (count=1) of size 10MB (bs=10000000) from the special device /dev/zero which will always return zeros when you read from it, and write it to the file file.img.
Next, make a filesystem (ext3 in this case) on it:
Code:
$ mkfs.ext3 file.img
mke2fs 1.40.8 (13-Mar-2008)
file.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
[...many lines...]
And lastly, mount it
Code:
sudo mount -o loop file.img /mnt
To allow regular users to mount it, you need an entry in fstab for it. Say you save it as /usr/local/share/file.img, and want to mount it at /mnt, then the fstab entry should look something like
Code:
/usr/local/share/file.img /mnt ext3 loop,user,noauto 0 0
Now any user should be able to mount it with the command
Code:
mount /mnt
# or
mount /usr/local/share/file.img
Bookmarks