9

Two Elitebook HP laptops (different models) use the same type SATA drive. Ubuntu 16.04 was installed on laptop A. If it is transplanted to laptop B, can I expect it to work correctly if I haven't done any important modification to the default settings?

I realize that I can simply perform the transplant, however, it makes sense to pose the question to avoid any landmines and avoid wasting time.

gatorback
  • 5,785
  • 9
  • 40
  • 65
  • On a laptop which wouldn't boot from my USB stick or my CD I've installed Ubuntu on a external drive (keep an eye on where you write the MBR though...) and then build into the laptop: Worked flawlessly. – MadMike Jun 09 '16 at 07:12
  • 5
    Ubuntu is NOT hardware dependent like Windows is. Ubuntu has transplant powers. :) – ipse lute Jun 09 '16 at 09:14
  • 1
    @ipselute I have done HDD swapping with Windows XP multiple times across very different laptops. It takes it some time (and a reboot) to figure out you have extra CPU cores, and you need drivers for the new hardware, but otherwise the experience was rather smooth. – Dmitry Grigoryev Jun 09 '16 at 10:56
  • @Dmitry Grigoryev : No offense, but i tried the transplant thing a very long time ago (10+ years ago) with some very old IDE ATA hard drives, and it didn't work for me AT ALL. I even managed to fry up one IDE hard disk, transplanting it to a much higher ATA slot. Maybe this is possible with newer SATA drives. Don't really know, never tried it. – ipse lute Jun 09 '16 at 11:05
  • 1
    @ipselute None taken! And yes, my experience was with SATA drives, a few years back. – Dmitry Grigoryev Jun 09 '16 at 11:14
  • When performing the transplant, remember to wear your sanitary disposable gloves and scrubs. You don't want airborne viruses landing inside either while you're in there, so have a qualified nurse sanitize the area first – Canadian Luke Jun 09 '16 at 14:32
  • 2
    @CanadianLuke that's a poetic way to say "wear an antistatic wrist strap" indeed! – Volker Siegel Jun 09 '16 at 15:09
  • 1
    @ipselute - no offense, but Windows hasn't stood still since the "very long time ago" you last tried the operation. Try it now. – davidbak Jun 09 '16 at 19:37
  • Nobody has pointed this out in an answer so I thought I'd mention this here: Disable any form of whole disk encryption before you do this. (E.g., on Windows it would be Bitlocker.) The TPMs (and other hardware signature features) will be different (obviously) on the new machine. (*) "Any form" is too strong: E.g., TrueCrypt/VeraCrypt will still work as it doesn't use the TPM. – davidbak Jun 09 '16 at 19:42
  • 1
    @davidbak: Thanks, but no, thanks! I had so many bad experiences with Win in the past, i need it no more! Actually i still need it at workplace, and just because of God-damn specialized CAD software which doesn't have any decent equivalent in linux. Ubuntu (and some other linuxes) saved my ass multiple times, Win almost ruined me a couple of times. Viruses, malware, BSOD? No, thanks! – ipse lute Jun 09 '16 at 20:02

4 Answers4

15

Yes, you can take out the hard disk from one and insert it into the 2nd notebook.

1 thing you need to do before though: remove 3rd party drivers. There are probably 2 you need to check: drivers for your video card and your NIC. Re-install those drivers on the new notebook.

Both being HP -might- have them have the same hardware (or nearly the same) so it could work without removing 3rd party drivers.

