Jump to content











Photo
- - - - -

Linux from VHD How To?

linux windows boot vhd image-file howto

  • Please log in to reply
90 replies to this topic

#76 robbyrobby

robbyrobby
  • Members
  • 6 posts
  •  
    Austria

Posted 28 June 2017 - 06:10 PM

for all who wana use dynamic vhd:

1. How to modify linux kernel for mounting a vhd file at boot time and load the system from it?

- there is needed use module for grub2 from vmlite (vboot.mod)

- isnt properly finished on end is needed mount loop partition like

mount -o loop =/dev/vhdhost/Partition1 ${rootmnt}

 

and then dont know which commands where in config are required for properly shutdown for dismount looped images

 

2. grabing all needed files from working dynamic vhd (vloopsetup, vloop.ko, and part from scripts/local) they are reside in initrd.img-xxxx, so far i know in grabbed vloopsetup isnt a timebomb (ubuntu-1104.7z inside vhd file, free reg. is needed for download from www.vmlite.com)


Edited by robbyrobby, 28 June 2017 - 06:14 PM.


#77 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 28 June 2017 - 06:23 PM

for all who wana use dynamic vhd:

1. How to modify linux kernel for mounting a vhd file at boot time and load the system from it?

- there is needed use module for grub2 from vmlite (vboot.mod)

- isnt properly finished on end is needed mount loop partition like

mount -o loop =/dev/vhdhost/Partition1 ${rootmnt}

 

2. grabing all needed files from working dynamic vhd (vloopsetup, vloop.ko, and part from scripts/local) they are reside in initrd.img-xxxx, so far i know in grabbed vloopsetup isnt a timebomb (ubuntu-1104.7z inside vhd file, free reg. is needed for download from www.vmlite.com)

Well, I thought that one of the points of this thread is (or maybe was) to NOT use the "proprietary" (or however not freely available) vmlite.com files.  :dubbio:

 

Recent version of grub4dos seemingly support Dynamic VHD's so if the Linux files also do there is not any need of any such vboot.mod nor for any other file (unless of course one *needs* to use GRUB2) or only the files inside ubuntu-1104.7z from vlite.com support dynamic vhd's? :unsure:

 

 

:duff:

Wonko


  • ZEE likes this

#78 robbyrobby

robbyrobby
  • Members
  • 6 posts
  •  
    Austria

Posted 28 June 2017 - 08:15 PM

aaa wonko, allways  active ;-))  ... ty for your quick reply

 

for normal bfu as me, is easy to take a binary vboot.mod, but some linux gurus can dowload sources for grub2 (and for new version of grub2 use just that part of it where is vboot.mod defined)... of course they are really free on vmlite site grub-1.97~beta4-and-grubinst-open-source.zip

 

so if u use this little bit changed/repaired  How to modify linux kernel for mounting a vhd file at boot time and load the system from it?

and this one grub-1.97~beta4-and-grubinst-open-source.zip to make own compiled vboot.mod,

then u are from eyes of the LAW 100% clean

 

in that time where i tried vbox fuse drivers method i wasnt succesfull, then i used grabbed vlosetup and vloop.ko from a vhd file, later in ubuntu i tried mount virtual images thru vboxfuse whith succes even dynamic vhd to, now i know that after loop mouting vhd file whith vboxfuse i get just new devices like /dev/vhdhost/Partition1, =/dev/vhdhost/Partition2, ... and they are needed mounted to

 

 

Recent version of grub4dos seemingly support Dynamic VHD's

 

i have understand that is just for loading into ram supported, or i miss some new info ?

 

so or so, i wonder why isnt allready for years widely used booting method whith legal vboxfuse and legal vboot module, but after some longer years now someone try now make own drivers for booting dynamic vhd's, trust me that booting from dynamic vhd images was on my whislist more than 6 years, just before vboot exists (if i right remeber grub4dos was the 1th that got posibbilty boot iso's just before grub2 )

 

anyway if is here on forum some linux guru whith litle bit time can here post needed changes to that topic How to modify linux kernel for mounting a vhd file at boot time and load the system from it?

or make own proposal for making run dynamic vhd's on ubuntu or (other linux)

 

sorry i cannot becose im just bfu, n00b or advanced user, i dont have knowledge about making initramfs config, dont know what is needed to properly unmout looped images for normal shutdow procedure ... etc.


Edited by robbyrobby, 28 June 2017 - 08:18 PM.


#79 ZEE

ZEE

    Member

  • Members
  • 83 posts
  •  
    Portugal

Posted 29 June 2017 - 08:12 PM

