# dd if=/dev/zero of=/local/disk/vda bs=1 count=0 seek=1073741824
0+0 records in
0+0 records out
0 bytes (0 B) copied, 1.3252e-05 s, 0.0 kB/s
0+0 records out
0 bytes (0 B) copied, 1.3252e-05 s, 0.0 kB/s
Set up the file as a loop device:
# losetup /dev/loop0 /local/disk/vda
Check that the loop device is available:
# losetup -a
/dev/loop0: [0803]:7605015 (/local/disk/vda)
/dev/loop0: [0803]:7605015 (/local/disk/vda)
Create a filesystem on the loop device:
# mkfs /dev/loop0
...
...
And mount it:
# df -h /mnt/hd
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 1008M 1.3M 956M 1% /mnt/hd
To detach the loop device unmount the filesystem first:
# umount /mnt/hd
Then detach the loop0 device with losetup:
# losetup -d /dev/loop0
It is not possible to create one or more partition on a loop device this way!
No comments:
Post a Comment