PrettyPrint

jeudi 11 septembre 2014

Mount a LVM snapshot of a XFS filesystem

Lors de mes tests, j'ai été confronté a un problème de montage d'un instantané (snapshot) d'un LV en XFS; le problème, les snapshots ayant le meme uuid que leur LV d'origine et XFS empechant, par defaut, le double montage d'un fs (se basant sur l'uuid), il refusera de le monter.

Je vous donne ici une solution, en reproduisant l'erreur.

Creation d'un LV
[root@tnjulius ~]# vgcreate vg_test /dev/md0
[root@tnjulius ~]# lvcreate -n lv_test -l50%FREE vg_test
[root@tnjulius ~]# mkfs.xfs /dev/vg_test/lv_test
[root@tnjulius ~]# mkdir /test
[root@tnjulius ~]# mount /dev/vg_test/lv_test /test/

Création du snapshot
[root@tnjulius ~]# lvcreate -s -n lv_test_snap01 -l1%ORIGIN /dev/vg_test/lv_test

montage du snapshot
[root@tnjulius ~]# mkdir /test_snap
[root@tnjulius ~]# mount /dev/vg_test/lv_test_snap01 /test_snap/
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg_test-lv_test_snap01,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so

Verification dans les logs
[root@tnjulius ~]# tail -1 /var/log/messages
Sep 11 14:30:58 tnjulius kernel: [11175.220536] XFS (dm-14): Filesystem has duplicate UUID ed8f9114-8471-4d87-8a51-4a4f27eeb239 - can't mount

Solution: en cherchant dans man mount
Mount options for xfs
(...)
nouuid Don't check for double mounted filesystems using the filesystem uuid.  This is useful to mount LVM snapshot volumes.
(...)

[root@tnjulius ~]# mount -o nouuid /dev/vg_test/lv_test_snap01 /test_snap/
[root@tnjulius ~]# tail -3 /var/log/messages
Sep 11 14:37:18 tnjulius kernel: [11555.401702] XFS (dm-14): Mounting Filesystem
Sep 11 14:37:18 tnjulius kernel: [11555.928120] XFS (dm-14): Starting recovery (logdev: internal)
Sep 11 14:37:18 tnjulius kernel: [11556.068293] XFS (dm-14): Ending recovery (logdev: internal)


Aucun commentaire :

Enregistrer un commentaire