LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-19-2007, 09:44 AM   #1
yumener
Member
 
Registered: Oct 2005
Posts: 63

Rep: Reputation: 15
best way to clone a Linux system


Hi There

I am wondering if what is the best way to clone
a Linux system from one computer to another computer.

Suppose I have computer A which I have used for
a long time and some non-standard software installed.
I now switch to computer B temporarily. I donot
want to install a band-new Linux on B since that
means I have to configure it and installed some
software again.

by the way, I can move the harddisk from A to B.

I guess most of the problems will be with the
hardware driver such as sound card, video card.
How can do with it?
 
Old 02-19-2007, 01:36 PM   #2
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Are both PC's *exactly* the same (same mobo, same chipset, same video card, same sound card, same hard drive, etc, etc, etc)? The main issue is that all the configuration work you've done for machine "A" is based on the particulars of that machine. If there are any differences, you will probably run into problems. Example: If "A" is using a really powerful, top of the line video card, and is attached to a monitor running 1280x1024@80Hz, but "B" has an older, weaker video card, and is attached to a monitor running 1024x768@60Hz, then clearly A's xorg.conf would be incompatible on B.

If you need to run Linux on "B", have you considered just using a Live CD such as Knoppix?

Lastly, with regards to moving the hard drive from A to B, Yes, it can be done (I've done it plenty of times myself) but again you need to be aware that it's not guaranteed (due to the fact that the machines may be using different hardware components and thus there may be some reconfiguration work necessary)

Good luck with it
 
Old 02-19-2007, 02:22 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
You might also want to check out Mondo at http://www.mondorescue.org/. It excels at that sort of thing. It can also handle *some* hardware differences, but the closer you are to a 'clone', the better you'll be.

FWIW, I've used Mondo to move from a single-drive IDE system to a hardware RAID-5, different NIC's, etc. It does work, but you will have to know about what kernel modules you'll need, how to load them, etc. It's not totally painless, but it can be done.
 
Old 02-19-2007, 02:32 PM   #4
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
On several occasions I've been able to copy a Linux install from one computer onto another hard drive, which then goes in another computer, simply by doing a cp -a of all the system files on the original system, and then booting the new system from a floppy and reinstalling the bootloader.
 
Old 02-20-2007, 02:15 AM   #5
FredGSanford
Senior Member
 
Registered: Nov 2005
Location: USA
Distribution: Mageia 7 - Debian 10 - Artix Linux
Posts: 1,142
Blog Entries: 5

Rep: Reputation: 207Reputation: 207Reputation: 207
Awhile ago, I had installed Fedora Core 6 onto an ext. usb hard drive and never got it to boot from the usb drive. Machine A.

Recently I finally figured out how to boot by adding usb drivers to the initrd file. When I finally booted on Machine B. it came up but I could some issues with it. Alot may need to be done to get it a good working order. The best thing now is for me to reinstall it and go from there.

Just a thought!
 
Old 02-20-2007, 03:10 AM   #6
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
Depends on hardware and distro (especially the kernel config).
Normally just about any decent distro should at least boot to a terminal - provided fstab is ok and there is a bootloader.
x is another story but not such a big deal either.
 
Old 02-20-2007, 04:21 AM   #7
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
A and B have different hardwares.

after reviewing all your suggestion, I decide to do like
this. On machine B, I will install the same distro Linux
firstly. This is to make sure the hardware is not a
problem. Now I move the harddisk of A to B. Since the
home directory on A is separate from /, I can just
leave it and mount it on the new system. but I need
to copy those files related to software from A to B.
I am not sure which directory I should copy. Here
is a list of all the folder under the / directory
of A.

====folders under / on A====

bin dev lib misc opt sbin sys var
boot etc lost+found mnt proc selinux tmp win_data
data home media net root srv usr

====folders under / on A====

I guess these folders need to be copied to the new root
directory on B,

bin lib sbin
selinux
root usr

I am not sure about /root, under this directory there are
files like this
====
anaconda-ks.cfg Desktop install.log.syslog upgrade.log.syslog
boot.iso install.log upgrade.log
====

since I have upgraded from FC4 to FC5 before.

How about my plan?



Quote:
Originally Posted by J.W.
Are both PC's *exactly* the same (same mobo, same chipset, same video card, same sound card, same hard drive, etc, etc, etc)? The main issue is that all the configuration work you've done for machine "A" is based on the particulars of that machine. If there are any differences, you will probably run into problems. Example: If "A" is using a really powerful, top of the line video card, and is attached to a monitor running 1280x1024@80Hz, but "B" has an older, weaker video card, and is attached to a monitor running 1024x768@60Hz, then clearly A's xorg.conf would be incompatible on B.

If you need to run Linux on "B", have you considered just using a Live CD such as Knoppix?

Lastly, with regards to moving the hard drive from A to B, Yes, it can be done (I've done it plenty of times myself) but again you need to be aware that it's not guaranteed (due to the fact that the machines may be using different hardware components and thus there may be some reconfiguration work necessary)

Good luck with it

Last edited by yumener; 02-20-2007 at 04:22 AM.
 
Old 02-20-2007, 01:12 PM   #8
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
If you are going to install Linux on B, then the only directories you need to copy over will the ones that contain your data -- there is no need to copy the system directories (ie, anything that is not /home or other directories you've created yourself) because they will already be present on B (as a result of installing Linux on it)

In terms of transferring the data, if you move the hard drive from A to B, you could just run a "cp -R" (recursive copy) command to move the data from A's /home to B's /home. Regarding your specific question about copying log files and so forth, I don't think there would be a lot of point to it, since there were not generated on B and therefore have no value.

Again, all of the comments/suggestions in this thread so far are valid, and I think that any of the approaches would work to achieve your goal.
 
Old 02-21-2007, 04:44 AM   #9
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
Just a quick note, but cp -rp or cp -a might be a better option than just cp -r, as you probably want to preserve permissions on the files you're copying.
 
Old 02-21-2007, 05:31 AM   #10
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
the thing is I have installed some software in the past
year on A, I do not want to re-install them again on B.
This is the reason I want to copy /usr.

among the suggestion above I have especially notice the
clone approach. I am just wondering if the clone approach
solves the conflict brought about by hardware?



Quote:
Originally Posted by J.W.
If you are going to install Linux on B, then the only directories you need to copy over will the ones that contain your data -- there is no need to copy the system directories (ie, anything that is not /home or other directories you've created yourself) because they will already be present on B (as a result of installing Linux on it)

In terms of transferring the data, if you move the hard drive from A to B, you could just run a "cp -R" (recursive copy) command to move the data from A's /home to B's /home. Regarding your specific question about copying log files and so forth, I don't think there would be a lot of point to it, since there were not generated on B and therefore have no value.

Again, all of the comments/suggestions in this thread so far are valid, and I think that any of the approaches would work to achieve your goal.
 
Old 02-22-2007, 10:03 AM   #11
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
If you've installed exactly the same version of Linux on both computers, you should be able to copy the installed programs by doing a cp -a of the contents of /usr, /var and /etc. However, there may be certain programs that also have files installed in other locations, in which case they will not work properly. Generally I find it best to copy the whole filesystem. As to whether this will allow you to get round hardware conflicts, luck plays a part. In the past, I have managed to copy a Ubuntu system onto a different hard drive, and then boot the hard drive on a new (different) motherboard to the one it was originally installed on. I've also managed to copy a Slackware system, which was installed in several partitions across several drives, onto a single partition on a new drive, which was then put into another computer with a different motherboard, optical drives, peripherals, etc, to the original install. In both these cases the transition caused no problems, all that had to be done afterwards was to reinstall grub. However, your mileage may vary, and if the CPUs in the computer are different types then it definitely won't work - by different types I mean things such as SPARC vs. x86. Different x86 chips should mostly be compatible, in the Slackware upgrade I mentioned, the original install was done on a Pentium II, and the new system used an Athlon XP, which didn't cause any problems.
 
Old 02-23-2007, 12:37 PM   #12
yumener
Member
 
Registered: Oct 2005
Posts: 63

Original Poster
Rep: Reputation: 15
thanks for sharing your experience with me.


Quote:
Originally Posted by Gethyn
If you've installed exactly the same version of Linux on both computers, you should be able to copy the installed programs by doing a cp -a of the contents of /usr, /var and /etc. However, there may be certain programs that also have files installed in other locations, in which case they will not work properly. Generally I find it best to copy the whole filesystem. As to whether this will allow you to get round hardware conflicts, luck plays a part. In the past, I have managed to copy a Ubuntu system onto a different hard drive, and then boot the hard drive on a new (different) motherboard to the one it was originally installed on. I've also managed to copy a Slackware system, which was installed in several partitions across several drives, onto a single partition on a new drive, which was then put into another computer with a different motherboard, optical drives, peripherals, etc, to the original install. In both these cases the transition caused no problems, all that had to be done afterwards was to reinstall grub. However, your mileage may vary, and if the CPUs in the computer are different types then it definitely won't work - by different types I mean things such as SPARC vs. x86. Different x86 chips should mostly be compatible, in the Slackware upgrade I mentioned, the original install was done on a Pentium II, and the new system used an Athlon XP, which didn't cause any problems.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing O/S reported when booting the clone system disk. hg7688 Linux - Software 2 07-26-2006 03:56 PM
clone system call swadesh Linux - Software 0 02-07-2005 12:39 PM
how to clone a Red Hat 9 system (870 MB) with all the partitions (/ and swap) dravya Linux - General 3 05-07-2004 06:42 PM
how to clone reiser file system mikmok Linux - General 3 02-18-2004 12:11 PM
using ghost 7.5 to clone linux system yin_howe_ho Linux - General 1 07-09-2003 10:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration