代码改变世界

recover grub2

2013-01-28 14:06  robturtle  阅读(274)  评论(0编辑  收藏  举报

1. mount file system

$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0xdd5add5a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848    61442047    30617600    7  HPFS/NTFS/exFAT
/dev/sda3        61442048   864131071   401344512    7  HPFS/NTFS/exFAT
/dev/sda4       864133118   976771071    56318977    5  Extended
/dev/sda5       864133120   883662847     9764864   83  Linux
/dev/sda6       883664896   942256127    29295616   83  Linux
/dev/sda7       942258176   959514623     8628224   83  Linux
/dev/sda8       959516672   976771071     8627200   83  Linux

$ sudo blkid
/dev/sda1: LABEL="M-gM-3M-;M-gM-;M-^_M-dM-?M-^]M-gM-^UM-^Y" UUID="BC9298AC92986CA0" TYPE="ntfs" 
/dev/sda2: UUID="4600BD5500BD4D25" TYPE="ntfs" 
/dev/sda3: UUID="D60A75A80A758671" TYPE="ntfs" 
/dev/sda5: LABEL="ubuntu-jeremy" UUID="2b55694f-69f5-4ea9-8226-c9f9056b4007" TYPE="ext4" 
/dev/sda6: LABEL="jeremy-home" UUID="7f0209d5-c8f2-4801-bed7-025d8115fcf8" TYPE="ext4" 
/dev/sda7: LABEL="ubuntu-usr" UUID="6c95fda4-5b78-4b70-8b37-a49febe4478f" TYPE="ext4" 
/dev/sda8: LABEL="ubuntu-var" UUID="fb1e290f-f0ca-48de-9ef7-3a2fa412b18c" TYPE="ext4"

$ sudo mount /dev/sda5 /mnt && sudo mount /dev/sda6 /mnt/home && \
sudo mount /dev/sda7 /mnt/usr && sudo mount /dev/sda8 /mnt/var
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc

2. install grub

$ sudo chroot /mnt
# grub-install /dev/sda
# update-grub

NOTE: check /etc/fstab before reboot.