[TAG] Virtual Hard Disks

Lew Pitcher lew.pitcher at digitalfreehold.ca
Wed Jan 14 22:19:36 MSK 2009


On January 14, 2009 14:05:20 Michael SanAngelo wrote:
> 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've used this "virtual hard disk" on occasion, for spot fixes to problems. I 
can't think of a "permenant" use for it, though, although others might be 
able to.

The biggest use I have is for "virtual cdroms". I take a dd image of a cdrom 
or data dvd, and save it on a hard disk. This gives me a library of images 
that I can pick and choose from; I can install Windows XP into a virtual 
machine without having to find the original CDROM, I can mount my Slackware 
install DVD and install new software (or upgrade old software), etc.

The second use I have for "virtual hard disks" is to place a Unixish file 
system (any one of the Linux fs that support unix file attribute bits, 
uid/gid, and mtime/ctime/utime) onto a USB thumb drive. Rather than reformat 
the drive (and thus make it unavailable to Windows machines), I create a VFAT 
file on the drive, and populate it with a Linux fs. On Linux, I can mount 
this file as a fs and have all the features you expect in a linux file 
system, and on MSWindows, I can run Linux in a VM, and give it access to the 
file through Windows. 

> I want to do this from the cli so no gui.

dd if=/dev/zero of=/path/to/vfs/file bs24 count=<number of Kbytes in fs>
mkfs -t <filesystemtype> /path/to/vfs/file
mount -t <filesystemtype> -o loop /mount/point /path/to/vfs/file
... do your work...
umount /mount/point

-- 
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/   | GPG public key available by request
----------      Slackware - Because I know what I'm doing.          ------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 218 bytes
Desc: This is a digitally signed message part.
Url : http://lists.linuxgazette.net/mailman/private/tag/attachments/20090114/6cc5badc/attachment.pgp 



More information about the TAG mailing list