selfjungle Just another WordPress weblog

15Feb/150

block device from file

Mounting a loopback device.
In the kernel config, CONFIG_BLK_DEV_LOOP needs to be set.

# Check the used devices:
losetup -a
# Create the file
dd if=/dev/zero of=FILENAME  bs=1024k count=MEGABYTES
# Attach loopback device to file
losetup /dev/loopN FILENAME
# Creating filesystem on device
mkfs.ext3 /dev/loopN
# Mounting dev
mount /dev/loopN MOUNTPOINT

# umount
umount MOUNTPOINT
# detach
losetup -d /dev/loopN
Tagged as: Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

 

No trackbacks yet.