Jump to content











Photo
- - - - -

Firadisk and .VHD /.IMG images


  • Please log in to reply
18 replies to this topic

#1 Marietto

Marietto

    Frequent Member

  • Advanced user
  • 267 posts
  • Location:Italy
  • Interests:Computers,movies,read/write,talking about philosophy and religion.
  •  
    Italy

Posted 06 November 2009 - 08:15 AM

I'm running Windows 7 from RAM for all my days activites. No problems at all. I have two disks on my computer. On the first one I installed Windows Vista and on the second Windows XP. When my computer starts,I choose to boot from disk n.2. These are the boot configuration files located on disk 2 :

boot.ini

[boot loader]

timeout=30

default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

[operating systems]

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows FLP" /noexecute=optin /fastdetect

c:\grldr="Grub4Dos"

menu.lst

title Boot 7 from RAMDisk

find --set-root /7-ram.img

map --mem /7-ram.img (hd0)

map --hook 

root (hd0,0)

chainloader /bootmgr

7-ram.img is saved on \disk 2. To make Windows 7 bootable from the RAM Disk,I used the Karyonix commands :

bcdedit /store "virtual ram drive:"\boot\bcd /set {bootmgr} device boot

bcdedit /store "virtual ram drive:"\boot\bcd /set {default} device boot

bcdedit /store "virtual ram drive:"\boot\bcd /set {default} osdevice boot


#2 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 451 posts
  •  
    Thailand

Posted 06 November 2009 - 11:03 AM

@Marietto2009
I think you can convert 7-ram.img to fixed size VHD image for easier maintenance.
If your small Windows 7 is ultimate edition, you can use its VHD native boot feature to boot direct from VHD and make changes.
When you want to run in RAM, use GRUB4DOS to load disk image from inside the fixed size VHD.

#3 Marietto

Marietto

    Frequent Member

  • Advanced user
  • 267 posts
  • Location:Italy
  • Interests:Computers,movies,read/write,talking about philosophy and religion.
  •  
    Italy

Posted 06 November 2009 - 04:58 PM

@karyonix : which kind of tool can I use to convert from img to vhd ?

#4 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 06 November 2009 - 05:38 PM

@karyonix : which kind of tool can I use to convert from img to vhd ?


You can try:
qemu-img (part of Qemu):
http://www.winimage.....php?f=7&t=3268

and Clonedisk:
http://www.boot-land...?showtopic=8480

jaclaz

#5 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 451 posts
  •  
    Thailand

Posted 06 November 2009 - 05:57 PM

@karyonix : which kind of tool can I use to convert from img to vhd ?

Create a new VHD in Disk Management or diskpart of Windows 7.
Initialize disk, create partition, format, mark partition as active.
Mount raw image with Imdisk.
Clone Windows 7 to VHD drive as described in http://www.boot-land...?showtopic=9196
- Copy files from raw image drive to VHD drive
- Adjust \DosDevices\C: in system hiv in VHD drive.
- Create BCD store in host drive. Set its {bootmgr} device to "boot". Set its {default} device and osdevice to VHD drive.
- Leave BCD store in VHD drive as is. Its {bootmgr} device and {default} device and osdevice is already "boot".

or
Create VHD footer manually and append it to raw disk image then rename it to VHD.
Use information from Virtual Hard Disk Image Format Specification http://technet.micro...r/bb676673.aspx
or
Tell me your RAW image size (in bytes or secters) and geometry (CHS). And I will try to construct VHD footer for you.

#6 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 451 posts
  •  
    Thailand

Posted 07 November 2009 - 12:41 AM

@corsair
No speed improvement in last 2 months.
I am rewriting firadisk to use a separate thread for virtual drive but not completed yet.

@Marietto2009
RAW2VHD is now completed.
Attached File  raw2vhd.7z   6.5KB   262 downloads (It requires Visual C++ runtime libraries to work.)
All it does is append 512-byte VHD footer to raw disk image file.
The disk image file will become VHD and can be attach in Disk Management of Windows 7.
You may have to rename file extension to .vhd yourself.
It does not check for existing VHD footer, so don't run it twice for the same disk image file.
You can revert the change made by RAW2VHD by deleting last 512 byte of disk image file (that begin with "conectix").
example:
C:\data>raw2vhd

Convert raw disk image file to fixed size VHD file



RAW2VHD  imgfilename





C:\data>raw2vhd image2.img

