I have the following logical volume:
--- Logical volume ---
LV Path /dev/wd1/mongodb
LV Name mongodb
VG Name wd1
LV UUID xxxx
LV Write Access read/write
LV Creation host, time xxxx
LV snapshot status source of
mongodbSnap [active]
LV Status available
# open 1
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
I used the command:
lvcreate --size 100M --snapshot --name mongodbSnap /dev/wd1/mongodb
to create the following snapshot:
--- Logical volume ---
LV Path /dev/wd1/mongodbSnap
LV Name mongodbSnap
VG Name wd1
LV UUID xxx
LV Write Access read/write
LV Creation host, time xxx
LV snapshot status active destination for mongodb
LV Status available
# open 0
LV Size 8.00 GiB
Current LE 2048
COW-table size 100.00 MiB
COW-table LE 25
Allocated to snapshot 0.18%
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:7
Everything looks good at this point. However when I try to mount the snap lv volume with the following:
mount -t xfs /dev/wd1/mongodbSnap /mnt
I get the following error:
mount: wrong fs type, bad option, bad superblock on /dev/mapper/wd1-mongodbSnap,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
Update
The log message contains the following error:
[2424239.516667] XFS (dm-7): Filesystem has duplicate UUID xxxxxx - can't mount
Why would the snapshot contain the same UUID as the original lv and how do I get around this? The whole purpose of doing this is to make a backup of the drive using the dd command…
Solution to this is to mount the filesystem with nouuid option
mount -o nouuid <source> <dest>
Best Answer
There is no need to mount it for taking a backup with dd. Although dd is not recommended for XFS (see below for why), but if you insist using dd just use the snapshot LV device as the input parameter (
if
):UUID is the filesystem's unique identifier which is stored within the filesystem metadata. When you take a snapshot of the LV, also this metadata is identical to the original LV in the snapshot LV and therefore they have the same UUID. However, note what XFS's manual page (locally
man xfs
or online e.g. here) says about its UUIDs:TLDR: It's better to use xfsdump and xfsrestore.
Backing up with xfsdump:
xfsdump
package: