• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

What is easiest way to backup linux config?

Red Squirrel

No Lifer
I normally just backup /etc /var /home and the entire data drive, usually /data or /raid.

I'm starting to have more specialized VMs with various setups that were complex to setup.

I doubt a direct copy of /etc would work as files vary from distro to distro then again if I install the exact same distro would a /etc copy actually work? Can permissions even be kept while backing up to a different system? As that is probably the biggest culpit, is permissions would get all messed up after a restore.

I had really bad luck with imaging linux boxes. Seems any slight change in disk hardware and the image wont boot properly.

What are other options I might be missing? The idea is to be back up and running as fast as possible so no screwing around for hours trying to guess that /sda1 magically changed to /sdb3 etc. That's the main issue I've seen with restoring linux images, often the drive "letters" will have changed if it's not restored to the exact same hardware (which is the case if I find myself creating a brand new vm).

Right now I'm just backing up files but should a disaster happen I'll be picking file by file from the backups until all my programs work properly, I want to be able to just do a straight copy, whether it's regular file copy or some kind of imaging process.

I suppose I could dd the drive, thats probably the only way to be 100% sure, but that would waste tons of space.
 
Are you keeping everything in virtual machines? I just take a snapshot of the virtual machine and then backup the snapshot files from the host.
 
I had really bad luck with imaging linux boxes. Seems any slight change in disk hardware and the image wont boot properly.

I've never had a problem restoring a Linux box from tarball into a VM even from real hardware.

 
Originally posted by: Nothinman
I had really bad luck with imaging linux boxes. Seems any slight change in disk hardware and the image wont boot properly.

I've never had a problem restoring a Linux box from tarball into a VM even from real hardware.

Yeah... Linux is far more forgiving then Windows when restoring images to new hardware, but even then so long as you don't change HAL's and use sysprep before you make the image you should be fine.

Are you custom compiling your kernels or something and taking out drivers because they aren't 'needed'?
 
Nope no custom kernels, I'm not THAT good at coding yet.

For taring, how does that go as far as permissions? ex: some config files line named have to be owned by named and be chmodded a certain way. If I use the option to preserve permissions is that all that's needed in tar? Does it save the owner by name or ID? Since if it's by ID is there a chance the ID of a user is different on a new build?

I did that already with a few servers I just have not tried restoring yet, so maybe that's my best bet.
 
Originally posted by: RedSquirrel
Nope no custom kernels, I'm not THAT good at coding yet.

For taring, how does that go as far as permissions? ex: some config files line named have to be owned by named and be chmodded a certain way. If I use the option to preserve permissions is that all that's needed in tar? Does it save the owner by name or ID? Since if it's by ID is there a chance the ID of a user is different on a new build?

I did that already with a few servers I just have not tried restoring yet, so maybe that's my best bet.

Compiling a kernel doesn't require any coding skills, it's fairly automated. The reason I brought it up is that a lot of people will recompile their distro's standard kernel to remove a lot of the unneeded drivers that come with the kernel, like Token Ring ethernet adapter drivers and stuff that the majority of people won't use anyways. In that process some people also decide to 'tailor' the kernel to their hardware, so they'll remove storage drivers, network drivers, video drivers etc that don't match their current hardware which is where you will run into problems. Nowadays the only thing having a smaller kernel with fewer modules will improve will be the initial read time for the kernel and modules and some disk space.

I believe when you preserve permissions it's going to be by UID/GID, but assuming you're including /etc/passwd /etc/group in your tar you shouldn't have any of those problems.
 
For taring, how does that go as far as permissions? ex: some config files line named have to be owned by named and be chmodded a certain way. If I use the option to preserve permissions is that all that's needed in tar? Does it save the owner by name or ID? Since if it's by ID is there a chance the ID of a user is different on a new build?

tar has been the defacto standard in unix backups forever, well some people like dump or cpio but they're weird, so yes it handles permissions just fine. It doesn't do POSIX ACLs but those are pretty rare. If the ID is different you'll have to fix the permissions or change the user's ID in /etc/passwd.
 
Originally posted by: Crusty
Originally posted by: RedSquirrel
Nope no custom kernels, I'm not THAT good at coding yet.

For taring, how does that go as far as permissions? ex: some config files line named have to be owned by named and be chmodded a certain way. If I use the option to preserve permissions is that all that's needed in tar? Does it save the owner by name or ID? Since if it's by ID is there a chance the ID of a user is different on a new build?

I did that already with a few servers I just have not tried restoring yet, so maybe that's my best bet.

Compiling a kernel doesn't require any coding skills, it's fairly automated. The reason I brought it up is that a lot of people will recompile their distro's standard kernel to remove a lot of the unneeded drivers that come with the kernel, like Token Ring ethernet adapter drivers and stuff that the majority of people won't use anyways. In that process some people also decide to 'tailor' the kernel to their hardware, so they'll remove storage drivers, network drivers, video drivers etc that don't match their current hardware which is where you will run into problems. Nowadays the only thing having a smaller kernel with fewer modules will improve will be the initial read time for the kernel and modules and some disk space.

I believe when you preserve permissions it's going to be by UID/GID, but assuming you're including /etc/passwd /etc/group in your tar you shouldn't have any of those problems.
Good point, I would be backing up those files too anyway. Guess that's what I'll stick to doing then is backup via tar and be sure I have the distro documented so I install the exact same distro in event of issues.
 
Good point, I would be backing up those files too anyway. Guess that's what I'll stick to doing then is backup via tar and be sure I have the distro documented so I install the exact same distro in event of issues.

Just backup the whole thing via tar, that'll save you from doing a reinstall before restoration.
 
Would that actually work? Don't some files such as /boot files need to be on specific location on the MBR for it to boot properly?
 
Originally posted by: RedSquirrel
Would that actually work? Don't some files such as /boot files need to be on specific location on the MBR for it to boot properly?

Nope, /boot is just another directory/partition on your harddrive. The boot loader is what gets loaded into the MBR, which then reads the /boot directory to get the kernel and boot.

So once you restore the system you would either boot it manually with an existing bootloader, or just reinstall grub/lilo into your MBR with your backed up configuration file.
 
Would that actually work? Don't some files such as /boot files need to be on specific location on the MBR for it to boot properly?

As Crusty says you may have to reinstall GRUB or LILO but that's simple enough.
 
Good to know. Think I'll backup all my systems this way just for the sake of consistency. If I can find myself a way to create a restore disk then even better but that's a whole other project. I'll just boot with a live CD and do it from there.
 
Back
Top