Can I copy a linux installation from a computer to another and expect it to work?
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.
Can I copy a linux installation from a computer to another and expect it to work?
I had a highly customized Debian Lenny install, somehow I had programs (most specifically, MyPaint, but there might be others, I'm in a almost fresh new install in which initially I had only the commmand line) that are not available for Lenny working there, but I'm not being able to make it again in a new install in a new (better) PC. So I have what is possibly the world's most idiot idea, simply copy the root (minus /media, perhaps also /var, but I'm not sure) partition from the old PC to a partition on the new PC, edit grub accordingly, and then I'd have my cherished install back.
In my most optimistic perspective I do not expect it to work perfectly, I'll obviously have to adjust fstab, user directories, and maybe eventually reinstall some packages that may not work in the newer hardware. I'd do some of that from another install I had on the target computer, I already have a partition I can use for the "transplant", I do not need to be as suicidal as to lose my current install on the new PC.
But... something like that has the faintest chance of actually working?
Providing you're UPgrading, and not DOWNgrading, in the same processor type, then sure it should work. I'm not guaranteeing, just thinking. I've done similar before. Get the 2 drives mounted, let's say on / & /mnt/tmp. Try something like
cp -a /{boot,bin,sbin,var,tmp,usr,lib,lib64,srv} /mnt/tmp && sync
mkdir /mnt/tmp/{proc,sys,media,mnt}
You had other plans for /home, I gather. If not, put it in the first line above.
For things like /var/log, I find it handiest to shorten the files this way
> /var/log/messages
which makes them zero length, but leaves them there.
Then scatter a few subdirs in /mnt, and you should have it copied over. The drivers will be wrong, the kernel might well be wrong, but it should throw up a console, and you can sort things from there.
You can do that, linux don't ties itself to hardware, as windows do.
To be able to boot in a new system, after copying make chroot in a new system, then install grub.
Thanks, I'm going to try clonezilla! I was already preparing to copy over the net, but I was not being able to do it via konqueror.
Quote:
Originally Posted by business_kid
Providing you're UPgrading, and not DOWNgrading, in the same processor type, then sure it should work.
By "same processor type" you mean, something where I would use a i386 base install, rather than power pc or some other thing?
Quote:
I'm not guaranteeing, just thinking. I've done similar before. Get the 2 drives mounted, let's say on / & /mnt/tmp. Try something like
cp -a /{boot,bin,sbin,var,tmp,usr,lib,lib64,srv} /mnt/tmp && sync
mkdir /mnt/tmp/{proc,sys,media,mnt}
You had other plans for /home, I gather. If not, put it in the first line above.
Home is already backed up. I didn't thought of making a second mount of root, I guess it will, (or would, since I'm going to try clonezilla) help a lot.
I was trying first to copy over the network with samba/konqueror, from symlinks, but it started asking the password a thousand times, never copying a single file, even though I added the samba user to the "root" group momentarily. Then I tried to first copy the main root partition folders to another disk, which was also having some troubles (maybe due to be running linux from there) and had also a 35 days for estimated time left.
I hope with either clonezilla, a second mount, or something else, I can reduce this time to something viable.
Thanks everybody!
Last edited by the dsc; 02-12-2010 at 09:32 AM.
Reason: tag
1) Take the drive out of the old PC and put it in the new PC.
2) Boot the new PC from a LiveCD.
3) Mount the partitions of the old drive.
3) Format the NEW drive. (Wipe the install you already had) Make sure you don't format the wrong drive! (Mounting the old drive is listed first because Linux will refuse to format a mounted partition)
4) Mount the new drive.
5) Copy all the data from the old to the new drives, as root, using the cp command with the -a option. So something like cp -a /mnt/old_drive/ /mnt/new_drive/
(note that the presence of absence of trailing slashes in the paths can cause slight issues, like ending up with everything in a subfolder in the new drive. but that's easy to fix)
6) Attempt to boot.
7) Go back into the LiveCD and fix your settings on the new drive so it can boot. Repeat steps 6 and 7 until you have success.
By pulling the old drive physically into the new machine, you avoid the hassle of networking, as well as making things faster.
Unfortunately I can't open my new PC, it's under guarantee. I guess I could take the new PC and the old hdd back in the shop where I bought it and ask them to install it, but it does not worth it all. That would be the easiest thing, I could just add the old hdd and leave it there, if the new PC has ide, and not only SATA, I don't even remember.
I couldn't make it with clonezilla. In the attempt I've lost grub, and I'm right now installing a ubuntu in the target partition to restore it (I couldn't install grub itself for some reason, but installs usually manage to do this right).
My last attempt will be remastersys, which allegedly turns you debian or ubuntu install into a live CD or DVD, and I guess it is installable also. I don't know if it becomes a "real" install or some Knoppix-like "fake" install. Either way, that will do the job for a while.
Thanks. The solution, or the closest thing to it ended being in fact remastersys. It worked almost perfectly, the most significant flaw was that it ignores the customized xorg.conf I had. But it will still possibly be useful to try to figure how I did the things I did in my previous linux install (RIP).
Unfortunately I can't open my new PC, it's under guarantee. I guess I could take the new PC and the old hdd back in the shop where I bought it and ask them to install it, but it does not worth it all.
unless this is a work computer or some kind of laptop, ive never heard of a warranty being violated by the OWNER, that would be you correct, opening their OWN HARDWARE.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.