Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My question is.. What's the best way to back up this system incase the upgrade goes horribly wrong? I have looked at dd and rsync but I am not sure how to use them in my case.
Setup:
Fc2 server
Needs to be backedup incase of failure
Not sure how to phrase this: But I need the back up to be a total system backup, all the rpms, files, users, etc. If the upgrade goes bad.. I need a way to put the server back together exactly as it was prior to the upgrade.
The FC2 servers are on a private subnet with a server available to store the backup data.
I am not a Linux guru, but I would use DD to create an exact image on a spare hard drive large enough to hold all of the data. Then in the event of problems that require you to fall back to the known good setup just connect that drive and reboot.
The problem is.. I just walked into this job and the person who previously maintained these servers isn't available to help me. I didn't set these servers up and I have no idea what the backup plan currently is. And I'm not really interested in having these upgrades go bad and not having my own plan for recovery.
For the first 2 servers I am upgrading, the harddrives are only about 2GB of data that needs to be saved, so I just changed to runlevel 2, ran a cpio command to back up the directories(etc,home,usr,var) into a tar file and moved the files to a different server.
Using dd, if say the HD is 40 GBs but only 2 GB is in use, would dd only copy the 2GBs of data does it write the entire 40GBs?
Also they are rackmounted servers with no CD/DVD drive. I guess I could take a USB CD/DVD and boot up using that..
Or you could pipe it through a compressor if size is an issue
Not if you want to dd it to a file, then be able to mount the file using:
Code:
mount -o loop,ro /mnt/backupDrive/old-partition.dd.iso /mnt/old-partition
If you mount the drive that way, you can browse and selectively restore files without having to worry about damaging your backup (it's mounted read only). For extra protection, change the old-partition.dd.iso file permissions and/or make it immutable:
If the partition has the patterns of deleted files on it, it won't compress very well. You can however use dd to create a file of null characters almost equal to the size of the drive, and then delete that file before using dd & bzip2 to backup and compress the image. Doing this you will get an image around 2GB in size instead of an image around 30GB.
Code:
example:
df /dev/sda6
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 59502428 23134872 33344928 41% /
> sudo dd if=/dev/zero of=/boot/zeros bs=1024 count=33344926
> sudo rm /home/zeros
The dd command can take a very long time to got through a large partition. From another shell (e.g. another pseudo terminal) you can enter "sudo kill -SIGUSR1 <dd pid>" where <dd pid> is the process ID of the dd command. Dd will then output on stderr of the first shell, the current progress. This allows you to track the progress in case you think there might be a problem. The SIGUSR1 signal is what you use in Linux. Another *nix may use another signal.
Agreed, but he's more likely to want to restore the whole partition, I don't think he'll be looking for a couple of lost files.
correct. I'd like to be able just to restore the entire system as it was prior to the upgrade. At least with the cpio command I have the files and I could just reinstall the OS and copy the DIRs over..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.