Skip to content

Instantly share code, notes, and snippets.

@qw3r
Created September 20, 2011 22:22
Show Gist options
  • Save qw3r/1230608 to your computer and use it in GitHub Desktop.
Save qw3r/1230608 to your computer and use it in GitHub Desktop.
backup LVM backed iSCSI target
I've created a san using Logical Volumes as backing-store iSCSI LUNs (tgt)
the target iqn.2011-09.com.pany.san:target1 using the LV /dev/vg0/t1l1 as backing-store
the initiator sees the device as /dev/sda
on the initiator i've created 2 partition /dev/sda1 (swap) and /dev/sda2 (ext4)
I want to be able to create backup on of the ext4 fs, without stopping the initiator!
The solution i came up with involves the snapshot feature of LVM, kpartx from multipath-tools and some backup method (i prefer rdiff-backup or safekeep).
steps:
1. lvcreate -s -n sh -L 10G /dev/vg0/t1l1
2. kpartx -a /dev/mapper/vg0-sh
3. mount /dev/mapper/vg0-shp2 /mnt/backup
4. do the backup (rdiff-backup, safekeep, or just copy the files)
5. umount /dev/mapper/vg0-shp2
6. kpartx -d /dev/mapper/vg0-sh
7. lvremove /dev/vg0/sh
That it! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment