centos机器重启后,经常会出现磁盘挂载后丢失,解决办法是将挂载信息写入到 /etc/fstab 文件中
操作步骤:
1、先查看到磁盘的UUID
[root@vm104 ~]# sudo blkid /dev/sr0: UUID="2021-09-22-18-17-15-00" LABEL="cidata" TYPE="iso9660" /dev/sdc1: UUID="aef7098d-7a60-45ad-900d-ac6197943bf4" TYPE="ext4" /dev/sda1: UUID="953624df-bcfb-4319-a988-e636491feb96" TYPE="xfs" /dev/sda2: UUID="Vtvqws-VNOf-7Xnu-EKEa-eia0-cU7z-20IVS0" TYPE="LVM2_member" /dev/mapper/centos-root: UUID="c40e12aa-61a3-4337-b981-377d15574cff" TYPE="xfs" /dev/mapper/centos-swap: UUID="12ade662-9c0d-48a9-a3ba-07ccefce82f5" TYPE="swap" [root@vm104 ~]# [root@vm104 ~]# ls -l /dev/disk/by-uuid total 0 lrwxrwxrwx 1 root root 10 Sep 22 18:17 12ade662-9c0d-48a9-a3ba-07ccefce82f5 -> ../../dm-1 lrwxrwxrwx 1 root root 9 Sep 22 18:17 2021-09-22-18-17-15-00 -> ../../sr0 lrwxrwxrwx 1 root root 10 Sep 22 18:17 953624df-bcfb-4319-a988-e636491feb96 -> ../../sda1 lrwxrwxrwx 1 root root 10 Sep 22 18:17 aef7098d-7a60-45ad-900d-ac6197943bf4 -> ../../sdc1 lrwxrwxrwx 1 root root 10 Sep 22 18:17 c40e12aa-61a3-4337-b981-377d15574cff -> ../../dm-0 [root@vm104 ~]#
编辑 /etc/fstab 文件
# /etc/fstab # Created by anaconda on Fri Sep 3 18:44:56 2021 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=953624df-bcfb-4319-a988-e636491feb96 /boot xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0 UUID=aef7098d-7a60-45ad-900d-ac6197943bf4 /root/sdb_scsi1 ext4 defaults 0 0 //将挂载信息写在这里