[TAG] Virtual Hard Disks

René Pfeiffer lynx at luchs.at
Thu Jan 15 03:18:57 MSK 2009


On Jan 14, 2009 at 1941 +0000, Thomas Adam appeared and said:
> 2009/1/14 Michael SanAngelo <msanangelo at gmail.com>:
> > Hi, I was wondering what are the possibilities of creating and using virtual
> > disks for. I understand I can use dd to create it then mkfs.ext3 or
> > something like it to format the disk. What purpose could they be used for
> > besides serving as a foundation for creating a live cd?
> >
> > I want to do this from the cli so no gui.
> 
> The term "virtual disk" is misleading here -- what you're referring to
> are essentially loopback files, a la:
> 
> ```
> dd if=/dev/zero of=/somefile bs24 count00000
> '''
> 
> That will create a 30GiB zero-filled file called "somefile".

This command will really write 30 GiB to disk. If you just want to
create a file that can store up to 30 GiB "on demand", you can use this:

dd if=/dev/zero of=disk.img bs=1 count=0 seek0GB

disk.img will show have a size of 30 GB, but it will only use the blocks
that are actually used (when using it as a disk image for example). The
file produced is called a sparse file.

http://en.wikipedia.org/wiki/Sparse_file

Sparse files are quite handy when you store the disks of virtual
machines.

Best,
Ren?.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.linuxgazette.net/mailman/private/tag/attachments/20090115/c6c88130/attachment.pgp 



More information about the TAG mailing list