33

I tried mounting an existing EBS Storage (which has data) to an instance, but it keeps throwing this error.

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.

The storage details are:

ec2-user@ip ~]$ sudo parted -l
Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                 Flags
128     1049kB  2097kB  1049kB               BIOS Boot Partition  bios_grub
 1      2097kB  8590MB  8588MB  ext4         Linux


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvdf: 16.1GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                 Flags
128     1049kB  2097kB  1049kB               BIOS Boot Partition  bios_grub
 1      2097kB  16.1GB  16.1GB  ext4         Linux

dmesg | tail shows the following details

   [ec2-user@ip- ~]$ dmesg | tail
[    2.593163] piix4_smbus 0000:00:01.3: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr
[    2.625565] evbug: Connected device: input0 (AT Translated Set 2 keyboard at isa0060/serio0/input0)
[    2.625568] evbug: Connected device: input2 (Power Button at LNXPWRBN/button/input0)
[    2.625570] evbug: Connected device: input3 (Sleep Button at LNXSLPBN/button/input0)
[    3.657958] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input4
[    3.664979] evbug: Connected device: input4 (ImExPS/2 Generic Explorer Mouse at isa0060/serio1/input0)
[    5.731219] EXT4-fs (xvda1): re-mounted. Opts: (null)
[    5.938276] NET: Registered protocol family 10
[   11.720921] audit: type=1305 audit(1412199137.191:2): audit_pid=2080 old=0 auid=4294967295 ses=4294967295 res=1
[  101.024164] EXT4-fs (xvdf): VFS: Can't find ext4 filesystem
[ec2-user@ip- ~]$ 
Sai
  • 333
  • 1
  • 3
  • 4

3 Answers3

72

Looks like you have partitioned that block device. In this case, you need to mount /dev/xvdf1, not just /dev/xvdf.

EEAA
  • 109,363
  • 18
  • 175
  • 245
  • Seems to work. Will update in few minutes. Thanks for this. – Sai Oct 01 '14 at 21:48
  • 1
    Yes. Even if attached as "xvdf" using AWS Dashboard, must mount as `xvdf1`. To tell if you have a partitioned drive, check /dev: `ls /dev/xvdf*` and if so, you will see more than one entry. – Brent Faust Nov 14 '15 at 22:05
  • @Rubistro That only applies if you've partitioned the block device. – EEAA Nov 14 '15 at 22:06
  • This literally saved my job (probably). It's odd that the Amazon AWS documentation doesn't make mention of this on this page - https://aws.amazon.com/articles/5213606968661598. – chamberlainpi Jun 19 '16 at 00:54
2

For me there was some mysterious file causing this issue.

First check your partitions to make sure you are running an ext3 volume and then:

For me I had to clear the directory using the following command.

sudo mkfs -t ext3 /dev/sdf

Warning: this might delete files you have saved. So you can run ls to make sure you don't lose important saved files

ScottyBlades
  • 121
  • 3
  • 1
    This can be absolutely destructive if you are *not* running an `ext3` volume. You can also encounter OP error if you have picked the wrong fs type. For example if you try mount an `ext4` volume as an `ext3` volume. Heads up before someone deletes their data! – Justin Fortier Jul 14 '20 at 18:14
  • 1
    @JustinFortier, does the edit make it safer, or is there anything else that should be mentioned? – ScottyBlades Jul 15 '20 at 01:04
  • thanks, would suck if someone blindly copied and pasted that without checking first. Especially since OPs output log mentions `ext4`. – Justin Fortier Jul 20 '20 at 18:58
1

My problem seems to be the new server I tried to mount the secondary EBS volume to was from the same Amazon Linux image

This lead to both disks having the same UUID

[ec2-user@ip-172-31-2-42 ~]$ lsblk -f
NAME          FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
nvme0n1
├─nvme0n1p1   xfs          /     974bfdce-a279-4e16-b3a4-114c0f95708b    6.4G    19% /
├─nvme0n1p127
└─nvme0n1p128 vfat   FAT16       CE90-017B
nvme1n1
├─nvme1n1p1   xfs          /     974bfdce-a279-4e16-b3a4-114c0f95708b
├─nvme1n1p127
└─nvme1n1p128 vfat   FAT16       CE90-017B

I created a new instance from a different source AMI (Ubuntu) and it mounted fine

sudo mkdir /olddisk
sudo mount -t xfs /dev/xvdf1 /olddisk
fiat
  • 797
  • 11
  • 16