Jump to content











Photo
- - - - -

Linux from VHD How To?

linux windows boot vhd image-file howto

  • Please log in to reply
86 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
  • 13745 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



#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
  • 80 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
  • 13745 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



#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
  • 13745 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
  • 13745 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.


#87 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13745 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







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

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users