UMdev
From VirtualSquare
Umdev creates virtual devices.
$ um_add_service umdev
[edit] Virtually partitioning a Disk Image
First of all an ampty file can be created with this command:
$ dd of=/tmp/diskimage bs=1024 count=0 seek=1024000
This file appears as a 1G sequence of null Bytes (in the reality it uses very few data blocks, it is a sparse file).
It is possible to see the file as a disk using the umdevmbr module.
$ mount -t umdevmbr /tmp/diskimage /dev/hda
The virtual disk /dev/hda can be partitioned in the usual way:
$ /sbin/fdisk /dev/hda Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-127, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-127, default 127): 100 Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 2 First cylinder (101-127, default 101): Using default value 101 Last cylinder or +size or +sizeM or +sizeK (101-127, default 127): Using default value 127 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. $ /sbin/fdisk /dev/hda Command (m for help): p Disk /dev/hda: 1048 MB, 1048576000 bytes 255 heads, 63 sectors/track, 127 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 100 803218+ 83 Linux /dev/hda2 101 127 216877+ 5 Extended Command (m for help): q $
Now /dev/hda1 and /dev/hda2 are correctly defined as it were a real disk. For example it is possible to create an ext2 file system on one of the partitions:
$ /sbin/mkfs.ext2 /dev/hda1
mke2fs 1.40-WIP (07-Apr-2007)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
96384 inodes, 192612 blocks
9630 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=201326592
6 block groups
32768 blocks per group, 32768 fragments per group
16064 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
$
Umview modules support virtualization nesting: virtual entities provided by a module can be used to provide further virtual service. For example the virtual partition created by umbinfmt can now be mounted using umfuse.
$ um_add_service umfuse $ mount -t umfuseext2 -o rw+ /dev/hda1 /mnt $ ls /mnt lost+found $
It is possible to use further levels of nesting: if the virtual file system contains a disk image it can be mounted by umdevmbr and then one or more aprtition mounted by umfuse.