Rinzwind
  • 299,756
  • +1 Your answer is probably better than mine. I over thought the question, but I'll leave my answer just in case. – Andrew Jun 09 '16 at 07:13
  • He can always clonezilla if he wants to use the disk in the system itself so +1 from me too ;-) – Rinzwind Jun 09 '16 at 08:27
  • There's no need to remove 3rd party drivers if they are loaded by udev. They won't get loaded if the hardware is not there. Whatever is in /etc/modules has to be adapted though. – Dmitry Grigoryev Jun 09 '16 at 10:58
  • but they will be on the system and it is always better to remove drivers you are not going to use. – Rinzwind Jun 09 '16 at 11:03
  • @Rinzwind by that logic you can remove 90% of your /lib/modules and /lib/firmware. Besides, I had a rather unpleasant experience with catalyst drivers I tried to remove: the uninstall script wiped a couple of important system files, and I had to reinstall the whole system. – Dmitry Grigoryev Jun 09 '16 at 11:15
  • No cuz those will be the same. 2 HP notebooks could have an nvidia or an amd cpu though ;) – Rinzwind Jun 09 '16 at 11:19
  • @Rinzwind there is a difference between files being the same and files being actually used. /lib/modules contains drivers for all hardware supported by Ubuntu, not only hardware you have. – Dmitry Grigoryev Jun 09 '16 at 11:27
  • I'd like to understand if Laptop A is using 3rd party drivers. Is there procedure (recommended URL) to 1) list drivers and 2) determine if it is 3rd party? Laptops have different brands of 1) video 2) wifi hardware. – gatorback Jun 09 '16 at 13:20
  • @gatorback open the menu item "additional drivers". – Rinzwind Jun 09 '16 at 13:26
6

Assuming you're using the stock kernel (with no dependency on particular hardware), and the CPU architecture is the same (x86, amd-64, etc), there's no reason why swapping the HDD would prevent Ubuntu from booting. Check /etc/modules and /etc/modules.d for any hardware-specific tweaks you may have done on laptop A which may cause issues when applied to laptop B.

I wouldn't bother removing any 3rd party drivers you had to install for laptop A hardware. Such drivers (e.g. AMD Catalyst) often don't cope well with package managers, so during the uninstall they can alter or remove files used by something else in your system. I have a first-hand experience when removing Catalyst from a Lenovo laptop resulted in a broken system.

Another kettle of fish you may want to check is Xorg configuration: if you had to tweak /etc/X11/xorg.conf to get hardware acceleration or multi-screen desktop on laptop A, those setting may prevent the X server to start properly on laptop B, and though your system will still boot you won't get the desktop environment you're familiar with. If your plan is to permanently transfer the HDD to laptop B, I'd recommend to simply delete /etc/X11/xorg.conf (making a backup beforehand) to let the X server do the autodetection.

I cannot foresee any issues that could arise from transferring the HDD from laptop A to laptop B.

Braiam
  • 67,791
  • 32
  • 179
  • 269
6

When Rinzwind mentioned the NIC it reminded me of a potential gotcha. There is likely a file /etc/udev/rules.d/70-persistent-net.rules. It "hardcodes" the first laptop's MAC address. So, in the second laptop a number of possibilities can happen. Either:

  • No problem (in a pure DHCP LAN where you don't care about what IP you're given)
  • No problem except that the NIC will be eth1 instead of eth0.
  • Problem where other things depend on the interface being eth0.

The easy fix is to sudo rm 70-persistent-net.rules and reboot.

Caveat: I'm basing this on Debian. Ubuntu may be different.

storm
  • 4,973
3

Yes you can clone one HDD to another. I used to do it all the time with clonezilla for work. You can download clonzilla for free at the link below.

http://clonezilla.org/downloads.php

Andrew
  • 797
  • 1
    I think here the intention is to move the hard disk from one to another system. So clonezilla is probably not needed :) – Rinzwind Jun 09 '16 at 06:56
  • 1
    Oh yeah you might be right. Well in that case gatorback, just take a phillips number 2 screw driver, swap the two hard drives, and see if it works. There isn't really any damage you can do. – Andrew Jun 09 '16 at 07:09
  • Clonezilla is awesome: essential for experiments because it reduces the time to restore a system. I posed this question before attempting to transplant because I wanted to do my homework and wanted to understand any potential issues. – gatorback Jun 09 '16 at 13:04