[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to boot a memory stick image of a hard drive?

From: Pascal Hambourg
Subject: Re: How to boot a memory stick image of a hard drive?
Date: Sun, 16 Jul 2017 00:38:28 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

[I am writing only about the current GRUB version aka GRUB 2, not GRUB legacy]

Le 15/07/2017 à 18:01, address@hidden a écrit :

I notice that when I partition using fdisk is usually leaves some blocks at the beginning. I guess this is for grub?

No, it is primarily for alignment with physical blocks.
But GRUB can use that space on MBR/DOS disks (not GPT).

In any case I 'should' be able to prepare the disk using fdisk and then load my /dev/sda2 image where is should be. Make the swap space and run grub-install.

I now have a running disk. So I will try moving the beginning of partition 1 and reformating it as swap and see if grub 2.02 will just work.

     Does grub document how much space it needs?

If it does, I am not aware of it. GRUB's core image was designed to fit in the 31 KiB space left by traditional CHS alignment. This space is generally enough when /boot/grub is in an ext filesystem on a regular partition. For example on my system the core image size is 25 KiB. But the core image can grow bigger if it needs to embed extra modules such as btrfs, LVM, RAID or crypto in order to read /boot/grub. But that is not a problem with modern 1 MiB alignment.

You can see the core image size with the size of the file /boot/grub/i386-pc/core.img.

I guess there really ought to be a special grub partition.

There is a special partition type "BIOS boot" in GPT that GRUB can use to store the core image, but not in MBR/DOS. Also recent GRUB versions can install the core image in a reserved area of a btrfs partition.

Otherwise, the core image can be written as a standard file (core.img) but it is only possible at certain conditions and is not considered as reliable.

I made two memory stick versions. One with just /dev/sda2 and one with the whole hard drive image. I think I can now get the /dev/sda2 image running and also update grub at the same time.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]