7

I'm trying to mount a disc created some time ago in Amazon EC2. This is what I see (line breaks added for the sake of readability):

$ sudo file -s /dev/xvda4
/dev/xvda4: x86 boot sector; partition 1: ID=0x83, starthead 1, 
startsector 63, 10474317 sectors, extended partition table (last)\011, 
code offset 0x0

When I'm trying to mount it:

$ sudo mount /dev/xvda4 /mnt/foo
mount: wrong fs type, bad option, bad superblock on /dev/xvda4,
   missing codepage or helper program, or other error
   In some cases useful info is found in syslog - try
   dmesg | tail  or so

How can I mount this disc?

Maybe this information will help:

$ sudo fdisk -lu /dev/xvda4
Disk /dev/xvda4: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders, total 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0952616d
  Device Boot      Start         End      Blocks   Id  System
/dev/xvda4p1              63    10474379     5237158+  83  Linux

5 Answers 5

5

Post by Fernandez de Quilon helped me:

$ mount -t ext4 -o offset=32256 /dev/xvda4 /mnt/foo

Works fine. 32256 is calculated as 63 (start of partition) multiplied by 512 (sector size).

1
  • 2
    Why did you not just use the /dev/xvda4p1 device node to automatically hook up to the inner partition?
    – Caleb
    Commented Aug 19, 2013 at 14:24
5

If you are trying to mount an old snapshot you are probably getting a uuid error. Check if

 dmesg | tail

Shows:

[-your.timestamp.here-] XFS (xvdg): Filesystem has duplicate UUID - can't mount

If it does, and you only need to mount to get something off of it you can mount it like this (on /var/www2 in my case):

mount -o nouuid /dev/xvdg /var/www2

If you want to use it regularly you need to generate a new UUID like this (on my /dev/xvdg which you should replace with your /dev/...):

xfs_admin -U generate /dev/xvdg
3

/dev/xvda4 does not contain a filesystem, as the output of file indicates. It contains a partition table. fdisk displays this partition table. There is presumably a filesystem on the sole partition inside that volume (the name of the partition is visible in the fdisk output).

sudo mount /dev/xvda4p1 /mnt/foo
1

I'm assuming /dev/xvda is the device, and /dev/xvda4 is a partition. With a partition table in a partition, this complicates things a bit. But we can get around that using the loopback device which would normally be used to mount filesystems residing in files. But we can apply it to a device, too.

sudo mount -o loop,offset=32256 /dev/xvda4 /mnt/foo

The number 32256 is the number of bytes to sector 63 where your fdisk output showed the inner partition to be starting at.

0

How about just:

# mount -t auto /dev/xvda4 /mnt/foo
1
  • 1
    The same response as above. If -t is not specified it is assumed as auto (according to mount man page)
    – yegor256
    Commented Jan 6, 2012 at 11:55

You must log in to answer this question.

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