This would be a good thing... 

 

I've been looking for booting Linux from a VHD/Baremetal for a while...

and all solutions I found have flaws or just dont work...

 

If there is somebody that succeed with this I am very interested...

and I think there will be lots of interest in the solution...

 

:ph34r:



#80 robbyrobby

robbyrobby
  • Members
  • 6 posts
  •  
    Austria

Posted 29 June 2017 - 10:10 PM

but needed som linux guru that can make it easy to use and working, in meantime i found this one http://vdfuse.sourceforge.net/ , but i was running succesfully dynamic vhd on ubuntu so i never tryed this, but there is something false declared i wonder if this work (probably just false names)

linux (vhd0,1)/vmlinuz-3.5.0-46-generic host=/dev/sda1 vdisk=/ubuntu-14.04.vhd root=/dev/vdhost/Partition1 quiet

i think normaly must be something like this:
linux (vhd0,1)/vmlinuz-3.5.0-46-generic root=/dev/sda1 vdisk=/ubuntu-14.04.vhd part=/dev/vdhost/Partition1 quiet
root ... is diskpartition where should be accesible files on it
vdisk ... is here correctly a virtual disk on that patrition defines as root
part ... should be a DEVICE partition thas is im moment not accessible just initrams boot process make that part. accesible

in other proposal is ...: How to modify linux kernel for mounting a vhd file at boot time and load the system from it?

mkdir /vhdhost mount /dev/sda2 /vhdhost/ -t ntfs-3g mkdir /dev/vhdhost vdfuse -f /vhdhost/$vloop /dev/vhdhostexit 0
linux (vhd0,1)/boot/vmlinuz-3.5.0-23-generic root=/dev/vhdhost/Partition1 vloop=/vhd/Ubuntu.vhd quiet splash

there should be somnething like this ...
mkdir /vhdhost
mount ${rootmnt} /vhdhost/ -t ntfs-3g
mkdir /dev/vhdhost
vdfuse -f /vhdhost/$vloop /dev/vhdhost

#dunno if this is corectly to take root or something more is needed
mount -o loop =/dev/vhdhost/$vpart ${rootmnt}
exit 0

grub.cfg ... root can be declared normally as root=/dev/sda1 ... etc.
linux (vhd0,1)/boot/vmlinuz-3.5.0-23-generic root=UUID=2a1b6fd7-4e7d-49c1-8811-6d8538217933 vloop=/vhd/Ubuntu.vhd vpart=Partition1 quiet splash
________________________________________________________

first of all to get something working on your ubuntu try

  • Install Ubuntu with Virtualbox, choose vhd type of disk
  • Install virtualbox-fuse in Ubuntu
  • mount something per hand
  • ...

or make vhd mount batch like this: vmount.sh

#!/bin/bash

# vmount.sh - mount vhd, vdi, ... thru vboxfuse
#just use filename w/h extension
sudo mkdir /dev/vhd_$1
sudo mkdir /media/vhd_$1
sudo vdfuse -f ./$1.vhd /dev/vhd_$1
sudo mount /dev/vhd_$1/Partition1 /media/vhd_$1

then go in directory where are yours vhd's, like
cd /my_vhd
vmount.sh my_dynamic_vhd_test_file
...
just try if u can mount self an vhd file


Edited by robbyrobby, 29 June 2017 - 10:17 PM.


#81 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 30 June 2017 - 08:14 AM

@robbyrobby

Check this:

(last post before your intiial one)

http://reboot.pro/to...ow-to/?p=201793

vdfuse isn't really "news":

 

http://reboot.pro/to...e-vhd/?p=201687

 

@Zee

There are several reports of success using the methods detailed in THIS PRESENT thread (and NOT anywhere else), so there must be something that you are doing differently (or using a different distro, etc.).

Have you tried replicating EXACTLY the (two if I recall correctly) slightly different methods that have been reported as working just fine? :dubbio:

 

:duff:

Wonko


  • ZEE likes this

#82 robbyrobby

robbyrobby
  • Members
  • 6 posts
  •  
    Austria

Posted 30 June 2017 - 07:33 PM

@vonko, ty for help, i know vdfuse isnt new, i got mydynamic vhd  1th time working in oher ways, just later after them i have used it its works to

 

i still WONDER why someone (author) of this package UBT-small.zip https://mega.nz/#F!2...iWYAK4XzC5lGvwA , make his "OWN" boot procedure to run last ubuntu from NON dynamic vhd's

he used nearly same little bit changed code from vmlite to make this possible located in file initrd.img-4.4.0-47-generic/scripts/local,

