* [Qemu-devel] qemu dd sizes
@ 2004-09-25 2:15 jmf
2004-09-25 4:21 ` Kyle Hayes
2004-09-25 15:17 ` Mark A. Williamson
0 siblings, 2 replies; 7+ messages in thread
From: jmf @ 2004-09-25 2:15 UTC (permalink / raw)
To: qemu-devel
When using dd to create a disk image to boot through qemu, does the block size really matter, or can I omit that parameter? If the size of the original disk is 20 gb but there is only 2 gb of data on the disk, how can I make the image size smaller?
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] qemu dd sizes
2004-09-25 2:15 jmf
@ 2004-09-25 4:21 ` Kyle Hayes
2004-09-25 15:17 ` Mark A. Williamson
1 sibling, 0 replies; 7+ messages in thread
From: Kyle Hayes @ 2004-09-25 4:21 UTC (permalink / raw)
To: qemu-devel
On Friday 24 September 2004 19:15, jmf wrote:
> When using dd to create a disk image to boot through qemu, does the
> block size really matter, or can I omit that parameter? If the size of
> the original disk is 20 gb but there is only 2 gb of data on the disk,
> how can I make the image size smaller?
It is a little unclear what you are asking here. dd uses the block size
and a count in order to determine how much to copy. If you are making a
file with holes in it, you can use a block size, offset and then set
count=0. If you omit the count and block size, it will use the default
block size (512 bytes I think) and will simply copy until either the
source runs out of data or the destination runs out of space.
If there is 2GB, it depends what the original filesystem was. Ext2/3
(under Linux) puts data all over the disk in a sparse manner. So, just
copying the first 2GB would not get all the data. If it is a Windows
partition and you are using VFAT, then running the defragmenter program
will push all the data to one end of the disk (beginning?). With NTFS,
I'm not sure what happens.
You could try to resize the 20GB partition down to 2.5GB and then copy that
with dd. What kind of filesystem is it?
Best,
Kyle
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] qemu dd sizes
@ 2004-09-25 13:08 jmf
2004-09-25 13:28 ` Paul Brook
0 siblings, 1 reply; 7+ messages in thread
From: jmf @ 2004-09-25 13:08 UTC (permalink / raw)
To: kyle, qemu-devel
It's UFS, FreeBSD. I think UFS does a good job keeping all the data in a non-sparse manner.
I could resize the UFS partition down to a smaller size and then use dd, however, I want a faster operation that will not alter my original installation. I was hoping there is a way to manipulate the images that dd produces, for more convenient use with qemu.
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] qemu dd sizes
2004-09-25 13:08 jmf
@ 2004-09-25 13:28 ` Paul Brook
2004-09-25 13:46 ` Bartosz Fabianowski
0 siblings, 1 reply; 7+ messages in thread
From: Paul Brook @ 2004-09-25 13:28 UTC (permalink / raw)
To: qemu-devel
On Saturday 25 September 2004 14:08, jmf wrote:
> It's UFS, FreeBSD. I think UFS does a good job keeping all the data in a
> non-sparse manner.
>
>
>
> I could resize the UFS partition down to a smaller size and then use dd,
> however, I want a faster operation that will not alter my original
> installation. I was hoping there is a way to manipulate the images that dd
> produces, for more convenient use with qemu.
On linux you can mount images using the loopback device. You may need to tell
it to skip the partition table (the first track, usually 32256 bytes).
I usually find it easier and more reliable to format/partition the image
inside the guest, then mount it via loopback device on the host and use
normal tools (cp, tar, etc) to copy the files across.
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] qemu dd sizes
2004-09-25 13:28 ` Paul Brook
@ 2004-09-25 13:46 ` Bartosz Fabianowski
0 siblings, 0 replies; 7+ messages in thread
From: Bartosz Fabianowski @ 2004-09-25 13:46 UTC (permalink / raw)
To: qemu-devel
> On linux you can mount images using the loopback device.
You can do the same on FreeBSD, although you use a different command.
So one way to go about this would be as follows. Boot up the native
FreeBSD. Create an empty image file of appropriate size - say 4GB. Mount
this image and copy the installed FreeBSD to the image. While doing this
using native tools, remember to skip copying the image file onto itself,
as that would result in a recursion you don't want. Finally, move the
image you just created to your host system. This might not be the
quickest way of doing it, but it seems simple enough.
- Bartosz
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] qemu dd sizes
2004-09-25 2:15 jmf
2004-09-25 4:21 ` Kyle Hayes
@ 2004-09-25 15:17 ` Mark A. Williamson
1 sibling, 0 replies; 7+ messages in thread
From: Mark A. Williamson @ 2004-09-25 15:17 UTC (permalink / raw)
To: qemu-devel, jmfguy
> If the size of the
> original disk is 20 gb but there is only 2 gb of data on the disk, how can
> I make the image size smaller?
If you're trying to save space, I'd advise you to check the output of ls -ls.
The -s flag also prints out the actual space taken on disk, as well as the
nominal length of the file usually output by -l.
Most filesystems will represent zero-filled areas of a file with a small
constant amount of on-disk space. If you're only using 2GB then the actual
on disk size might only be just over 2GB. As you add more data, the on disk
size will grow to fit.
It's worth checking this before you bother resizing!
Cheers,
Mark
>
>
>
>
>
> _______________________________________________
> Join Excite! - http://www.excite.com
> The most personalized portal on the Web!
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] qemu dd sizes
[not found] <20040925171359.1D864299D9@xprdmailfe21.nwk.excite.com>
@ 2004-09-25 22:27 ` Bartosz Fabianowski
0 siblings, 0 replies; 7+ messages in thread
From: Bartosz Fabianowski @ 2004-09-25 22:27 UTC (permalink / raw)
To: jmfguy, qemu-devel
[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
md0
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-09-25 22:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20040925171359.1D864299D9@xprdmailfe21.nwk.excite.com>
2004-09-25 22:27 ` [Qemu-devel] qemu dd sizes Bartosz Fabianowski
2004-09-25 13:08 jmf
2004-09-25 13:28 ` Paul Brook
2004-09-25 13:46 ` Bartosz Fabianowski
-- strict thread matches above, loose matches on Subject: below --
2004-09-25 2:15 jmf
2004-09-25 4:21 ` Kyle Hayes
2004-09-25 15:17 ` Mark A. Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).