chim bay

Monday, November 16, 2015

Làm sao cài đặt lại Grub khi bị mất trong quá trình cài lại Windowns ?


vào linux live bất kì

open terminal

########## Find the Linux partition with ##########

sudo fdisk -l   // xem tất cả các phân vùng đang có



Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x000cf1c8

   Device Boot         Start            End             Blocks        Id         System
/dev/sda1   *           2048         206847          102400         7       HPFS/NTFS/exFAT
/dev/sda2            206848        184322047     92057600     7       HPFS/NTFS/exFAT
/dev/sda3         184324094     391354367    103515137     5       Extended
/dev/sda4         391354368     625137663    116891648    7       HPFS/NTFS/exFAT
/dev/sda5         184324096     360103935    87889920      83      Linux   // phân vùng cần cài đặt grub
/dev/sda6          360105984    391354367    15624192      82      Linux swap / Solaris


########## mount the linux partition on /mnt ##########

sudo mount /dev/sda5 /mnt    // chú ý phân vùng nhé

########## mount (bind) the live CD  Dir with installed linux Dir ##########


sudo mount --bind /proc /mnt/proc

sudo mount --bind /dev /mnt/dev

sudo mount --bind /sys /mnt/sys

########## Get the root privilege ##########

chroot /mnt               // nếu không được thì đánh lệnh dưới nhé 
sudo chroot /mnt

########## Install the grub  ##########

grub-install /dev/sda

sau khi chạy xong khởi động lại máy .

vào linux và cài đặt 1 phần mềm quản lý grub bất kì để quản lý boot

0 comments:

Post a Comment