1. 首先利用ls命令,找到Ubuntu安裝在哪個磁碟分區; 比如輸入ls後我的機器列出的磁碟分區信息如下: (hd0),(hd1),(hd1,gpt3),(hd1,gpt2),(hd1,gpt1) 查找包含grub.cfg文件的分區 2. 找到Linux的/boot分區,以及/根分區所在的磁碟位置 ...
1. 首先利用ls命令,找到Ubuntu安裝在哪個磁碟分區;
- 比如輸入ls後我的機器列出的磁碟分區信息如下:
(hd0),(hd1),(hd1,gpt3),(hd1,gpt2),(hd1,gpt1)
- 查找包含grub.cfg文件的分區
假定通過 ls (hd1,gpt2)/boot/grub 發現了grub.cfg文件,則表明Linux安裝在這個分區
2. 找到Linux的/boot分區,以及/根分區所在的磁碟位置
輸入 cat (hd0,gpt2)/etc/fstab
會輸出類似下麵的信息
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during installation
UUID=dd6e0539-1369-4938-8af5-378f02cf05cf / ext4 errors=remount-ro 0 1
3. 指定Linux內核,及/所在分區
grub> linux /boot/vmlinuz-4.8.0-36-generic ro text root=/dev/sda2
4. initrd命令指定initrd文件
grub> initrd /boot/initrd.img-4.8.0-36-generic
5. boot引導系統,結束
grub> boot