VZdump in tmpfs

SnakeSolidNL

Member
Jun 7, 2017
6
0
6
I'm using the suspend mode for my automated backups, but in order to decrease disk writes I would like
to have rsync write it's temporary files to a ramdisk (tmpfs).

Something like this:

in /etc/fstab
tmpfs /mnt/ramdisk tmpfs nodev,nosuid,noexec,nodiratime,size=32G 0 0​

in /etc/vzdump.conf
tmpdir = /mnt/ramdisk​

Anyone else tried this before ?

Would this be safe ? (I have enough RAM to be able to copy my largest LXC container)
 
That makes sense. Using RAM for temporary backup files is a lot faster and results in shorter container downtime. vzdump has a list of known POSIX-compliant filesystems, cf. /usr/share/perl5/PVE/VZDump.pm, line 22:

my @posix_filesystems = qw(ext3 ext4 nfs nfs4 reiserfs xfs);

Since tmpfs is not included in this list, vzdump will default to /var/tmp (cf. lines 827-831). If you add tmpfs to the above list in line 22, you can just specify /dev/shm as a dumpdir (e.g. vzdump [VMNUM] --dumpdir /mnt/ramdisk) and it should work as you intend. You will, of course, have to make sure that the files plus the tar file (so 2x the size) will actually fit.

I've just submitted a patch to the pve-devel mailing list. Keep your fingers crossed that it becomes included :-)