2

I restored an EBS volume and attached it to a new EC2 instance. When I lsblk I can see it under the name /dev/nvme1n1.

More specifically the output of lsblk is:

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 

As you can see nvme1n1 has no partitions. As a result, when I try to mount it on a folder with:

sudo mkdir mount_point
sudo mount /dev/nvme1n1 mount_point/

I get

mount: /home/ubuntu/mount_point: wrong fs type, bad option, bad superblock on /dev/nvme1n1, missing codepage or helper program, or other error.

The volume has data inside:

/dev/nvme1n1: data

Using sudo mkfs -t xfs /dev/nvme1n1 to create a filesystem is not an option as Amazon states that:

Warning Do not use this command if you're mounting a volume that already has data on it (for example, a volume that was created from a snapshot). Otherwise, you'll format the volume and delete the existing data.

Indeed I tried it with a second dummy ebs snapshot that I recovered and all I got is a dummy lost+found linux folder.

This EBS recovered snapshot has useful data inside, how can I mount it without destroying them?


# 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>
13
  • 1
    Alright, before jumping into performing disk checks and stuff, I think you could try the following: mount -r -t ext4 /dev/nvme1n1 /some/mountpoint which will mount the disk read-only and in this case (since dmesg is showing ext4) it most probably is an ext4 file system. Nov 8, 2021 at 13:25
  • 1
    @Dimitris there is no nvme1n1p1 . Here p1 would refer to the first partition on the block device which you don't have as I mentioned in my previous comments which I deleted. You need to mount the whole disk since the partition (it seems ) has been created on the whole disk. Nov 8, 2021 at 13:45
  • 1
    @Dimitris. Did you try the -r flag? What does the dmesg show you then? Nov 8, 2021 at 14:50
  • 1
    dmesg is explicitly mentioning EXT4-fs (nvme1n1): VFS: Can't find ext4 filesystem . The nvme0n1 has indeed the boot partition on ext4 but we don't have to deal with that. I see there are some related posts like yours here: unix.stackexchange.com/questions/315063/… Please have a look there but don't run mkfs or anything like this because this might cause data loss. Running fsck can help and won't harm. Nov 8, 2021 at 21:09
  • 2
    "The volume has data inside: /dev/nvme1n1: data"... no, that just means file couldn't identify what the contents are. It could be garbage for all we know. It might be an encrypted volume. Nothing so far shows you have a valid filesystem there.
    – muru
    Nov 9, 2021 at 8:03

2 Answers 2

0

i have been strugling with this myself then it dawnd on me as information keeps comming in

disk util manage drives and media and mount points use at you own risk its a standard utility found in most linux distros

1
0

I would try using TestDisk to recover the deleted partition.

See: TestDisk Step By Step

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.