LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can I copy a linux installation from a computer to another and expect it to work? (https://www.linuxquestions.org/questions/linux-newbie-8/can-i-copy-a-linux-installation-from-a-computer-to-another-and-expect-it-to-work-788672/)

the dsc 02-12-2010 08:20 AM

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?

reed9 02-12-2010 08:38 AM

Why don't you use a tool like clonezilla to clone your install and put it on the new machine?
http://clonezilla.org/

business_kid 02-12-2010 08:53 AM

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.

Samotnik 02-12-2010 09:08 AM

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.

the dsc 02-12-2010 09:31 AM

Thanks, I'm going to try clonezilla! :D 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 (Post 3861504)
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. :doh:

I hope with either clonezilla, a second mount, or something else, I can reduce this time to something viable.

Thanks everybody!

cantab 02-12-2010 02:02 PM

You could try the following:

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.

jefro 02-12-2010 03:07 PM

I would never recommend anyone to clone to anything but an exact system. Too many variables.

I will agree that is may work but if it doesn't is is a dickens of a time to figure out what went wrong.

I tend to use G4U.

the dsc 02-12-2010 04:31 PM

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.

Bratmon 02-12-2010 05:38 PM

I recommend you look at this.

the dsc 02-13-2010 08:07 PM

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).

Thanks everybody.

dooblem2 04-06-2014 12:26 PM

If of any help, I wrote a howto on that:
http://positon.org/clone-a-linux-sys...other-computer

JeremyBoden 04-06-2014 06:02 PM

<deleted>

business_kid 04-07-2014 02:39 AM

Quote:

Originally Posted by Business_Kid
Providing you're UPgrading, and not DOWNgrading, in the same processor type, then sure it should work.
Quote:

By "same processor type" you mean, something where I would use a i386 base install, rather than power pc or some other thing?
Never spotted that: I meant same as in ppc to ppc, intel to intel, or amd to amd.

A machine specific kernel ends up with things built in for chipset, & cpu. Switching amd to intel throws that, as the drivers are different.

Drakeo 04-07-2014 02:57 AM

check this out http://www.linuxquestions.org/questi...pc-4175499220/

lleb 04-07-2014 06:51 AM

Quote:

Originally Posted by the dsc (Post 3861931)
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.


All times are GMT -5. The time now is 07:15 AM.