Jump to content











Photo
- - - - -

Grub4dos mapped disk (vhd) isn't detected by Debian based distro (antiX 15)


  • Please log in to reply
2 replies to this topic

#1 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 16 posts
  •  
    Vietnam

Posted 25 July 2016 - 02:48 AM

Suppose there are two hard drives

/dev/sda (hd0)
/dev/sdb (hd1)

(hd0) is where my vhd resides (hd0,0)/ada.vhd

 

(hd1) is where the linux iso resides (hd1,0)/linux.iso

 

Here is the grub4dos script:

#### Map the vhd as the first harddrive
find --set-root /linux.iso
map --heads=0 --sectors-per-track=0 /linux.iso (0xFF)
map --hook
root (0xFF)
kernel /antiX/vmlinuz vga=791 from=hd,usb,cd fromiso=/linux.iso en xres=800x600
initrd /antiX/initrd.gz
map (hd0,0)/ada.vhd (hd0)
map --rehook
boot

#### Map the vhd as the last harddrive
find --set-root /linux.iso
map --heads=0 --sectors-per-track=0 /linux.iso (0xFF)
map --hook
root (0xFF)
kernel /antiX/vmlinuz vga=791 from=hd,usb,cd fromiso=/linux.iso en xres=800x600
initrd /antiX/initrd.gz
map (hd0,0)/ada.vhd (hd-1)
map --rehook
boot



I have successfully boot to the linux iso, but the vhd is remain undetected.

 

Does anyone know the solution?

 

 

homepage: http://antix.mepis.org/



#2 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 16 posts
  •  
    Vietnam

Posted 25 July 2016 - 03:53 AM

I don't know why I can't edit the post, so I post here

 

antiX 15 is based from Debian Jessie (stable)



#3 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 July 2016 - 08:02 AM

Well, it's normal.

 

The grub4dos mapping lasts until the "real mode" (or BIOS if you prefer) pases control to "protected mode" (or to the OS if you prefer).

When you map the .iso you are passing to the Linux kernel a number of parameters, among which :
fromiso=/linux.iso

which is telling it to mount the .iso calle linux.iso in root.

 

Nothing is passed to the Linux about the ada.vhd.

 

Start again from here:
http://reboot.pro/to...rom-vhd-how-to/

you need to modify the Linux initrd adding commands to mount the image automatically or mount it manually once the Linux has booted.

 

Each distro may have (or may not have) some different method/tool suitable, like kpartx, losetup or mdadm, essentially you want to have at boot time a loopback device mapping the image (actually the partition(s) inside it) to a /dev/mapper/loopx device, a couple of examples (Debian based distro):
http://www.opopop.ne...op_file_system/

https://felixc.at/ArchLinux-loopback

BUT each distro and even each version of a same distro may have different ways/tools to (hopefully) achive that.

 

Remember that the .vhd must be of the "fixed" type (which is nothing but a RAW image with a single sector appended to it) unless you use some particular tool to interpret it, which could be libvhdio, or virtualbox-fuse, etc.

 

Grub4dos ONLY supports "fixed" type .vhd's though recent version allow "dynamic" ones BUT ONLY if --mem mapped (loaded in RAM), in your case - however - you are booting from the .iso so you don't need any mapping in grub4dos.

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users