Score:0

Backing up a simple Ubuntu server

in flag

I have a small server set up, and I'm quite new at this, so it took me around two days to get it all up and running the way I want. Now hopefully, I won't have any reason to make any changes to this thing for the foreseeable future, and I can just let it run. The reason I had to do this in the first place is because the last server we had died, and we lost all the configurations for it. So what I'm trying to do is get a semi-regular backup of the entire system, like a disk image type of thing, where recovery should be a straight forward process. The entire system takes up less than 20GB. I have a much bigger local NAS server that we can store the backups on.

I thought there would be a straightforward way to create disk images, but I'm a little lost in all the options. dd looks like overkill, and wouldn't running that once a week be really rough on the ssd drive that I'm copying?

The server has LVM set up, and it looks like making snapshots with this might be the right idea, but I'm still very confused how to do it, and how to turn those snapshots into useable backups stored elsewhere. If the disk is already set up with LVM (I used the defaults for installing Ubuntu server), is it safe for me to start creating logical volumes, or do I need to do a backup before I uh... start making backups? Then once the snapshots are created, I'm unsure how to actually turn that into a backup file, that can be stored elsewhere. My instinct says I can use dd for that, but dd scares me, and I really don't want to screw anything up since the server is running really smoothly now.

If anyone can give me some straightforward instructions how to create a simple backup (hopefully with LVM) of the entire drive (or whatever it takes to be able to quickly restore the machine to exactly the setup I have now) and store it on a server (preferably through samba), it would be very much appreciated.

cn flag
Ray
I can't help you with making snapshots. I personally use `rsnapshot` to make periodic backups. Instead of making a backup of programs, I'd backup personal files in `/home` and the configuration files in `/etc`. If something were to crash, I'd honestly re-install Ubuntu and then put the `/etc` files back. Indeed, this isn't as easy as a snapshot. I do have snapshots for `virtualbox`, but I doubt you'd want to run Ubuntu within Ubuntu.
EricEDFilms avatar
in flag
I guess my fear is that some aspects of the confusing setup I did will not get saved if I just copy /home and /etc... like user permissions and which programs are installed, with their complex configurations. Can that all be recovered easily by saving a few top level folders? Thanks for the response.
cn flag
Ray
`rsnapshot` should be set up using the root user's account. (Actually, it should run as the root user's `cronjob`.) So, the files are copied while retaining the permissions of the original. If you need to restore from backups, then you just need to copy them back as well. I suggest you try setting it up (or any of its other alternatives) and let it run and see if the result satisfies you. That is, if no one else gives you a better answer about performing a snapshot (which, again, I can't help you there...sorry!).
EricEDFilms avatar
in flag
Ok, `rsnapshot` might be a good alternative. When the hard drive eventually dies, I don't mind reinstalling Ubuntu, as long as restoring everything afterwards is simple. Can `rsnapshot` use a mounted smb share as a destination for the backups? Are there specific directories I should include or exclude from the backup if I want to preserve pretty much everything?
cn flag
Ray
I guess [this](https://help.ubuntu.com/lts/installation-guide/armhf/apcs02.html) will help you decide? Certainly `/etc`. If you installed programs locally, then they'll be in `/usr/local`, but since you did it manually, presumably you can do that again. And yes, you can backup to any partition that is mounted. You can even backup to a [remote](https://www.thegeekstuff.com/2009/09/linux-remote-backup-using-rsnapshot-rsync-utility/) host. I don't think you should stress out on deciding on one program now. Instead, try it and see. If it isn't for you, try something else...
EricEDFilms avatar
in flag
Ok, I'm going to try it out. Thank you. Are all of my samba configurations such as users and shared folders stored in `/etc`? What about the mounted folder that connects to the NAS server, will that be preserved in `/etc`?
EricEDFilms avatar
in flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/128760/discussion-between-ericedfilms-and-ray).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.