Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
share|improve this question
add comment

5 Answers

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:

xfs_admin -U generate /dev/xvdg
share|improve this answer
add comment

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.

share|improve this answer
add comment

/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
share|improve this answer
add comment

How about just:

# mount -t auto /dev/xvda4 /mnt/foo
share|improve this answer
1  
The same response as above. If -t is not specified it is assumed as auto (according to mount man page) –  yegor256 Jan 6 '12 at 11:55
add comment

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).

share|improve this answer
    
+1 from me, on offset switch. –  Nikhil Mulley Jan 6 '12 at 11:53
1  
Why did you not just use the /dev/xvda4p1 device node to automatically hook up to the inner partition? –  Caleb Aug 19 '13 at 14:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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