detected geometry  C=331 H=255 S=63	totalsize=2726297600 bytes

complete



C:\data>ren image2.img image2.vhd



C:\data>


#7 Marietto

Marietto

    Frequent Member

  • Advanced user
  • 267 posts
  • Location:Italy
  • Interests:Computers,movies,read/write,talking about philosophy and religion.
  •  
    Italy

Posted 09 November 2009 - 12:45 PM

@karyonix :

I've converted my virtual ram disk from img to vhd format using your tool. This is the error encoutered :

Total sectors calculated from partition table (5349645) is greater than the number of sectors in the whole disk image (5333581). The int13 header will disable any read / write operation across the image boundary. That means you will not be able to read / write sectors (in absolute address,IE lba) 5333581 - 5349644 ,tought they are logically inside your emulated virtual disk (according to the partition table) :

Probed C/H/S = 333/255/63
Probed total sectors : 5349645

#8 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 09 November 2009 - 01:41 PM

Total sectors calculated from partition table (5349645) is greater than the number of sectors in the whole disk image (5333581). The int13 header will disable any read / write operation across the image boundary. That means you will not be able to read / write sectors (in absolute address,IE lba) 5333581 - 5349644 ,tought they are logically inside your emulated virtual disk (according to the partition table) :

Probed C/H/S = 333/255/63
Probed total sectors : 5349645

The above comes from grub4dos, right? :dubbio:

How was the "source". img created?
Which settings does it have in the MBR?
How big it is in bytes?

Another idea, would Disk2vhd work?
Disk2vhd
http://technet.micro...s/ee656415.aspx

jaclaz

#9 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 451 posts
  •  
    Thailand

Posted 09 November 2009 - 02:29 PM

It is warning message, not error message.

Originally you have 332*255*63*512 = 2730792960 bytes long raw disk image.
When GRUB4DOS reads this image, it known this file is 2730792960/512 = 5333580 sectors long.
It detects disk geometry H=255 S=63. Then it calculates number of cylinders from 5333580 / (255*63) = 332.
332*255*63 = 5333580. There is no problem.

When you add VHD footer. The file is 512 bytes longer. Its size is now 2730792960 + 512 = 2730793472 bytes.
If you mount this VHD image in Windows 7, its capacity is 2730792960 bytes.
When GRUB4DOS reads this image, it calculate number of sectors from file size (including the VHD footer) 2730793472/512 = 5333581.
It detects disk geometry H=255 S=63. Then it calculates number of cylinders from 5333581 / (255*63) = 332 and 1 remainder. It rounds up the number to 333.
It then thinks the geometry size is 333*255*63 = 5349645 which is longer that the actual size 5333581.
So it warns that sectors between 5333581-5349645 is not accessible.

Sectors between 5333581-5349645 is beyond the end of original image. We don't use them.

The sector 5333580 is VHD footer. It is mapped into GRUB4DOS's virtual disk. If you modify this sectors in image file, VHD footer will become invalid. But it is unlikely that it will be modified since it is outside of all partitions. And even if it is modified in RAM drive, image file will remain unchanged.


Another idea, would Disk2vhd work?
Disk2vhd
http://technet.micro...s/ee656415.aspx

It seems to be able to take snapshot of the disk you are running Windows from.
Its output seems to be dynamic size VHD. You just have to convert it to fixed size VHD (how?) before loading it with GRUB4DOS.
However, the size of virtual disk will be as large as the source disk. It is probably unsuitable for RAM booting.

#10 ireneuszp

ireneuszp

    Frequent Member

  • Advanced user
  • 191 posts
  •  
    Poland

Posted 09 November 2009 - 07:24 PM

You just have to convert it to fixed size VHD (how?)


maybe this will be helpfull
VHD Resizer
http://vmtoolkit.com...rs/entry87.aspx

http://vmtoolkit.com...es/default.aspx

#11 Marietto

Marietto

    Frequent Member

  • Advanced user
  • 267 posts
  • Location:Italy
  • Interests:Computers,movies,read/write,talking about philosophy and religion.
  •  
    Italy

Posted 09 November 2009 - 08:54 PM

@wimb,I can't do it,because I've installed Windows XP on the root of the USB disk. Windows 7 is loaded into RAM using boot.ini and menu.lst.

#12 wimb

wimb

    Gold Member

  • Developer
  • 2281 posts
  •  
    Netherlands

