[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] qemu dd sizes

From: Bartosz Fabianowski
Subject: Re: [Qemu-devel] qemu dd sizes
Date: Sun, 26 Sep 2004 00:27:57 +0200
User-agent: Mozilla Thunderbird 0.7.3 (X11/20040807)

[This was sent to me off-list]

This was what I was looking for, however, I'm a little confused about
how to mount the file through the loopback device. Mount normally
requires a filesystem type as a parameter but if I create the "empy
image" with dd if=/dev/zero, there is no filesystem in the image. I
can't use newfs on the file until I mount it with the loopback
device..... How do I make the first mount ?

Quite simple really. First, create an empty disk image:

# dd bs=1 seek=4194303 count=1 if=/dev/zero of=image
1+0 records in
1+0 records out
1 bytes transferred in 0.000104 secs (9620 bytes/sec)

Then, create a loopback device:

# mdconfig -a -t vnode -f image

Note the previous command told you what device name it created. Now, run makefs on that device:

# newfs /dev/md0
/dev/md0: 4.0MB (8192 sectors) block size 16384, fragment size 2048
        using 4 cylinder groups of 1.02MB, 65 blks, 192 inodes.
super-block backups (for fsck -b #) at:
 160, 2240, 4320, 6400

Finally, you can mount the disk:

# mount /dev/md0 /mnt

As you can see, the file system is there, fully functional:

# df -H /mnt
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/md0      3.8M    4.1k    3.5M     0%    /mnt

To clean up things, you'd first unmount the disk:

# umount /mnt

Then, you'd free the loopback device:

# mdconfig -d -u md0

That's all you need to do. Note however, that mdconfig is a FreeBSD 5.x / 6.x tool. If you're still on 4.x, you will need to use vnconfig instead (it's not as intuitive, but quite easy to use).

- Bartosz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]