LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 03-02-2013, 01:55 PM   #1
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,068

Rep: Reputation: 321Reputation: 321Reputation: 321Reputation: 321
Question: Pick up and move Linux from one hardware to another?


Every now and then I get a wild and stupid idea, like this one.

What is the feasibility of moving a Linux installation to a new piece of hardware? Obviously, things change like the Mobo, chipsets on the Mobo, integrated video/audio/LAN, number and size of disk drives, amount of memory, etc.

I was thinking doing a most basic install of the identical OS, LinuxMint 13 XFCE in my case, on the new hardware, and then copying (selectively) the filesystems/files from the old installation over to the new. I'm not just talking compying my personal files - that is standard for any new computer. I'm thinking about moving all the installed apps - some from repos, a few compiled locally (none compiled "against the kernel" however). The biggest change is probably the processor itself - from an Intel Celeron on the old to an AMD Athlon dual-core on the new. However, both are x86 compatible and I am using a standard kernel not something I locally tuned and compiled.

I don't NEED to do this, and I know it would be better and certainly faster to just build the new system from scratch. I was just speculating if it would be a fun thing to attempt, for entertainment/learning. Or is it just "stupid, stupid, stupid"? I'm experienced with Linux, command line more so than any specific distro or GUI, I just haven't pursued a silly play/learning experience like this before. Is it too off-the-wall to even consider?
 
Old 03-02-2013, 03:39 PM   #2
lykwydchykyn
Member
 
Registered: Mar 2006
Location: Tennessee, USA
Distribution: Debian, Ubuntu
Posts: 135

Rep: Reputation: 36
It's not off-the-wall; I've done this many times to rescue a system from hardware failure, clone a system, or just save myself the trouble of reinstall.

Modern linuxes pretty much auto-detect everything so you don't have to worry about drivers and so forth, unless you've created (for example) a custom xorg.conf or /etc/modules or something.

The big things you have to worry about in this case are:

- you will have to set up the partitions more or less like they were, or manually rebuild the fstab (Guess which is easier?)
- you'll need to install GRUB on the new system, probably by booting do a live CD of some kind.
- If your fstab uses UUIDs to identify the disk partitions, these will change. The easiest thing to do is clear out the UUID stuff and just use /dev/sda* type notation.

I don't think the processor makes a difference. It's not like Windows XP where you've got a specific HAL installed; I've moved hard drives with Linux installed between AMD, Intel, Xeon, etc. without any issues there.

Give it a shot, you've nothing to lose.
 
Old 03-02-2013, 08:57 PM   #3
jefro
LQ Guru
 
Registered: Mar 2008
Posts: 13,334

Rep: Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690Reputation: 1690
The official way is to properly install a new OS on the new system. That was required for decades.

Due to the way most modern distro's work, you can usually attempt a switch. In more and more cases it works correctly. You will see some posts here where once in a while it fails and it becomes quite difficult for newbies to fix.
 
Old 03-02-2013, 10:45 PM   #4
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 320

Rep: Reputation: 57
Do some minor tweaks and move the drive or a clone to a new machine. I have done this on a few occasions. It certainly works much better than on a Windows system. You can clone the drive using dd or rsync. I found this useful for an older PC without an optical drive or a USB boot option: Use a computer with an optical drive, install OS and then transfer the install drive to old computer.

The steps needed before you boot the system in the destination PC is:
1) Edit /etc/fstab: use 'blkid' to get the correct UUIDs for fstab (only if the drive is not a 1:1 clone)
2) Network: Edit /etc/network/interfaces if you are using static ipv4 addressing and are still using the old PC
Edit /etc/udev/rules.d/70-persistent-net.rules (or similar) - delete the line that contains NAME="eth0"
3) Bootloader: if you did not clone the MBR (ie by just copying /dev/sda1 with rsync) you would need to install grub with update-grub & grub-install

Regards,
Stefan

Last edited by propofol; 03-02-2013 at 10:46 PM.
 
Old 03-04-2013, 05:32 AM   #5
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 545

Rep: Reputation: 105Reputation: 105
I had Ubuntu 7.10 or 8.04 when i changed my ASUS M2V-TVM board in a M3N78-VM and the change was straightforward - just put the hdd in, power on.
I have a Debian installation on 2 HDDs that i moved from the ASUS M3N78-VM mobo to a Gigabyte F2A85X-D3H.
Since i used the same hdds, just put the hdds in the new system, uninstalled the Nvidia drivers, installed the AMD video drivers. Thats all.
Previously i did test for a couple of days some ASUS AM3 and ASUS FM1 boards with the same 2 hdds and worked just aswell.

So, no (other than video) driver setups were required, only that i changed the network adapters notations in udev (this isnt mandatory though). And i had to use (already did) a newer kernel for the Gigabyte board because of the onboard audio.

Never had any Windows like bluescreen-type issues with Linux. The closest thing is to forget to change the video driver and X wont run (if propriertary drivers are used, from different vendors), but that easily manageable on Linux since you still have the console.
 
Old 03-04-2013, 08:06 AM   #6
goumba
Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian Jessie (8) and Sid (unstable)
Posts: 745
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
Quote:
Originally Posted by lykwydchykyn
If your fstab uses UUIDs to identify the disk partitions, these will change. The easiest thing to do is clear out the UUID stuff and just use /dev/sda* type notation.
Quote:
Originally Posted by propofol View Post
1) Edit /etc/fstab: use 'blkid' to get the correct UUIDs for fstab (only if the drive is not a 1:1 clone)
To avoid the problem again in the future, why not just give the partitions a label
Code:
tune2fs <device> -L <new label>
and use the disk labels in /etc/fstab:

