All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
What parts of the filesystem do you usually make backups of?
I read the discussion "What do you use for backup?" started by @ckissi, and I decided to use borg. With borg backups seem easy to perform: it is only necessary to ssh connect from the VPS console to my local machine, create a repository and then create an archive.
However I wonder: what parts of the file system would you suggest to backup?
I would backup the entire / partition, if this would not prevent me from restore it (would borg and the system backup themselves?). On the other hand I suppose that usually the most important part of a VPS is the database, as it happens to be for my Ruby on Rails web application. However I do not know if a backup of the whole database would be enough.
Comments
/
what's a backup?
i had this from someone/somewhere else, you can see what dirs its backing up.
https://paste.ee/p/x1oyC
In addition to the folders on @ehab's script, if there are databases involved you need to do a
mysqldump
before running the backup.Then to recover the database
mysql -p -u[user] [database] < db_backup.dump
and if the dump contains multiple databases you should omit the database name:
mysql -p -u[user] < db_backup.dump
Just all of it. But as mentioned above, if you use an SQL system, you need to backup databases in their own way (create a dump), and then exclude the DB data folders (such as /var/lib/mysql/) from the filesystem backup.
Thanks. I am using Postgresql, I suppose I need to backup it separately as well.
I am reading now the documentation.
pg_dumpall -w | gzip -c --rsyncable > backup.gz
If the database is really big, maybe try pigz for faster compression.
RAID1
I backup the empty bits of the drive; it's easier to compress.
This. Rather have a few GB of excess than forget something that requires me to manually create a few thousand things.
Everything
Storage is cheap, dirt cheap. You never know when you're going to need that one file someone accidentally deleted from that obscure directory for some unknown reason. Best to have everything ready and waiting
I usually grab
/etc
,/var
, and/home
. And as others have mentioned, databases have to be dumped separately. As part of a script I dump and compress them inside a /home directory so they're included in the larger backup file.If you separate your services in Linux Containers, you could stop the container and tar the whole thing. That would make restoring pretty easy.
edit: I also run
dpkg --get-selections "*" > /home/someuser/package-selections
so that I can easily install the same packages./etc and /home
@beagle @rm_ @seanho Is excluding the DB data folders necessary before performing a system backup or does not make any difference? Any idea by chance what to do with dokku-postgres? It only uses
pg_dump
.in addition borg will take good care of disk usage by deduplicating like hell :-)
Nothing I like living on the edge.
Just /home/porn
I usually just backup the entire VM apart from a couple of really large ones where it doesn't' make sense to do so.
For the workstation/home machine just the folders containing documents/anything I care about most of it is stuff that can be re installed easily so isn't worth backing up.
Everything except /usr/{bin,sbin}/,/dev/,/proc/,/sys/,/tmp/ (unless there's a good reason to),/run/,/mnt/,/media/,/var/run plus any folder tagged with CACHEDIR.TAG so that borg will automatically skip them with the --exclude-caches switch
/temp
Test your backups before trusting them, but if you have a full database dump backed up, the binary DB data directories do not also need to be backed up. Those are usually in /var, and you could reasonably exclude that from the backup. No harm in having both, though.
Don't forget to test out recovery from a disaster scenario; it's small comfort to have backups if you aren't able to use them promptly and effectively.
/mnt/winxp/TEMP /var/tmp /tmp /usr/tmp /usr/local/tmp /home/*/temp
/home
Customized bits of /etc (nginx/, php-fpm.d/, and more...)
mysql databases via mysqlhotcopy or mysqldump
/var/spool/cron
/media/porn
Arse.
You are fucked then.