Error when trying to mount snapshot LVM (XFS filesystem)
-
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
):dd if=/dev/wd1/mongodbSnap of=/path/backup_of_mongodb_$(date -I).img
-
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:Each XFS filesystem is labeled with a Universal Unique Identifier (UUID). The UUID is stored in every allocation group header and is used to help distinguish one XFS filesystem from another, therefore you should avoid using dd(1) or other block-by-block copying programs to copy XFS filesystems. If two XFS filesystems on the same machine have the same UUID, xfsdump(8) may become confused when doing incremental and resumed dumps. xfsdump(8) and xfsrestore(8) are recommended for making copies of XFS filesystems.
TLDR: It's better to use xfsdump and xfsrestore.
-
Backing up with xfsdump:
- Install xfsdump. E.g. in Ubuntu these tools can be installed from the
xfsdump
package:
apt install xfsdump
- Take the dump:
xfsdump -f /path/backup_of_mongodb_$(date -I).xfsdump /dev/wd1/mongodb
- Install xfsdump. E.g. in Ubuntu these tools can be installed from the