but he not using original vmlite binary vlosetup and module vloop.ko, but other method whith kpartx

 

i can just say a MEN need TIME an KNOWLEDGE for making boot ubuntu posible from static vhd cost same time and knowledge using vdfuse instead of kpartx, i do not understand that WHY, but people are people

 

a JOKE? ... in that package UBT-small.zip from https://mega.nz/#F!2UllBYIC! insde in it is /UBT-small.vhd.7z/UBT-small.vhd ... UBT-small.vhd is static vhd 8 GB big whith 2 GB pagefile.sys resides in /tmp LOOOOL

 

6qjfia.png

 

 

good (old) news is, if someone dont like use chinese version of ubuntu - UBT-small.zip from https://mega.nz/#F!2UllBYIC!

for fast use can make or use own installed ubuntu 16 in virtual box on fixed static vhd by using both files vmlinuz-4.4.0-47-generic initrd.img-4.4.0-47-generic from that UBT-small.vhd (just use own clean static ubuntu16.vhd file whith all settings descibed to the UBT-small.vhd boot + initrd.img vmlinuz from it)

 

for my self i can say, i dont have time, lust and the major thing - RESOURCES to handle 8 GB static files whith 2 GB pagefile.sys in it, i use still an old ubuntu12 dynamic vhd

using static vhd whith kpartx is like same thing using WUBI boot, there are same (static) limitation, but wubi is easy to install w/h any knowledge of linux


Edited by robbyrobby, 30 June 2017 - 07:45 PM.


#83 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 01 July 2017 - 06:51 AM

@robbyrobby

Now (actually some time ago) I completely lost you. :w00t:

I cannot understand most of what you posted. :(

Not what your goal is, not if you were successful (and what you did in order to be so or how exactly you managed to be successful) not what are asking (if you are asking something).

 

I remain of the idea (generically) that a Dynamic vhd makes NO sense whatsoever if not is some very rare test only situations[1], so I don't really understand any *need* for using one, but if you are happy with one, good :).

 

Still maybe you want to take a deep breath and start again from the beginning describing what you are after and at what point of the process you believe you are and how you got there, as right now - believe me - you seemingly posted everything and the contrary of it.

 

:duff:

Wonko

 

[1] I will repeat how a "static" vhd is a raw image with a single sector appended, and it is of a fixed (known) size whilst a "dynamic" has a more complex format and more than that is of "unknown size", a "dynamic" vhd will ether "grow" to a full size (and then it will be exactly the same of a fixed vhd of the same size to all pratical effects) or will remain of a given minimal size, determined by its contents/use, and then it will be exactly the same as a smaller "fixed" vhd. 



#84 robbyrobby

robbyrobby
  • Members
  • 6 posts
  •  
    Austria

Posted 01 July 2017 - 12:53 PM

@ wonko

do u mean that using dynamic images (vhd, vdi, ...) on this forum arent welcome ?

 

or just personnaly u have enough resources to handle static images and then u dont wana lose time for apply dynamic images ?

 

btw: as i sad: i personally have not enough resources to use static images and for static image instaltion of ubuntu is beter (easyer) for BFU use WUBI, wubi give the same result as boot static image thru driver kpartx, whith same static image limitation

 

kpartx seems to be good alternative for static images and advanced linux users, before i used dynamic vhd in ubuntu, i used wubi, but after some time i need to learn how to make and mount a new bigger raw image and copy all stuff from (old) ubuntu image becose lack of space (and that isnt procedure for bfu), in many cases many people dont know how big should be chosen for (static)/ raw image install, but if u use dynamic vhd image u can make it smaller/bigger in just few clicks in par seconds and u dont need have a BIG knowledge of vhd images for that operation

 

long time ago i learned why is better, (safer, easyer, ... and and and) to use static partition image, but later i found out that isnt true anymore, if i use patritions contained in vhd images, i can mount them in win7 (and later) as bare metal and then i have many (really many many) choices whith handling (fake) real HDD, like ghost for backup, Paragon Virtualization Manager 2009, partiton magic for handling partitions (expand, shrink, move, copy), ... and so on

(sorry but for linux i dont know about many programms for partition handling)

 

at the end for clarify: for handling (use, copy, backup, ...) static images man need much more resources like better cpu, bigger HDD, faster HDD like raid, much much more time, ... but i do not have these resources


Edited by robbyrobby, 01 July 2017 - 01:18 PM.


#85 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 01 July 2017 - 02:09 PM

No, they are as welcome as anything else of course, I mean exactly what I wrote (nothing more, nothing less), the above were "fixed" and not "dynamic" statements ;), the issue is that I do not understand what you are saying.

 

You can use fixed size vhd's (please read as RAW) marked as sparse on the filesystem is size is an issue (cannot say if that works for linux/kpartx or whatever booting).

 

Still a dynamic vhd  (or a fixed one marked as sparse file ) can either be at the current level of expansion big enough for whatever its scope is or be too small for it.

If it is big enough you can replace it with a fixed size vhd (optionally anyway marked as sparse).

If it is too small, it will expand until it is of sufficient size (and at that point you can replace it with a fixed size one).

 

:duff:

Wonko



#86 robbyrobby

robbyrobby
  • Members
  • 6 posts
  •  
    Austria

Posted 01 July 2017 - 10:42 PM

succes !!!

... bootet on bare metal from dynamic vhd image

 

offcourse can be used for all images dynamic/static vhd, vdi, ...

 

so i have tried this one from http://vdfuse.sourceforge.net/ whith ububtu 16.04 clean install in vbox

findet out that not all works in original state vdfuseloop.zip

i made some changes  

 

in vdprepare.sh added

cp ./vdfuse-minimal/sbin/vdfuse /sbin

chmod 755 /sbin/vdfuse

 

in initramfs-tools/scripts/init-top/vdfuse added -w

vdfuse -w -f /vdhost$vdisk /dev/vdhost

 

this was not really helpfull becose i booted into RO mounted root, then i have added in grub.cfg just RW

linux (vhd0,1)/vmlinuz-3.5.0-46-generic host=/dev/sda1 vdisk=/ubuntu-14.04.vhd root=/dev/vdhost/Partition1 quiet rw

___________________________________________________________________________

 

that all isnt really clean work but i have no knowledge what i need to change in initramfs-tools directory to be mounted as rw

 

u can make self changes or download this ...

vdfuseloop_robby20170701.zip ...  (tick download slow button) stiahnut pomaly

 

this was my grub.cfg entry (hd0,7 and sda7 by me)

menuentry "Ubuntu 16 nove -Regular-Install - sda7 rw" {
	insmod vhd
	vhd vhd0 (hd0,7)/ubuntu.16-04.x64.20170701_16gb.vhd --partitions
	linux (vhd0,1)/vmlinuz host=/dev/sda7 vdisk=/ubuntu.16-04.x64.20170701_16gb.vhd root=/dev/vdhost/Partition1 quiet rw
	initrd (vhd0,1)/initrd.img 
}

summary:

  1. download vboot grub bootloader and extract it on some boot patrition or usb stick (can be fat32/ntfs formated)
  2. enter your ubuntu desktop in virtualbox, extract vdfuseloop_robby20170701.zip in /temp
  3. in terminal use command sudo chmod 755 /temp/vdfuseloop/vdprepare.sh
  4. in terminal use command cd /temp/vdfuseloop
  5. in terminal use command sudo ./vdprepare.sh
  6. if succes u can shutdown ubuntu
  7. on boot patrition (or usb stick) where u have vboot grub bootloader extracted u need add in grub.cfg something like examples from site http://vdfuse.sourceforge.net/ or like my example grub.cfg entry above
  8. if u typed correct parameters for partition where is your image file (was hd0,7 and sda7 by me), then u should have an succesfully boot (offcourse, dont forget type correct path and filename for your hd image)

Edited by robbyrobby, 01 July 2017 - 11:36 PM.

  • ZEE likes this

#87 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 02 July 2017 - 07:56 AM

 

succes !!!

... bootet on bare metal from dynamic vhd image

 

 

Very good. :)

 

:duff:

Wonko



#88 nino61

nino61
  • Members
  • 8 posts
  •  
    Italy

Posted 21 January 2018 - 01:15 AM

Hello, I would like to apologize in advance to each one of those I may upset for being new, not so competent, and consequently prone to irritate at the outset. However, I am an enthusiast of this site which I have eventually been able to sign up and have my say to anything that interests me the most. I am fond of ramloading. I have been so since I realized my comp used just 4% of my ram. I have 64gb of it and when I saw the little my system used I felt compelled to "get my money's worth". When I discovered this, I started hunting for those sites that offered help on how to preload windows and found out that this one was the best. I started to make bare metal vhds and realized that running the sistem like this was even faster than with conventional setup. With your contribution I was also able to preload it and boot it, with all the advantages that might ensue. A couple of days ago I ran into a site offering help on how to have linux run from windows, which has allowed me to get a grasp of linux without going to the trouble of squeezing my mass storage and make room for native linux repartitioning. By perusing several tutorials and taking cues from wonko's contributions, I managed to preload linux deepin into ram and boot it with only a few presses of the enter key (3, as far as I can remember). The menu.lst lines that I have used are the following:

 
title deepin
map --mem (hd0,0)/deepin.vhd (hd0)
map --hook 
find --set-root --ignore-floppies /wubildr.mbr
chainloader /wubildr.mbr
 
