(Press ? for help, n and p for next and previous slide; usage hints)
Martin Kennedy (License Information)
lsmod | awk '{print $1}' | grep ^dm_ | xargs -I{} modinfo '{}'
dm mapping targetsdm-linear for e.g. treating sections of one-or-more Physical Volumes (PVs) in a Volume Group (VG) as one Logical Volume (LV)dm-crypt for On-the-fly-encryption (OTFE)dm-snapshot for Copy-on-Write (CoW) snapshots
dm-crypt for LUKS/pccehr and /dat# As root lvcreate --size 10G --snapshot --name pccehr_snap vg00/pccehr lvcreate -L 30G -s -n dat_snap vg00/dat
touch /cvt/data/DO_RESTORE.trigger; make /cvt/data/FULL_RESTORE.sentinel;
date; psql -d dat -c "select count(*) from patient"; RE systemctl stop partner pccehr mcservice postgresql-9.5; RE lvconvert --merge vg00/pccehr_snap RE lvconvert --merge vg00/dat_snap RE umount /pccehr /dat; RE lvchange -an vg00/{dat,pccehr}; RE lvchange -ay vg00/{dat,pccehr}; RE mount /dat; RE mount /pccehr RE systemctl start partner pccehr mcservice postgresql-9.5; date; psql -d dat -c "select count(*) from patient";
fsync)lvcreate -L 10G -s -n ${lv}_snap ${vg}/${lv}
Reducing COW size 10.00 GiB down to maximum usable size 4.03 GiB.
Logical volume "pcc_snap" created.
mkdir -p /pccehr_snap /dat_snap # nouuid: XFS FSs have UUIDs that cannot collide # Mounting with nouuid ignores those mount -o nouuid /dev/vg00/pccehr_snap /pccehr_snap mount -o nouuid /dev/vg00/dat_snap /dat_snap # ... now check `lvs` ... # As you might expect: The filesystem is *really* mounted and has all # of the usual properties of a mounted filesystem find /dat_snap # ... now check `lvs` again ... # Mounting with noatime prevents unneeded writes back to snapshot space mount -o remount,noatime,nouuid /dev/vg00/pccehr_snap /pccehr_snap mount -o remount,noatime,nouuid /dev/vg00/dat_snap /dat_snap
… but we can re-activate immediately after and begin using it again even if it isn’t done merging:
While the merge is in progress, reads or writes to the origin appear as they were directed to the snapshot being merged. When the merge finishes, the merged snapshot is removed.
/pccehr and /datlvremove both snapshotsRE lvcreate -L 10G -s -n pccehr_snap vg00/pccehr; RE lvcreate -L 10G -s -n dat_snap vg00/dat;
RE mount -o noatime,nouuid /dev/vg00/dat_snap /dat_snap
RE mount -o noatime,nouuid /dev/vg00/pccehr_snap /pccehr_snap
. /cvt/tk/bak/bak_vars.sh
RE restic backup /dat_snap /pccehr_snap
RE umount /{pccehr,dat}_snap
RE lvremove vg00/{pccehr,dat}_snap
touch /cvt/data/DO_RESTORE.trigger; make /cvt/data/FULL_RESTORE.sentinel;
RE lvcreate -L 10G -s -n pccehr_snap vg00/pccehr; RE lvcreate -L 10G -s -n dat_snap vg00/dat; RE mount -o noatime,nouuid /dev/vg00/dat_snap /dat_snap RE mount -o noatime,nouuid /dev/vg00/pccehr_snap /pccehr_snap
# As root . /cvt/mk/mkennedy.profile . /cvt/tk/bak/bak_vars.sh mkdir -p /restic; restic mount /restic; # In a second terminal rsync -avP --delete /restic/snapshots/latest/pccehr_snap/ /pccehr_snap/ rsync -avP --delete /restic/snapshots/latest/dat_snap/ /dat_snap/ umount /{pccehr,dat}_snap;
date; psql -d dat -c "select count(*) from patient"; RE systemctl stop partner pccehr mcservice postgresql-9.5; RE lvconvert --merge vg00/pccehr_snap RE lvconvert --merge vg00/dat_snap RE umount /pccehr /dat; RE lvchange -an vg00/{dat,pccehr}; RE lvchange -ay vg00/{dat,pccehr}; RE mount /dat; RE mount /pccehr RE systemctl start partner pccehr mcservice postgresql-9.5; date; psql -d dat -c "select count(*) from patient";
PCCbackuprear runs as per usual before any backups/dat during the backup …
xfs_freezeIn summmary:
pg_dumpall at the same time a snapshot of /dat is made
/dat <-> /pccehr consistency issuepg_dump -j at the same time a snapshot of /dat made
PCCbackup for PostgresLog "pg_dumpall: Started" set -o pipefail if ! su postgres -c "pg_dumpall --clean" 2>>$logtmp | gzip --rsyncable >/backup/pgbackup.tmp.sql.gz 2>>$logtmp ; then SoftFail 2 "pg_dumpall"