WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to start/make a virtual disk?  (Read 2869 times)

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
How to start/make a virtual disk?
« on: August 24, 2010, 06:26:40 PM »
Is there a way to start, ie make or whatever the correct term is, a virtual disk for use with the tcvd boot option? It would be very convenient if this is possible, the alternative being to install windows and virtualbox and make an image that way, very cumbersome.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: How to start/make a virtual disk?
« Reply #1 on: August 25, 2010, 03:24:29 AM »
Hmm, I have yet to have a "play" with tcvd so I don't know for sure what is required, but I seriously doubt that VBox (which I use a lot for my testing) is of any use WRT image creation (since IIRC it defaults to create disk images in the VDI format).

A better tool would be qemu-img which should be part of any qemu extension, but even that is not required since I believe that only the "raw" disk format is supported for tcvd (and none of the vmdk, vdi, vhd, qcow, etc. "flavours").

Such an image file can be created simply with
    dd if=/dev/zero count=1 bs=50M of=disk.img

(choose your block size value and disk image file name accordingly). This is now your virtual hard disk, un-partitioned and without any file system.

I somehow believe to have read that tcvd operates on un-partitioned image files (but again due to not having tried it myself that might not be true). On that assumption you should be able to create a file system (e.g. EXT2) with something along the lines of:
    losetup /dev/loop99 disk.img
    mkfs.ext2 /dev/loop99
    losetup -d /dev/loop99

(choose a free loop device accordingly). It might even work with just mkfs.ext2 disk.img, but a minor variation of the former method has worked for me for partitioned virtual disk images in the past.

I trust you will keep us updated with your findings.

Edit: I changed the file system type in the sample commands from EXT3 to EXT2 since I have the impression that this is the (hard-coded) option that is currently supported.
« Last Edit: August 25, 2010, 11:46:08 PM by maro »

Offline Pats

  • Sr. Member
  • ****
  • Posts: 322
Re: How to start/make a virtual disk?
« Reply #2 on: August 25, 2010, 05:32:59 AM »
I have never used any virtual disks / qemu software, I also do not know the exact benefits and drawbacks of virtual disks, but I enjoy reading maro`s postings, which are to-the-point and very much informative ( and off-cource from good practical knowledge -like that of curaga).