| | 5 | == Preparing the logical volume for recovery == |
| | 6 | Plug in your most recent backup media, and update LVM's knowledge of the system volumes: |
| | 7 | |
| | 8 | {{{ |
| | 9 | jupiter:~# vgscan |
| | 10 | Reading all physical volumes. This may take a while... |
| | 11 | Found exported volume group "vgbackup0_jupiter" using metadata type lvm2 |
| | 12 | Found volume group "vghome_jupiter" using metadata type lvm2 |
| | 13 | Found volume group "vg0_jupiter" using metadata type lvm2 |
| | 14 | jupiter:~# vgs vgbackup0_jupiter |
| | 15 | VG #PV #LV #SN Attr VSize VFree |
| | 16 | vgbackup0_jupiter 1 1 0 wzx-n 372.61G 279.46G |
| | 17 | jupiter:~# |
| | 18 | }}} |
| | 19 | The `x` in the `Attr` column means we need to `vgimport` the volume group so that it can be used: |
| | 20 | {{{ |
| | 21 | jupiter:~# vgimport vgbackup0_jupiter |
| | 22 | Volume group "vgbackup0_jupiter" successfully imported |
| | 23 | jupiter:~# vgs vgbackup0_jupiter |
| | 24 | VG #PV #LV #SN Attr VSize VFree |
| | 25 | vgbackup0_jupiter 1 1 0 wz--n 372.61G 279.46G |
| | 26 | jupiter:~# |
| | 27 | }}} |
| | 28 | activate the volume you care about, and switch it to read-only (so you don't destroy the backups by accident while trying to recover!) |
| | 29 | {{{ |
| | 30 | jupiter:~# lvs vgbackup0_jupiter |
| | 31 | LV VG Attr LSize Origin Snap% Move Copy% |
| | 32 | backup0 vgbackup0_jupiter -wi--- 93.15G |
| | 33 | jupiter:~# lvchange -ay -pr vgbackup0_jupiter/backup0 |
| | 34 | Logical volume "backup0" changed |
| | 35 | jupiter:~# lvs vgbackup0_jupiter |
| | 36 | LV VG Attr LSize Origin Snap% Move Copy% |
| | 37 | backup0 vgbackup0_jupiter -ri-a- 93.15G |
| | 38 | jupiter:~# |
| | 39 | }}} |
| | 40 | |
| | 41 | == mounting the recovery volume == |
| | 42 | |
| | 43 | Create a place to mount the volume, and mount it. remember to mount it read-only: |
| | 44 | |
| | 45 | {{{ |
| | 46 | jupiter:~# TODAY=$(date +%Y%m%d) |
| | 47 | jupiter:~# mkdir /var/local/backups/recovery.$TODAY |
| | 48 | jupiter:~# mount -o ro /dev/vgbackup0_jupiter/backup0 /var/local/backups/recovery.$TODAY |
| | 49 | jupiter:~# |
| | 50 | }}} |
| | 51 | |
| | 52 | == look at the differences == |
| | 53 | |
| | 54 | you can see what might have changed: |
| | 55 | |
| | 56 | {{{ |
| | 57 | jupiter:~# diff -qr /srv/calfs/home/ /var/local/backups/recovery.$TODAY/srv/calfs/home/ >/var/local/backups/changes.$TODAY |
| | 58 | jupiter:~# |
| | 59 | }}} |
| | 60 | |
| | 61 | == recovering data == |
| | 62 | |
| | 63 | you should be able to use simple tools like `rsync` and `cp` to pull out old versions of data that you need to pull out. |
| | 64 | |
| | 65 | == clean up == |
| | 66 | |
| | 67 | when yer done, you should clean up. unmount the recovery volume, deactivate it, and export the volume group: |
| | 68 | |
| | 69 | {{{ |
| | 70 | jupiter:~# umount /var/local/backups/recovery.$TODAY |
| | 71 | jupiter:~# lvchange -an vgbackup0_jupiter/backup0 |
| | 72 | jupiter:~# vgexport vgbackup0_jupiter |
| | 73 | Volume group "vgbackup0_jupiter" successfully exported |
| | 74 | jupiter:~# |
| | 75 | }}} |