thibaut noah wrote:

Why would i do that? grub needs to have /boot in first position on the
disk?

That is not correct. The grub.cfg file specifies the /boot directory. For example 'set root (hd1,3)' would set the /boot directory as sdb3 assuming that /boot is a stand-alone partition.


Not at all, i don't have ANY Physical disk, i have two virtual disks (said
it earlier) and what i do is creating another virtual machine with just the
virtual drive of lfs
and i want to boot like this.

How is your second drive, sdb, partitioned? Does it use a GPT or MSDOS partition table. If GPT, it needs a separate bios_grub partition that is not formatted at all. Grub uses that as a raw partition when grub_install runs. /boot is separate. For an MSDOS partition table, the first partition should start at a 1MB boundary (not sector 63). Grub then installs its needed data in the unformatted region between the first sector and the first partition.

* said grub will need to know what are the _real_ partitions on sda that
   '/' and '/boot' are on.

Not really. The only thing grub needs to know is where to find the kernel. Since it does not know where to find fstab, it has to be told with the set root command or the location of the kerenl has to be specified explicitly like:

linux (hd1,3)/vmlinuz-version root=/dev/sda4

The root= on the command line is the *kernel's* view of the disk layout. Grub's view is often different.


Please note that my fstab and my grub file have been made with the
assumption that by having one disk only sdb would become sda on the new
virtual machine.

fstab :
    1. /dev/sda1     /            ext4   defaults            1     1
    2. /dev/sda2     swap         swap     pri=1               0     0
    3. /dev/sda3     /boot        ext2   defaults            1     1
    4. proc           /proc        proc     nosuid,noexec,nodev 0     0
    5. sysfs          /sys         sysfs    nosuid,noexec,nodev 0     0
    6. devpts         /dev/pts     devpts   gid=5,mode=620      0     0
    7. tmpfs          /run         tmpfs    defaults            0     0
    8. devtmpfs       /dev         devtmpfs mode=0755,nosuid    0     0

Fine for an MSDOS partition table.

grub.cfg :
    1. # Begin /boot/grub/grub.cfg
    2. set default=0
    3. set timeout=5
    4.
    5. insmod ext2
    6. set root=(hd0,3)
    7.
    8. menuentry "GNU/Linux, Linux 4.4.2-noah" {
    9.         linux   /vmlinuz-4.4.2-tnoah root=/dev/sda1 ro
    10. }

- Disk /dev/sdb: 15 GiB, 16106127360 bytes, 31457280 sectors
- Units: sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disklabel type: gpt
- Disk identifier: F700B567-368F-4096-BB5B-6B2A5C670F10
-
- Device        Start      End  Sectors  Size Type
- /dev/sdb1      2048 20973567 20971520   10G Linux filesystem
- /dev/sdb2  20973568 29362175  8388608    4G Linux filesystem
- /dev/sdb3  29362176 31457246  2095071 1023M BIOS boot

This is your problem. It is inconsistent with the above. First, sdb3 is way bigger than it needs to be. 1M is recommended, not 1023. If you formatted it as ext2 then that is wrong. What I suggest is deleting /dev/sdb3 and creating a new 1M /dev/sdb3 and a new 100M /dev/sdb4 to be mounted as /boot. sdb3 needs to be of type BIOS Boot and sdb4 should be Linux filesystem. This is what I have:

Device         Start       End   Sectors  Size Type
/dev/sda1       2048      4095      2048    1M BIOS boot
/dev/sda2       4096    395263    391168  191M Linux filesystem
/dev/sda3     395264  39456767  39061504 18.6G Linux filesystem

Where sda2 is /boot and sda3 is /

If you make the changes to your system that I suggest, then grub.cfg needs to be changed to set root=(hd0,4) and change fstab device for /boot to sda4. Of course you will need to repopulate /boot with the kernel and rerun grub-install.

  -- Bruce

--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to