Mounting LVM2 volume gives me 'mount: you must specify the filesystem type'
Solution 1
The Xen image contains probably of one or more partitions and includes therefore a partition table, so you cannot mount it directly.
Run file -Ls /dev/vgXEN/test-disk
to get information about this.
If the output contains something with "boot sector" and "partitions", you can try
kpartx -av /dev/vgXEN/test-disk
It creates for each partition a new device in /dev/mapper. You can then either mount this new partitions directly or need to do further steps if there is e.g. a LVM inside the image. It could be there is also a swap partition, which you cannot mount. You can run the file command from above on them to get more information.
Solution 2
I think the problem is that you didn't format this LVM Volume. Keep in mind that LVM is not a filesystem, so on top of LVM you will still need something like ext4 or reiserfs or whatever fs you prefer.
You can format it by doing this (for ext4) mkfs.ext4 /dev/vgXEN/test-disk
. After formatting you should be able to mount it.
Related videos on Youtube
JonasVH
Updated on September 18, 2022Comments
-
JonasVH over 1 year
I have a LVM2 Volume Group 'vgXEN' with a Logical Volume in it called 'test-disk'.
This is the output of lvdisplay:--- Logical volume --- LV Path /dev/vgXEN/test-disk LV Name test-disk VG Name vgXEN LV UUID lHSgfx-wnY2-OtRO-zw7l-9SFA-mnht-KgK9MO LV Write Access read/write LV Creation host, time DRAKE, 2013-08-26 12:02:08 +0200 LV Status available # open 0 LV Size 10.00 GiB Current LE 2560 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 4096 Block device 253:4
And this is the output of lvscan:
ACTIVE '/dev/vgXEN/test-disk' [10.00 GiB] inherit
Now when i try to mount this logical volume with the command i get an error:
mount /dev/vgXEN/test-disk /mnt/test mount: you must specify the filesystem type
My operating system is 'Linux DRAKE 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux'.
Searched the Internet but couldn't find anything useful. Can anybody point me in the right direction please ? Thx !UPDATE
The whole problem is related to storing XEN images and the way i want to backup them (via snapshot / mounting). Below you can read what i did wrong and the way it should be done.
What i did wrong
I've created 1 logical volume per XEN image, thus storing the disk and swap partition into 1 LV:LogicalVolume-A
xvda1 (disk)
xvda2 (swap)When you try to mount this LV it tells you 'mount: you must specify the filesystem type' and nothing happens of course. This is because the mount program doesn't know how to read partition tables inside a LV as the people stated in the answers below.
The way to do it
Create 1 logical volume per partition, thus storing the disk into 1 LV and the partition into 1 LV:LogicalVolume-A
xvda1 (disk)
LogicalVolume-B
xvda2 (swap)
It's now possible to format these logical volumes and use them into your images as storage. Once formatted you are also able to mount them with this simple command
mount /dev/vgXEN/test-disk /mnt/test
-
JonasVH over 10 yearsSounds like a logical answer, I'll try it right away. But i use the Logical Volumes for my XEN images and they don't need any formatting ?
-
JonasVH over 10 yearsFormatting the volume first with ext4 and mounting afterwards works like a charm. However i think I'm missing a 'mount type' in order to read those XEN (raw, not formatted) volume groups.
-
JonasVH over 10 yearsYes indeed those XEN disk images contain partitions. Thats a little bit odd to first split those disk images to get the partitions out since I'm using this script to backup my images and there is nothing mentioned there about accessing partitions: johnandcailin.com/blog/john/backing-your-xen-domains I'm trying to backup my images via 'tar' but maybe i should use another backup engine like 'rdiff-backup'.