How can I back up an unsupported disk format
I need to work with an XFS volume, which means I can't use Linode backups.
From a raw disk I can format and mount the disk on a CentOS 7 node as follows:
mkfs.xfs -l lazy-count=1,version=2,size=128m -i attr=2 -d agcount=4 -L XFSVolume /dev/sdc mount -t xfs -o noatime,logbsize=256k,logbufs=8 /dev/sdc /mnt/xfs
To verify that this won't work with Linode backups I took a Linode snapshot and restored it to another node. As expected, it would not mount as XFS, but weirdly I could mount the device as ext4. I only tested this with a simple text file but the data was there. I'm going to assume for now that this isn't a reliable way to restore data. Can anyone comment on that?
Going to back to the original problem..
This volume is to be used for database files, so I need to take a consistent, online snapshot and move it somewhere else - possibly to a separate disk or server that is backed up by Linode. I can't rsync straight out of the moving filesystem, although I could rsync from a stable snapshot once taken.
Initially this is for MongoDB and I've read this article showing an example of snapshotting using LVM without shutting down the database. I know zero about LVM and I can't follow that example because the Linode disk isn't attached into a volume group. Is there a way to mount the disk so I can take a LVM snapshot, or is there some other way (perhaps using xfs_dump) to achieve rolling backups of this disk?
After some research, I realise I can replace the normal formatting of the device, as follows:
pvcreate /dev/sdc vgcreate vg01 /dev/sdc lvcreate -L 100M -n xfs01 vg01 mkfs.xfs -l lazy-count=1,version=2,size=10m -i attr=2 -d agcount=4 -L XFS01 /dev/vg01/xfs01 mkdir -p /mnt/data mount -t xfs -o noatime,logbsize=256k,logbufs=8 /dev/vg01/xfs01 /mnt/data
That creates a 100M volume for storing data, which can then be snapshotted (according to the MongoDB guide) then copied out and destroyed before it fills up.
lvcreate --size 1M --snapshot --name xfs-snap01 /dev/vg01/xfs01 dd if=/dev/vg01/xfs-snap01 | gzip > /tmp/backup.gz scp /tmp/backup.gz someone@elsewhere:backups lvremove -y /dev/vg01/xfs-snap01
I've not tried any of this in production yet, but looks really promising.