Ubuntu/UUID/blkid/fstab/Grub2 boot and rescue

99 篇文章 0 订阅
24 篇文章 0 订阅

1. sudo blkid


lake@lake-Latitude-5491:~$ blkid 
/dev/nvme0n1p1: LABEL="EFI" UUID="6E2F-5B3B" TYPE="vfat" PARTUUID="8ca6e523-01"
/dev/nvme0n1p2: LABEL="MSR" UUID="C466-BFF3" TYPE="vfat" PARTUUID="8ca6e523-02"
/dev/nvme0n1p3: LABEL="Ubuntu" UUID="b3227854-1508-4a0e-ab9b-a222e279f1e1" TYPE="ext4" PARTUUID="8ca6e523-03"
lake@lake-Latitude-5491:~$ 

2. ls -l /dev/disk/by-uuid

 

3. /etc/fstab

 

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p3 during installation
UUID=b3227854-1508-4a0e-ab9b-a222e279f1e1 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=6E2F-5B3B  /boot/efi       vfat    umask=0077      0       1

 

4. fdisk info/MBR 
lake@lake-Latitude-5491:~$ sudo  fdisk   -l   /dev/nvme0n1
Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 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
Disklabel type: dos
Disk identifier: 0x8ca6e523

Device         Boot    Start      End  Sectors  Size Id Type
/dev/nvme0n1p1          2048  1538047  1536000  750M  b W95 FAT32
/dev/nvme0n1p2       1538048 12023807 10485760    5G  b W95 FAT32
/dev/nvme0n1p3 *    12023808 74938367 62914560   30G 83 Linux
lake@lake-Latitude-5491:~$ 

 

5. Update grub2 menu 

$ sudo grub2-mkconfig  -o /boot/grub2/grub.cfg

or

$update-grub

6.grub2 rescue

 

grub rescue>ls

Example 

(hd0),(hd0,msdos1),(hd0,msdos2)

search /boot/grub2 folder in each partition 

Example1:  ls (hd0,X)/boot/grub2

Example2:  ls (hd0,X)/grub2

Output.... 

 -grub2  grub  grub.cfg  i386-pc ...

 

Fix/Rescure

grub rescue> set root=hd0,msdos2 

grub rescue> set prefix=(hd0,msdos2)/grub2

grub rescue> insmod (hd0,msdos2)/grub2/i386-pc/normal.mod

// 加载normal模块

grub rescue> normal // 调用normal模块

grub rescue> insmod part_gpt   //方便Grub看见gpt分区

Get the menu of Grub2 

 

Get into System/Linux/Centos/RHEL etc

########## Grub2/GPT/UEFI   Example

/boot/efi   mount   /dev/nvme0n1p1   ----->  vfat  with folders :  EFI, en-us 

/boot  in / (root example: /dev/nvme0n1p2) or specified partition, with vmliuz*, grub,grub2 and the mount point /boot/efi for UEFI vfat partition.

 

## rpm -ivh  eflbootmgr-xxxx.rpm  grub2-xxx.rpm 

# grub2-install  /dev/nvme0n1  ->  UEFI  Hardware Disk without partition No. number!!!

--> grub2-install completed, No Error occured.

 

7.grub2 rescue by linux/initrd loading 

  

grub rescue> linux (hd0,msdos2)/boot/vmlinuz-4.1.13  root=/dev/nvme0n1p3

grub rescue> initrd  (hd0,msdos2)/boot/initrd-4.1.13

grub rescue> boot

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值