I would like to know what Wonko says to that. Any improvements or is that all that can be done? Linux runs much more snappily than with conventional bootup.
 
Nino

Edited by nino61, 21 January 2018 - 01:28 AM.


#89 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 21 January 2018 - 03:41 PM

Well, you have a LOT of RAM, possibly even too much for your own good ;).

 

You are now booting the whole VHD file loaded into memory.

 

This has some "features":

1) it takes some time (depending on the size of the VHD and the transfer speed of your disk or SSD) to initially load the OS

2) once loaded read/write access and operation in general will be very, very fast

3) the whole OS/install is "volatile", i.e. any changes you made in it are reset at next boot.

 

Till now this thread had a different aim/scope, that of booting a "container" (either a .vhd or a RAW image) as if it was a physical device.

That won't make the booted OS particularly faster than a "normal" boot, but it will offer a non-volatile system.

 

If you are looking for speed (and you are OK with the inherent volatility of a RAM mapped image) you are just fine :thumbsup: .

 

If you are looking for non-volatilty (and a faster booting, as there is not any initial transfer of the - possibly huge - image to RAM) you might want to experiment with the various techniques mentioned in the thread.

 

Decisions, always decisions .... 

 

:duff:

Wonko



#90 nino61

nino61
  • Members
  • 8 posts
  •  
    Italy

Posted 21 January 2018 - 10:34 PM

Hi Wonko, 

for a start, a big thankyou for your prompt reply and accurate info. Sorry for not providing all the details of my system. my vhd (which is anyway faster than an ordinary machine deployment scenario on conventional booting) is only 5gb big. how? program files, program files (x86), program data, users and most of windows (exept for those subdirs that the system requires on c:\ (the vhd) to arrive at the desktop interface) reside elsewhere, in d: (you will have twigged it is the physical 1st disk) and are junction-linked to c:\. so persistence is not an issue to me, unless I have to install new software, which I always do on a conventional system loading basis; nor is it preloading time an issue, as it preloads in about 6-7 secs. the only slight issue that I can have kept track of is that bootup process diagnostics shows that the system persists on looking for a couple of system files on c:\, without this being of practical hindrance to arriving at the windows interface. I probably perceive a less snappy initial bootup stage (the starred circle rotating underneath the logo at the beginning), probably due to the above glitch. is there anything I can do to improve? BTW, I also use 20gb of my ram for temp and swap (primoramdisk) and other 20 committed to read&write cache (primocache). 

I am looking forward to yuor learned suggestions.

Nino

 

ps.: at this point I do not really know where else to post this kind of questions, as they concern a system which is partly on vhd and partly elsewhere.


Edited by nino61, 21 January 2018 - 10:36 PM.


#91 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 22 January 2018 - 08:20 AM

Till now you were talking of a Linux VHD, now you are talking of a Windows one (that coul be anything from XP up to 10, BTW).

 

In any case both do not really belong to this thread (which again is about booting Linux from an image file, NOT ram loading it).

 

You may want to start a new thread about this.

 

Generally speaking what you now report is a "mixed mode" system where you have a "core" inside a .VHD loaded in RAM and the rest of the system "merged" into the RAM mounted image via mountpoints/softlinks.

 

It is impossible to say what/why you have a few files that insist of loading from the hard disk without the FULL details of your build, as said you may want to start a NEW thread, DESCRIBE EXACTLY what you have done and most probably someone will be able to provide some assistance to level out those glitches.

 

What makes NO SENSE whatsoever :w00t: :ph34r: is to have a swap file in RAM, no matter the amount of memory you have.

A very minimal swap file if you use any of those stupid programs that actually require one may make sense, but anything else does not.

 

As well there is no real sense to cache in RAM writes (mostly) to RAM, you are evidently on a 64 bit system, and the Windows built-in caching should take care of everything before the Primocache can do anything useful. :dubbio:, maybe in some very niche use of the system you might have a noticeable difference, but normally you won't.

 

Now be nice, start a new thread, provide details and we will see what we can come up with.

 

:duff:

Wonko


  • ZEE and nino61 like this





Also tagged with one or more of these keywords: linux, windows, boot, vhd, image-file, howto

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users