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.


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>
  • Perhaps I'm misunderstanding, but you don't need to mount a block device before taking an image of it with dd. In fact, it's better to not mount it.
    – EEAA
    Apr 28, 2017 at 1:51
  • oh ok thanks for that EEAA i didn't realise that...i thought I had to mount it. What if i wanted to use tar to do an archive file backup though i would need to mount then right?
    – MarMan29
    Apr 28, 2017 at 1:54
  • That's correct.
    – EEAA
    Apr 28, 2017 at 1:55

1 Answer 1

  1. 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
  2. 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

    TLDR: It's better to use xfsdump and xfsrestore.

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

You must log in to answer this question.

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