Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
For those who dont have the time to go through all my ordeal, my question is simple. How can I clone a linux machine with tar (and not dd)?
Here is my story.
I needed to install 20-something machines with Linux (Redhat 9) and since they needed to have the same configuration, I decided to try to clone them instead of installing each separately. I googled for some pointers towards, didnt find any, so decided to take matters into my own hands.
I did the original installation with no problem, created four partitions [/, /usr, /home and swap, formatted with ext3]. After installing the machine just as I wanted it, i did a 'tar zcvpf' on / and /usr (i started the machine with a boot cd, mounted the partitions and then did the tar'ing). All was fine, until i started to clone the first machine.
In my mind, the procedure was simple. All I needed to do was create 4 partitions, and then untar the files on the corresponding partitions, do a grub-install and that was it. BUT NO!! The first problem I had was that unless the created partitions were the exact match (cylinder to cylinder) to the original, the machine will not boot (boot process stops with kernel panic). Though I feel st00pid, I created the exact partitions and did the installation and everything worked fine ... until yesterday (about 2 weeks from the day i did the installation).
The problem I have now is that on all machines, df -k shows that / is used only 1% (when in fact 20-something% is in use) and when i try to create a file (either touch or mkdir) i get a 'no space left on device'. If I reboot it i get a grub 117 error, and when i try to mount the / partition from a boot cd, i see that everything is corrupted. Now, I have to do the installation again ... unless someone points out the do's and dont's of machine cloning using tar.
Distribution: Slackware & Slamd64. What else is there?
I'm no expert but I just did something similar (but with one machine) with tar. Since nobody has replied yet I will tell you what I can but I am sure the guys know how to do it. I did use an unused partition to test it before I did the real thing.
I created a .tar.bz2 of each filesystem (I had less mount points than you, but the deal is the same) by tar -cpjf rootfilesys.tar.bz2 / for example. I burned this stuff to a CD which is what I think you said you did also.
I loaded a live CD and I fdisked and made new filesystems (not the same sizes) and then I changed directory (not chroot) into the root of the new filesystem. I did tar -xvjf /dev/cd/rootfilesys.tar.bz2. It restored all the files and then I was able to edit the fstab on the new system and chroot into it. Then I ran lilo, which could be a difference...lilo resolves the kernel stuff at lilo time, not boot time. I really don't know what grub does. I rebooted into my new system and then I built the other mount points.
I think it would help if you could show some doc because it's a little hard to see where you might have gone wrong. I know for sure that you don't need to have the same size filesystems (but of course it does need to be big enough to contain the extracted archive).
If these 20 machines of yours can really be set up exactly the same, then I would suggest looking at partimage. It does a nice job of making copies of partitions and even splits up the images to fit whatever media you have, if you want. The only thing is, the file systems have to be exactly the same size or bigger, *even* if the data doesn't require it. For example, let's say you have a 1GB root but it's only 25% full. If you use partimage you will only be able to restore this image to a 1GB or bigger partition, even though you have 750M of free space. That does suck, but it is very very nice if you have identical machines like maybe in your scenario. Because then you really can clone without too much pain. You will need a live CD to do the boot management unless you figure out how to use the MBR feature of partimage.