Difference between revisions of "Grub"

From Briki
Jump to: navigation, search
(Created page with "== Moving boot record and /boot to a new disk == * Setup new disk with GPT partition table * For BIOS (not EFI) booting, create a ~1MB partition at the start of the disk, with...")
 
(Moving boot record and /boot to a new disk)
Line 36: Line 36:
 
update-grub
 
update-grub
 
</pre>
 
</pre>
 +
* Restart (or halt and disconnect old drive), and cross your fingers!

Revision as of 18:49, 24 April 2016

Moving boot record and /boot to a new disk

  • Setup new disk with GPT partition table
  • For BIOS (not EFI) booting, create a ~1MB partition at the start of the disk, with the bios_grub flag
  • Create a boot partition (but don't set the boot flag)
  • Use the remainder of the space as desired
  • Example "parted /dev/sdX -- print free" for a bootable drive:
Model: ATA ST3320620A (scsi)
Disk /dev/sde: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  1049kB  1031kB               bios  bios_grub
 2      1049kB  2000MB  1999MB  ext4         boot
 3      2000MB  320GB   318GB   ext4         tmp
        320GB   320GB   335kB   Free Space
  • Mount new boot partition at /mnt, and copy boot partition onto it:
mount /dev/sdXY /mnt
cp -a /boot/* /mnt
  • Edit /etc/fstab and change /boot partition mount to UUID for new partition (use /dev/disk/by-uuid to determine partition uuid)
  • Unmount existing /boot, and mount new /boot
umount /boot
mount /boot
  • Install grub boot loader into the bios partition, using the /boot partition for OS loading. Note that the disk is specified, rather than a partition:
grub-install /dev/sdX
  • Update grub to match the new partition layout:
update-grub
  • Restart (or halt and disconnect old drive), and cross your fingers!