Code:
/dev/disk/by-label/<label>
UUIDs can change when formatting, and even device names can change when moving system to system. A label seems more static and less error prone to me (although in itself subject to clash if too simple of a name is used).
 
Old 03-04-2013, 11:46 AM   #7
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 545

Rep: Reputation: 105Reputation: 105
Drive device names (/dev/sdX) hardly change randomly. Just observe the drive order in/on the original BIOS/mobo and replicate it in the new system. They will be the same. UUIDs dont change at all AFAIK if you dd partitions.

The thing that will surely change is the ethernet device name, but its easily corrected in /etc/udev/rules.d/70-persistent-net.rules file (again, this is on Debian, other distros might have other names).
 
Old 03-04-2013, 11:54 AM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,487

Rep: Reputation: 626Reputation: 626Reputation: 626Reputation: 626Reputation: 626Reputation: 626
This topic has recently been discussed here:
http://www.linuxquestions.org/questi...os-4175450359/

jlinkels
 
Old 03-07-2013, 12:13 PM   #9
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,068

Original Poster
Rep: Reputation: 321Reputation: 321Reputation: 321Reputation: 321
The move turned out to be trivially easy. The destination disk was installed in a second computer and already had grub installed in a small first partition for /boot, and was bootable via a copy of SysRescueCD installed on the second partition. I use this setup on every hard disk I have, whether I ever intend to boot with it or not. That way I can move the disk to any computer and be up and running with it in no time using its installed grub/SysRescueCD.

On the destination computer, I created a small third partition for swap and a fourth for the moved OS. mkfs -t ext3 on the fourth partition. mkswap on the third. The destination layout now matched the source layout except for partition sizes (although that "matched" part was just coincidence - I could have easily changed things in fstab if needed). Then I booted the source computer from its copy of SysRescueCD installed on its hard disk. Now, both computers were running SysRescueCD to avoid anything trying to mess with the OS partition while I was copying. Did the transfer like this:

# As root. On the source computer, OS was in sda4
cd /mnt/sda4
tar -czpsf - . | pv -b | nc 192.168.0.3 3333

# As root. On the destination computer, where I was putting the OS into sda4 there also (coincidence)
cd /mnt/sda4
nc -l -p 3333 | pv -b | tar -xzpsf -

Took about an hour to move 11Gb because the source computer has a slow network card installed.

Because I just happened to be using sda3/sda4 for swap/OS on both the source and destination computers, I did not have to modify /etc/fstab (it was already using /dev/xxx notation, not UUIDs). All I had to do was add a new choice to grub's menu.lst on the destination computer to boot the new OS, and that was it.

Didn't have to mess with network settings since I use DHCP (in the router is where I configure specific IP's to MAC addresses, so I get the benefits of static IPs while still using DHCP on the computers).

I initially undertook this OS transfer just for the learning experience. But by doing it, and seeing that it worked so flawlessly, I now have a more powerful computer as my main desktop. The old source computer (my previous desktop) will now take on the fileserver role that the destination computer was previously doing. I just swapped their two roles.
 
Old 03-07-2013, 12:32 PM   #10
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 291
Blog Entries: 7

Rep: Reputation: 43
Deffinitley feasible.....especially since you did it! It might've been simpler just to move the HD though.

Last edited by Nbiser; 03-07-2013 at 12:35 PM.
 
Old 03-07-2013, 01:51 PM   #11
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,068

Original Poster
Rep: Reputation: 321Reputation: 321Reputation: 321Reputation: 321
Quote:
Originally Posted by Nbiser View Post
It might've been simpler just to move the HD though.
Wouldn't have learned anything that way. Not that there was much learning that happened anyway - since "it just worked". However, the move from an old off-brand 40Gb 5400 rpm drive to a newer Seagate 200Gb 7200 rpm one was probably worth it. Since my personal files (photos, videos, music, documents) are stored on a seperate fileserver, 200Gb is plenty for my desktop system even though that seems really small these days.
 
Old 03-07-2013, 02:46 PM   #12
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,487

Rep: Reputation: 626Reputation: 626Reputation: 626Reputation: 626Reputation: 626Reputation: 626
It is definitely right to do it with tar and nc. Copying on the file level is for me the best way to clone an installation.

However, you should have excluded /proc and /sys file systems, as they only take up space and transfer time.

And furthermore what usually happens to me is that I make a few changes on the source before I finish the process and have to resynchronize. Therefor I prefer rsync for the process.

As root:
Code:
rsync -auv --exclude='/proc' --exclude='/mnt' --exclude='/sys' / host.destination.net:/
And don't forget to disable ssh root login at the destination after copying.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
When buying new hardware, should I only pick hardware with linux drivers? necromancer44 Linux - Hardware 4 04-13-2010 04:36 PM
Move SUSE Linux to new Hardware Noddy53 Linux - Newbie 2 09-24-2009 04:34 PM
LXer: The move to Linux, stymied by hardware LXer Syndicated Linux News 2 02-05-2009 03:24 PM
Trying To Pick Distro's That Will Work W/My New Hardware RedSyphon Linux - Distributions 3 02-18-2007 05:08 PM


All times are GMT -5. The time now is 03:24 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration