goldorak
15-07-2010, 11:13
Vorrei un piccolissimo chiarimento su come va installato il grub/grub2 usato da Debian ad esempio su un disco GPT.
Tutte le prove le ho fatte su una VirtualBox, ma mi rimane ancora un dubbio perche' le opzione che mi da l'installer di Debian, e cio' che invece e' scritto nella documentazione di SysRescueCD mi paiono contradditori.
Dunque SysRescueCD dice che quando si usa un disco GPT su un sistema pc con bios normale (non EFI) per sicurezza e' necessario creare una piccola partizione di 10-20 MB con conterra' una parte del codice di grub/grub 2. Questa partizione deve avere il flag impostato come bios_grub.
Poi quando si installa Debian, o un altra distro linux il boot manager va installato in questa partizione.
Ora il problema e' questo, quando l'installer di Debian arriva alla voce "dove installare grub/grub2" mi da solo due scelte, o sul MBR del disco (che ovviamente non coincide con la partizione bios_grub) oppure mi dice di installarlo nella settore di boot della partizione di Debian.
E se voglio installarlo nella partizione bios_grub come faccio ? :fagiano:
O forse non ho capito niente, e quando scelgo di installare grub sul MBR in AUTOMATICO una parte del codice viene messe nella partizione bios_grub ?
Chi mi puo' chiarire questo dubbio ? :stordita:
Questo e' quello che dice la documentazione di SysRescueCD
BIOS Boot Partition
A boot loader such as Grub is required to boot Linux. This program is particular because it runs before your operating system and then it's a quite critical program. The code of the boot loader is often installed between the MBR and the first partition of the disk. This is not a very good solution since there is not any protection and this code may be overwritten by a system utility which is not aware of that.
For this reason a special partition can be used with GPT disks: it's the BIOS Boot Partition. When you have such a partition on your disk, this space is reserved. This is where the boot managers can install their boot code (Grub stage2), and this way you can make modifications to the other partitions of your disk with no risk of damaging Grub. This special partition does not have to be very big. You can just allocate few megabytes on the disk for such a partition. It will just use a very small portion of your disk, and one entry in your partition table, but this is not a problem with GPT since you can have more than four primary partitions.
If you are about to create a GPT layout on your disk, it's recommended to create a BIOS Boot Partition even if you don't plan to use it immediately. It will just prevent many problems you could have with the boot loaders. To create such a partition you can use Parted or GDisk which are both on recent SystemRescueCd versions. Here is how to do that using the Parted command line interface. You have to be careful when you manipulate your partitions, so be sure you know what you are doing first. You have to create a normal partition first, using mkpart and then use the parted command called set to set the bios_grub flag on the partition you have just created.
Here is how to create a new GPT layout on a disk (we use /dev/sda for the example) with that partition (all the pre-exising data of that disk will be lost). It may look strange to use ext2 for that partition. Parted wants a type for that partition so we have to give it something, and ext2 is fine.
root@sysresccd /root % parted /dev/sda
GNU Parted 1.9.0
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/sda: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary ext2 0 10M
(parted) mkpart primary ext4 10M 100%
(parted) set 1 bios_grub on
(parted) p
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary bios_grub
2 10.0MB 1074MB 1064MB primary
(parted) quit
Information: You may need to update /etc/fstab.
Checking the current layout
You can use Parted from SystemRescueCd or any linux system to see which layout you are currently using. Just use the print command in parted. It's safe and it won't make any modification. Here is an example of two disk (/dev/sda and /dev/sdb). The first one is using an MSDOS layout, and the second one is based on GPT.
root@debian /root % parted /dev/sda print
Model: ATA ST31000340AS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 1024MB 1024MB primary ext3
2 1024MB 18.2GB 17.2GB primary reiserfs
3 18.2GB 35.4GB 17.2GB primary ntfs boot
4 35.4GB 1000GB 965GB primary
root@debian /root % parted /dev/sdb print
Model: ATA SAMSUNG HD103UJ (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary bios_grub
2 10.0MB 1024MB 1014MB ext3 boot
3 1024MB 18.2GB 17.2GB reiserfs gentoo
4 35.4GB 52.6GB 17.2GB reiserfs debian
5 52.6GB 69.7GB 17.2GB ext3 centos
6 69.7GB 1000GB 930GB lvm
Tutte le prove le ho fatte su una VirtualBox, ma mi rimane ancora un dubbio perche' le opzione che mi da l'installer di Debian, e cio' che invece e' scritto nella documentazione di SysRescueCD mi paiono contradditori.
Dunque SysRescueCD dice che quando si usa un disco GPT su un sistema pc con bios normale (non EFI) per sicurezza e' necessario creare una piccola partizione di 10-20 MB con conterra' una parte del codice di grub/grub 2. Questa partizione deve avere il flag impostato come bios_grub.
Poi quando si installa Debian, o un altra distro linux il boot manager va installato in questa partizione.
Ora il problema e' questo, quando l'installer di Debian arriva alla voce "dove installare grub/grub2" mi da solo due scelte, o sul MBR del disco (che ovviamente non coincide con la partizione bios_grub) oppure mi dice di installarlo nella settore di boot della partizione di Debian.
E se voglio installarlo nella partizione bios_grub come faccio ? :fagiano:
O forse non ho capito niente, e quando scelgo di installare grub sul MBR in AUTOMATICO una parte del codice viene messe nella partizione bios_grub ?
Chi mi puo' chiarire questo dubbio ? :stordita:
Questo e' quello che dice la documentazione di SysRescueCD
BIOS Boot Partition
A boot loader such as Grub is required to boot Linux. This program is particular because it runs before your operating system and then it's a quite critical program. The code of the boot loader is often installed between the MBR and the first partition of the disk. This is not a very good solution since there is not any protection and this code may be overwritten by a system utility which is not aware of that.
For this reason a special partition can be used with GPT disks: it's the BIOS Boot Partition. When you have such a partition on your disk, this space is reserved. This is where the boot managers can install their boot code (Grub stage2), and this way you can make modifications to the other partitions of your disk with no risk of damaging Grub. This special partition does not have to be very big. You can just allocate few megabytes on the disk for such a partition. It will just use a very small portion of your disk, and one entry in your partition table, but this is not a problem with GPT since you can have more than four primary partitions.
If you are about to create a GPT layout on your disk, it's recommended to create a BIOS Boot Partition even if you don't plan to use it immediately. It will just prevent many problems you could have with the boot loaders. To create such a partition you can use Parted or GDisk which are both on recent SystemRescueCd versions. Here is how to do that using the Parted command line interface. You have to be careful when you manipulate your partitions, so be sure you know what you are doing first. You have to create a normal partition first, using mkpart and then use the parted command called set to set the bios_grub flag on the partition you have just created.
Here is how to create a new GPT layout on a disk (we use /dev/sda for the example) with that partition (all the pre-exising data of that disk will be lost). It may look strange to use ext2 for that partition. Parted wants a type for that partition so we have to give it something, and ext2 is fine.
root@sysresccd /root % parted /dev/sda
GNU Parted 1.9.0
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/sda: unrecognised disk label
(parted) mklabel gpt
(parted) mkpart primary ext2 0 10M
(parted) mkpart primary ext4 10M 100%
(parted) set 1 bios_grub on
(parted) p
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary bios_grub
2 10.0MB 1074MB 1064MB primary
(parted) quit
Information: You may need to update /etc/fstab.
Checking the current layout
You can use Parted from SystemRescueCd or any linux system to see which layout you are currently using. Just use the print command in parted. It's safe and it won't make any modification. Here is an example of two disk (/dev/sda and /dev/sdb). The first one is using an MSDOS layout, and the second one is based on GPT.
root@debian /root % parted /dev/sda print
Model: ATA ST31000340AS (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 1024MB 1024MB primary ext3
2 1024MB 18.2GB 17.2GB primary reiserfs
3 18.2GB 35.4GB 17.2GB primary ntfs boot
4 35.4GB 1000GB 965GB primary
root@debian /root % parted /dev/sdb print
Model: ATA SAMSUNG HD103UJ (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 10.0MB 9983kB primary bios_grub
2 10.0MB 1024MB 1014MB ext3 boot
3 1024MB 18.2GB 17.2GB reiserfs gentoo
4 35.4GB 52.6GB 17.2GB reiserfs debian
5 52.6GB 69.7GB 17.2GB ext3 centos
6 69.7GB 1000GB 930GB lvm