Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I had some unknown issue with my old EC2 instance so that I can't ssh into it anymore. Therefore I created a new EBS volume from a snapshot of the old volume and tried to attach and mount it to the new instance. Here is what I did:

Created a new volume from snapshot of the old one.

Created a new EC2 instance and attached the volume to it as /dev/xvdf (or /dev/sdf)

SSHed into the instance and attempted to mount the old volume with:

$ sudo mkdir -m 000 /vol

$ sudo mount /dev/xvdf /vol

And the output was:

mount: block device /dev/xvdf is write-protected, mounting read-only

mount: you must specify the filesystem type

Now, I know I should specify the filesytem as ext4 but since the volume contains a lot of important data, I cannot format it through $ sudo mkfs -t ext4 /dev/xvdf. Still, I know of no other way of preserving the data and specifying the filesystem at the same time. I've searched a lot about it and I'm currently at a loss.

By the way, the mounting as 'read-only' also worries me but I haven't look into it yet since I can't mount the volume at all.

When I do sudo mount /dev/xvdf /vol -t ext4 (no formatting) I get:

mount: wrong fs type, bad option, bad superblock on /dev/xvdf,

       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try

       dmesg | tail  or so

And dmesg | tail gives me:

[ 1433.217915] EXT4-fs (xvdf): VFS: Can't find ext4 filesystem

[ 1433.222107] FAT-fs (xvdf): bogus number of reserved sectors

[ 1433.226127] FAT-fs (xvdf): Can't find a valid FAT filesystem

[ 1433.260752] EXT4-fs (xvdf): VFS: Can't find ext4 filesystem

[ 1433.265563] EXT4-fs (xvdf): VFS: Can't find ext4 filesystem

[ 1433.270477] EXT4-fs (xvdf): VFS: Can't find ext4 filesystem

[ 1433.274549] FAT-fs (xvdf): bogus number of reserved sectors

[ 1433.277632] FAT-fs (xvdf): Can't find a valid FAT filesystem

[ 1433.306549] ISOFS: Unable to identify CD-ROM format.

[ 2373.694570] EXT4-fs (xvdf): VFS: Can't find ext4 filesystem

1 Answer

0 votes
by (44.4k points)

Mount the partition (if the disk is partitioned):

sudo mount /dev/xvdf1 /vol -t ext4

Mount the disk (if not partitioned):

sudo mount /dev/xvdf /vol -t ext4

where:

  • /dev/xvdf will be changed to the EBS Volume device being mounted
  • /vol is changed to the folder you want to mount to.
  • ext4 is the filesystem type of the volume is mounted

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...