Jump to content

- - - - -

Windows 7 RC x86 in 4.75 GB RAM disk

  • Please log in to reply
3 replies to this topic

#1 karyonix


    Frequent Member

  • Advanced user
  • 451 posts

Posted 23 January 2010 - 04:36 PM

I installed 8GB RAM in my computer and used GRUB4DOS to check size of RAM regions.
grub> displaymem


Usable RAM: Base: 0x100000000, Length: 0x130000000
The length of Usable RAM range at address 4G is 0x130000000 = 5100273664 or 4864M (or 4096M+768M).
I want to create RAM drive that ALMOST FILL UP this range.

The current GRUB4DOS map --mem will allocate RAM with 4KB granularity.
The maximum size that will not fill up the entire range is (4864M - 4K).

I will create image file in fixed size VHD format for ease of use.
Fixed size VHD have 512byte footer. The footer will be included in GRUB4DOS mapped drive.
Maximum size for disk area inside VHD is (4864M - 4K - 512).
If one partition is create at sector LBA 1, maximum partition size is (4864M - 5K).

I chose simple numbers that will be easy to remember/calculate for disk size and partition size.
Virtual disk size will be 4863M=9959424 sectors
with one active partition at offset 1M=2048 sectors and size 4862M=9957376 sectors.
Including footer, VHD file size will be (4863M+512).
When loaded by map --mem it will use (4863M+4K) bytes, leaving 1020K unused RAM above address 4G.

Windows 7 RC 32-bit Setup require 8???M free space in Windows partition, so I needed larger virtual disk.
I used diskpart in Windows 7 to create 9000MB fixed-size VHD and create active primary partition.

DISKPART> create vdisk file="c:\data\vw7.vhd" maximum=9000

DISKPART> attach vdisk

DISKPART> convert mbr

DISKPART> create partition primary

DISKPART> format fs=ntfs unit=4096 quick label="vw7"

DISKPART> active

DISKPART> detach vdisk
I examined its partition table. The partition size was 8998M.
I will have to shrink it 4136M after setup to get the desired size 4862M.

I added vw7.vhd to VirtualBox and attach it to a virtual machine.
DVD drive of virtual machine is set to Windows 7 RC 32-bit Setup ISO.
I chose Custom (advanced) installation type and select Disk 0 Partition 1: vw7.

After setup reboot, I made it boot from DVD again and pressed Shift+F10 to bring up cmd.exe.
dir c:\
It has 3986141184 bytes free.
The used space is approximately 5197M. I have to decrease the used space by approximately 350M to get below 4862M.
c:\windows\system32\compact.exe /?

c:\windows\system32\compact.exe /c /s:c:\windows\winsxs /a /i
4,139,460,144 total bytes of data are stored in 2,887,118,792 bytes.
dir c:\
5,174,657,024 bytes free
It looks good.

I rebooted virtual machine, booted from hard disk, continue setup.
After Windows desktop appeared, I checked c:\ and found large 1GB page file. It is too larged.
I openned Advanced system settings, decrease paging file size for C: to 200MB and restarted.
After restart I ran diskpart.
DISKPART> selct disk 0

DISKPART> select partition 1

DISKPART> shrink querymax

The maximum number of reclaimable bytes is: 3886 MB
Not good.
I changed paging file size to 20MB and tried again, reclaimable bytes was 3866 MB. Not good.

I restarted again and boot from Windows Setup DVD.
Pressed Shift+F10 to open cmd.exe.
dir /a c:\

del /a c:\pagefile.sys


DISKPART> select disk 0

DISKPART> select partition 1

DISKPART> detail partition

DISKPART> shrink querymax

The maximum number of reclaimable bytes is: 5017 MB
Good, it is possible to shrink 4136 MB.
DISKPART> shrink desired=4136

DISKPART> detail partition
The size is 4862 MB as expected.

I restarted virtual machine, boot from hard disk. Windows seemed to work normally. No problem found.

I shutdown virtual machine, opened vw7.vhd in hex editor, verified that partition 1 is at LBA 0x00000800 (1MB) Length 0x0079F000 sectors (4862MB).
Partition 1 end position is at 7993344 sectors = 4863MB = 5099225088 bytes.
I copied 4863MB to a new file vw7s.vhd by using dd for Windows.
And used raw2vhd to append VHD footer to it.
C:\data>c:\util\dd bs=1M count=4863 if=vw7.vhd of=vw7s.vhd

C:\data>c:\util\raw2vhd vw7s.vhd

I detached vw7.vhd from virtual machine and attached vw7s.vhd.
I started VM. Windows seems to be OK.
I created another VHD mini1.vhd 128MB. I copied grldr, grldr.mbr into it, installed GRUB4DOS MBR, and copied firadisk + my test-signing certificate in a folder.
I created another VHD mini2.vhd 16MB, created partition, and copied it inside mini1.vhd.
I attached mini1.vhd to VM. (primary master=vw7s.vhd, primary slave=mini1.vhd)
I booted into Windows, install my test-siging certificate, install firadisk and shutdown.
This is x86 version, so I don't have to enable Test Mode.
I changed order of virtual disk. (primary master=mini1.vhd, primary slave=vw7s.vhd)
I started VM. At GRUB4DOS commandline I created a small RAM drive and booted Windows.
map (hd1) (hd0)

map (hd0) (hd1)

map --mem /mini2.vhd (hd2)

map --hook

chainloader /bootmgr

Windows installed drivers for new hardware: FiraDisk and RAM disk.
It seemed to be ready. I shutdown VM.

I installed GRUB4DOS 0.4.5a 2010-01-23 to external hard disk.
I started real machine (with 8GB RAM), told BIOS to boot from external hard disk.
In GRUB4DOS, I loaded vw7s.vhd and booted into Windows.
map --mem (hd1,0)/data/vw7s.vhd (hd0)

map --hook

chainloader /bootmgr


It can boot to desktop on my PC.
Mouse stopped working temporarily a few times while Windows were installing drivers for new hardware.
  • graz likes this

#2 rebit



  • Members
  • 63 posts
  • Interests:Boot PXE , Grub4dos, Windows 7 entire in RAMDISK

Posted 10 June 2012 - 04:33 PM

Very cool 'How To', but you can make a new on more detail and easy ?

I Think we can have a next generation VDI system if Windows 7 into RAM can boot by PXE with grub4dos...

Can you describe this procedure, creating .vhd´s file with VirtualBox...


Thank you

#3 sixcentgeorge


    Frequent Member

  • Advanced user
  • 190 posts

Posted 29 December 2013 - 02:53 PM

the way you did is cool and good for learning about vhd and diskpart ;"]

it is better for gaining space to use a lited win7 , for x64 it is an obligation .


i found one torrent of w7 x64 these days and after install of all drivers [ but not catalyst center and conversions ] it is at 6Go .

i mounted the vhd using M$ disk manager 

and shrinked [a copy] from 32 to 6.5 Go 6656 Mo the partition [but not the vhd...]


then using  M$ disk manager i created a  6656 Mo vhd and mounted it .


with the help of a partition tool like MiniTool Partition Wizard Home Edition  :



and made a partion copy from the 32 Go/6.5 Go to the 6.5/6656Mo


it is perfect for a file serveur

#4 sixcentgeorge


    Frequent Member

  • Advanced user
  • 190 posts

Posted 01 January 2014 - 08:56 AM

i found something very strange ....

my "windows ultimate x64 in ram" is used to forget that it is a genuine and registered copy .


i launch it and of course let the display turn off , when i restart it , the mark in the lower right shows no-genuine





if i open computer properties , then the message vanishes .







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users