Есть ли Linux-эквивалент для VHD, с которого он может загружаться?

2087
M.U

Я искал это довольно много, но все, что я мог найти, это VLite . Кстати, я говорю об эквивалентной для Windows загрузке VHD, а не виртуализации.

1

1 ответ на вопрос

2
phuclv

Grub can map pretty much any disk image files and boot from that

  • grub4dos and grub1 support the map command for booting from read-only images. I'm not sure about their capabilities to boot read-write images. There are 2 types of mapping

    • Memory map: The image is loaded onto memory before mapping as disk, usually used with floppy disk images. When memory mapping is used the disk image file can be non-contiguous. For example:

      map (hd0,0)/win98.ima (fd0) 
    • Direct map: map the file using int13, requires the file to be contiguous

      map (device)/path/file.iso (hd32) 

      After all mappings were done you'll need to commit them with map --hook

      These types of mapping allow you to easily boot any live Linux distros. If necessary you can use a casper rw persistent disk image for non-volatile data. For more information read LiveCD/Persistence

  • In grub2 you'll have to use the loopback command which can be used to boot both read-only and read-write images

    5.2 Loopback booting

    GRUB is able to read from an image (be it one of CD or HDD) stored on any of its accessible storages (refer to see loopback command). However the OS itself should be able to find its root.

    This usually involves running a userspace program running before the real root is discovered. This is achieved by GRUB loading a specially made small image and passing it as ramdisk to the kernel. This is achieved by commands kfreebsd_module, knetbsd_module_elf, kopenbsd_ramdisk, initrd (see initrd), initrd16 (see initrd), multiboot_module, multiboot2_module or xnu_ramdisk depending on the loader.

In the past wubi used the same technique to boot Ubuntu from an image without an ext4 root partition


If you're using syslinux then there's an equivalent feature called MEMDISK

MEMDISK is meant to allow booting legacy operating systems. MEMDISK can boot floppy images, hard disk images and some ISO images.

MEMDISK simulates a disk by claiming a chunk of high memory for the disk and a (very small - typically, 2K) chunk of low (DOS) memory for the driver itself, then hooking the INT 13h (disk driver) and INT 15h (memory query) BIOS interrupts.

See

Я так и думал - может помочь добавить некоторую информацию об особенностях того, как это сделать - ради потомков. Journeyman Geek 10 лет назад 0