我恢复了一个 EBS 卷并将其附加到一个新的 EC2 实例。当我lsblk
可以在名字下看到它时/dev/nvme1n1
。
更具体地说,输出lsblk
是:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 25M 1 loop /snap/amazon-ssm-agent/4046
loop1 7:1 0 55.4M 1 loop /snap/core18/2128
loop2 7:2 0 61.9M 1 loop /snap/core20/1169
loop3 7:3 0 67.3M 1 loop /snap/lxd/21545
loop4 7:4 0 32.5M 1 loop /snap/snapd/13640
loop5 7:5 0 55.5M 1 loop /snap/core18/2246
loop6 7:6 0 67.2M 1 loop /snap/lxd/21835
nvme0n1 259:0 0 8G 0 disk
└─nvme0n1p1 259:1 0 8G 0 part /
nvme1n1 259:2 0 100G 0 disk
如您所见,nvme1n1
没有分区。结果,当我尝试使用以下命令将其安装到文件夹上时:
sudo mkdir mount_point
sudo mount /dev/nvme1n1 mount_point/
我明白了
mount: /home/ubuntu/mount_point: wrong fs type, bad option, bad superblock on /dev/nvme1n1, missing codepage or helper program, or other error.
该卷内部有数据:
/dev/nvme1n1: data
使用sudo mkfs -t xfs /dev/nvme1n1
创建文件系统不是一个选项,亚马逊指出:
警告 如果您要装载已包含数据的卷(例如,从快照创建的卷),请勿使用此命令。否则,您将格式化该卷并删除现有数据。
事实上,我用我恢复的第二个虚拟 ebs 快照进行了尝试,我得到的只是一个虚拟lost+found
linux文件夹。
这个EBS恢复的快照里面有有用的数据,我如何挂载它而不破坏它们?
# parted -l /dev/nvme1n1 print
Model: Amazon Elastic Block Store (nvme)
Disk /dev/nvme0n1: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 8590MB 8589MB primary ext4 boot
Error: /dev/nvme1n1: unrecognised disk label
Model: Amazon Elastic Block Store (nvme)
Disk /dev/nvme1n1: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
dmesg | grep nvme1n1
[ 68.475368] EXT4-fs (nvme1n1): VFS: Can't find ext4 filesystem
[ 96.604971] EXT4-fs (nvme1n1): VFS: Can't find ext4 filesystem
[ 254.674651] EXT4-fs (nvme1n1): VFS: Can't find ext4 filesystem
[ 256.438712] EXT4-fs (nvme1n1): VFS: Can't find ext4 filesystem
sudo fsck /dev/nvme1n1
fsck from util-linux 2.34
e2fsck 1.45.5 (07-Jan-2020)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/nvme1n1
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
答案1
答案2
我自己一直在努力解决这个问题,然后随着信息不断涌入,我突然意识到
disk util 管理驱动器和媒体以及挂载点,使用风险由您自行承担,它是大多数 Linux 发行版中的标准实用程序