AWS creates AMI image data loss solution

   Recently, I am using an online environment to build a test environment. Haha, it’s a bit funny. I am indeed doing this. Everything is normal when I use Ubuntu. When I use centos, I find that the data is gone. I solve it by following the following methods. Now record it for files.

1 Check the number of disks mounted on the image. Sure enough, only the system disk is mounted.

vi /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Mon Nov 27 22:04:35 2017
#
# 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
#
UUID=XXXXXXXXXXXXX6-4ee8-a4b7-89XXXXXXXXXXX /                       xfs     defaults        0 0

2 lsblk verified that it was indeed not mounted.

NAME        MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1     259:1    0  10G  0 disk 
└─nvme0n1p1 259:2    0  10G  0 part /
nvme1n1     259:0    0  60G  0 disk 
nvme2n1     259:3    0  10G  0 disk 

3 The next step is simply to mount the disk and try it.

先fdisk -l看下
然后
mount /dev/nvme1n1 /XXX1
mount /dev/nvme2n1 /XXX2

The data is all back

4 Finally, you need blkid to check the device ID and then vi /etc/fstab to modify the automatic mounting at boot.

# ADDED
UUID=23Xxxxxxxxxxxxxxxxxxxxxxxxx2         /XXX    xfs    defaults        1 1
UUID=efddddddddddddddddddddddddd5dd       /XXX    xfs    defaults        1 1

in mount -a

Just run lsblk to see if the modification is correct.

Guess you like

Origin blog.csdn.net/baidu_31405631/article/details/109068611