Posted 09 November 2009 - 08:58 PM

Well you can try to copy the VHD-file to boot partition with Windows 7 and make there a boot entry in BCD using bcdedit.exe

Then you can boot with the VHD file located on HDD and you do not boot from RAMDISK.

#13 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 451 posts
  •  
    Thailand

Posted 09 November 2009 - 10:19 PM

You need bootmgr file, Boot directory and BCD store in your active partition.
If VHD is in USB, you also need USB drivers Start=0 in SYSTEM hive in image.
Here is an example of how to create BCD store.
- Boot into Windows 7 in RAM. Run cmd as administrator.
xcopy C:\bootmgr U:\bootmgr /c /h /k /x /y

xcopy C:\Boot\ U:\Boot\ /e /c /i /h /k /x /y /b

bcdedit /export U:\Boot\BCD

bcdedit /store U:\Boot\BCD /set {default} device vhd=[U:]\7-ram_2_6G.vhd

bcdedit /store U:\Boot\BCD /set {default} osdevice vhd=[U:]\7-ram_2_6G.vhd

bcdedit /store U:\Boot\BCD /set {default} detecthal on

bcdedit /store U:\Boot\BCD /set {default} description "VHD Boot"
(adapted from http://www.boot-land...?showtopic=9193 )
or
- Boot from Windows 7 Setup DVD. Press Shift+F10.
And follow steps 2-3 in "To update a BIOS-based computer to include a Windows 7 boot menu" section of http://technet.micro.....28WS.10).aspx
In step 2, replace c:\windows7.vhd with your VHD path.
In step 3, if your USB system partition is not C: you should add parameter /s
bcdboot v:\windows /s <your USB drive letter>:

No GRUB4DOS map when you boot direct from VHD. Just chainloader /bootmgr

#14 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 14 November 2009 - 08:48 AM

SERVICE POST:
the above were splitted from the "main" Firadisk topic:
http://www.boot-land...?showtopic=8804

and the story goes on here:
http://www.boot-land...?showtopic=9712

jaclaz

#15 i

i

    Silver Member

  • Advanced user
  • 523 posts
  •  
    United Nations

Posted 07 February 2010 - 03:15 PM

Great ;) and I thought my XP + VHD + FiraDisk + Grub4Dos work with this thread's title. hmmm, It seems like There is no step by step guide to make this work ;) mostly everything complicated.... :lol: Guess I'll have to request SuperVolume guys to make use of the PAE Ram...


EDIT: I'm so tired of clicking back button and "add Reply" damn this login of death! :cheers: Don't give me that "enable cookie" or "change browser" any of YOU!

#16 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13480 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 07 February 2010 - 03:39 PM

EDIT: I'm so tired of clicking back button and "add Reply" damn this login of death! ;) Don't give me that "enable cookie" or "change browser" any of YOU!


Would you take a "If you have problems start a new thread with the appropriate details instead of whining"? :lol:

:cheers:

Wonko

#17 i

i

    Silver Member

  • Advanced user
  • 523 posts
  •  
    United Nations

Posted 07 February 2010 - 03:57 PM

Would you take a "If you have problems start a new thread with the appropriate details instead of whining"? :lol:

:cheers:

Wonko

;) Thinking of looping with "submit" button is slowing me down. I'm wondering is it only ME? everything is working fine with you? I just clicked on "use classic theme" assuming things will smooth this way.

#18 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 451 posts
  •  
    Thailand

Posted 07 February 2010 - 04:57 PM

This web site was slow or offline frequently in last month. In this month, it is good most of the time.
I use default non-classic theme with Firefox 3.6 on Windows 7 x64 at home. No problem posting.
Except when I log in with another computer at work place and come back home then I just have to log in again.

#19 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 09 November 2011 - 03:05 PM

Disk2VHD seems to be able to take snapshot of the disk you are running Windows from.
Its output seems to be dynamic size VHD. You just have to convert it to fixed size VHD (how?) before loading it with GRUB4DOS.
However, the size of virtual disk will be as large as the source disk. It is probably unsuitable for RAM booting.


Disk2VHD creates a VHD of size equal to source drive size and preserves its partition structure, even if you want to copy just one partition. Then such VHD is impossible to resize or convert with VHD Resizer - it can't read it. Someone on this forum may want to integrate this conversion code into Raw2VHD tool (with disk type verification added) or create a separate DynamicVHD2Fixed tool with it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users