[SOLVED] What is the best way to back up a system?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Hi. I need to shut down a linux virtual machine on a remote server. The virtual machine will be deleted thereafter. But before I do, I would like to make an (iso) image of the entire system and burn it onto a DVD or ftp it to another machine. Can anyone tell me how to make the iso image Thanks
Ya, long story. Copying the VD is the easiest, but we need to send my host an encrypted HD for security reasons to store it, and that will take too long. Plus, their VD export is windows based, which is useless to us. So, I thought I would just remotely pack up the entire system and reinstall as an ISO at a later point.
I thought I could also just make a tar of the entire system. But when I am ready to recreate the system, an initial system would still be needed to be installed, and I didn't know if untar'ing the pre-existing system in it would overwrite the newer system and what other problems there would be (like updating grub). So, I thought the ISO solution would be better.
So, I thought I would just remotely pack up the entire system and reinstall as an ISO at a later point.
I thought I could also just make a tar of the entire system. But when I am ready to recreate the system, an initial system would still be needed to be installed, and I didn't know if untar'ing the pre-existing system in it would overwrite the newer system and what other problems there would be (like updating grub). So, I thought the ISO solution would be better.
And why would an iso burnt to a CD/DVD be any different ?.
There is no need to have an already installed system - just use a liveCD/USB to recover your system. But there will still be post-recovery work to do - grub, initrd, driver loading maybe. A lot will depend on the hardware at the other end.
FWIW I like to use fsarchiver - CRC checks the data, and is just a file you can ship any way you want - I just migrated this laptop onto a new harddisk using it. Piece of cake.
The ISO would not be burnt onto a DVD. I doubt with the MySQL data on it that it would fit onto one. The ISO would rather be transferred to another server, which would be available for download remotely for the host to reinstall it later down the line. When they create a new VM on their Windows environment, the ISO should just install the system as it was without post recovery work, I am assuming.
So far, genisoimage might answer my question. But I am open to additional comments.
i read the intention to make a bootable ISO for backup.
This would imply to have an operating system on it plus a boot loader (GRUB2, ISOLINUX) plus the necessary entry points for firmware (El Torito, MBR, GPT). It is questionable whether you can make the operating system on virtual hard disk boot from ISO. At least it will be expert work.
(I could help with ISO, El Torito, MBR, GPT, but not with operating system boot stages.)
And then you want to install your backuped OS onto a virgin disk. So you do not only need a ISO bootable OS but also installer software which can exploit the backuped files. This would be a big software project, i guess.
You could try to make a flat device copy of the hard disk (e.g. dd if=/dev/sda of=...pipe.out...) from within the running operating system on the virtual machine. This would give you at best a disk state like after a sudden power off. Additionally there may be inconsistencies of the file system because it is not backuped in a single snapshot while the system is running on it.
As with traditional backup of a running system, there may occur inconsistencies of file content and attributes between files which get coordinated by running software (e.g. data base files).
So sync before backup and stop as much disk activity as possible. Expect the need for filesystem repair and a thorough test of restored system for subtle damages. Have a traditional backup ready, too, for fixing larger mishaps.
Better would be to boot to rescue mode or to boot an OS from a different device. Then you could make an image of the properly unmounted virtual disk.
Such a device image should be usable with a local virtual machine or with a real machine which are compatible with the remote virtual machine.
Else you probably have to settle with the idea to first install a new operating system and to then pick what is missing from a traditionally backuped directory tree. (Like with flat dd, one should reduce disk activity in order to get as few inconsistent file states as possible.)
Don't use genisoimage - The resulting file could not be properly restored as most/all the metadata (ownership, access modes, acls...) will be discarded.
You should be able to boot to single user mode without a root (if nothing else use "init=/bin/bash", then use the tools on the initrd to restore your system. I believe the initrd include (at a minimum) cpio, and tar - but you can look to see which, then use that to make your backup.
I've once used the Export Appliance feature within virtualbox to make a backup of my virtual guest and then used the Import Appliance to restore it and everything was fine. The virtual appliance will have a .ova extension. You can also encrypt the .ova file using gpg, openssl, ccrypt or other command.
@ tearsforhari
Since you said, the usage of the export appliance is not suited for your needs, and you need an alternative. I do have a couple of suggestions:
If you had used LVM, you could have created snapshot(s) of each logical volume and then backup the mounted snapshots with tar or rar.
Another alternative is to rsync your '/' directory to a secondary partition on your virtual guest, to a directory on your host machine or to your online server.
1. Now, I wish check whether the tar worked by restoring it to a subdirectory. Is this possible? If so, what is the command. "tar -xvf" doesn't seem to work.
What I do is "cd the_directory; tar -xf /path_to_backup_file".
As long as the backup doesn't include the absolute path (as in starting the names with a "/") this works. You can easily check that with a "tar -vtf /path_to_backup_file" which will list the files (like a "ls -l" does). Not storing the leading "/" is the default for tar.
I've used this to move a system within a VM to a bare metal root filesystem.
The only requirement is to install the boot after restoring the system.
My bad; I just was too stressed out at the time, thinking that it might overwrite the existing system. The tar xvf worked in a subdirectory.
I assume if I restore in the "/" directory, the tar will overwrite all existing system files. Is this correct? As for restoring, I am wondering if any of the exclude directories would have to be handmade again by mkdir? Do I have to update2-grub before rebooting? Thnks!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.