2

Apologies in advance for any incorrect/dumb phrasing; I'm extremely new to all this.

I lost the private key to an EC2 instance I was previously running and am trying to follow the instructions listed under "Connecting to Your Linux Instance if You Lose Your Private Key" in the below link. In short, it tells me to create a temporary instance using the same AMI as the original instance, and then "from the temporary instance, mount the volume that you attached to the instance so that you can access its file system"

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#having-ec2-create-your-key-pair

I got up to 9c:

ubuntu@[ip]: ~$ lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0    8G  0 disk
└─xvda1 202:1    0    8G  0 part /
xvdf    202:80   0    8G  0 disk
└─xvdf1 202:81   0    8G  0 part
loop0     7:0    0 12.7M  1 loop /snap/amazon-ssm-agent/495
loop1     7:1    0 87.9M  1 loop /snap/core/5328

ubuntu@[ip]:~$ sudo mkdir /mnt/tempvol
ubuntu@[ip]:~$ sudo mount -o nouuid /dev/xvdf1 /mnt/tempvol

mount: wrong fs type, bad option, bad superblock on /dev/xvdf1,
   missing codepage or helper program, or other error

   In some cases useful info is found in syslog - try
   dmesg | tail or so.

Typing in "dmesg | tail" gives me:

[  626.631886] EXT4-fs (xvdf1): Unrecognized mount option "nouuid" or missing value

I googled around but couldn't find anything helpful. What am I doing wrong?

Thanks again for your help; happy to provide any more relevant information.

1
  • 1
    What is the output of fdisk -l? Do you see a partition/filesystem listed under the /dev/xvdf entry?
    – zymhan
    Commented Nov 30, 2018 at 21:19

2 Answers 2

3

The option -o nouuid is only useful on XFS filesystems. It's not clear why the option is not discussed in that document. Since the filesystem you're trying to mount is ext4, you can omit the option.

0
-1

use

sudo fdisk -l

to list your disks. Identify which of the entity is Linux filesystem. this is the disk that we need to mount.
Pass args -o nouuid to mount command.

sudo mount -o nouuid  /dev/nvme1n1p3 /mnt/disk

This will mount the disk and you can recover/backup your data or add your key,

You can then add your key like this

echo "PASTE CONTENTS OF id_rsa.pub FILE HERE" >> /mnt/disk/user/ec2-user/.ssh/authorized_keys

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .