Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


What parts of the filesystem do you usually make backups of?
New on LowEndTalk? Please Register and read our Community Rules.

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

  • RhysRhys Member, Host Rep

    what's a backup?

  • i had this from someone/somewhere else, you can see what dirs its backing up.

    https://paste.ee/p/x1oyC

    Thanked by 2uptime llehirgen
  • 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

    Thanked by 3uptime llehirgen Falzo
  • rm_rm_ IPv6 Advocate, Veteran
    edited December 2017

    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.

    Thanked by 2uptime llehirgen
  • llehirgenllehirgen Member
    edited December 2017

    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.

  • @Rhys said:
    what's a backup?

    RAID1

  • I backup the empty bits of the drive; it's easier to compress.

  • jarjar Patron Provider, Top Host, Veteran

    @lemon said:
    /

    This. Rather have a few GB of excess than forget something that requires me to manually create a few thousand things.

    Thanked by 1llehirgen
  • 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

    Thanked by 1llehirgen
  • JustAMacUserJustAMacUser Member
    edited December 2017

    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.

    Thanked by 1ricardo
  • /etc and /home

  • llehirgenllehirgen Member
    edited December 2017

    @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.

  • @jarland said:

    @lemon said:
    /

    This. Rather have a few GB of excess than forget something that requires me to manually create a few thousand things.

    in addition borg will take good care of disk usage by deduplicating like hell :-)

    Thanked by 1llehirgen
  • 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.

  • mfsmfs Banned, Member
    edited December 2017

    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

    Thanked by 1WSS
  • seanhoseanho Member
    edited December 2017

    @llehirgen said:
    @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.

    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.

    Thanked by 1llehirgen
  • @Aidan said:
    /temp

    /mnt/winxp/TEMP /var/tmp /tmp /usr/tmp /usr/local/tmp /home/*/temp

    Thanked by 1Aidan
  • /home

    Customized bits of /etc (nginx/, php-fpm.d/, and more...)

    mysql databases via mysqlhotcopy or mysqldump

    /var/spool/cron

  • NeoonNeoon Community Contributor, Veteran

    /media/porn

  • @Neoon said:
    /media/porn

    sleddog@home:~$ ls /media/porn
    ls: cannot access /media/porn: No such file or directory

    Arse.

  • @sleddog said:

    @Neoon said:
    /media/porn

    sleddog@home:~$ ls /media/porn
    > ls: cannot access /media/porn: No such file or directory

    Arse.

    You are fucked then.

    Thanked by 1sleddog
Sign In or Register to comment.