What could possibly prevent me from detaching my current hard disk from the laptop and buy a new laptop, install the disk and resume from where I left? In other words, what prevents my current Debian 9 installation from being counted as portable?

  • If Grub entries are using solid references (UUID is the correct solution instead of /dev/sdaX or (hd0,1))
  • If the new laptop's CPU architecture supports my installation (x64 in this case)

The new laptop should boot up (and is booting in my case).

Drivers might be missing in the worst case, but my intention is creating a script called switch-to-new-hardware.sh which will install:

  • Graphics card driver (if it can, if needed)
  • NIC (eth, wifi) card driver(s) (if needed)
  • Sound card driver
  • ...

What should be taken into account while switching to new hardware?

closed as primarily opinion-based by Thomas Dickey, msp9011, schily, sebasth, maulinglawns Sep 2 '18 at 14:21

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You need to know upstream kernel actually ships with almost every driver you need and udev will create a beautiful /dev for you without your concern. – 炸鱼薯条德里克 Sep 1 '18 at 8:31

Beside what you have already mentioned, one which comes to mind is: an "initramfs" generated specific to your old laptop which does not contain all necessary stuff to boot any other system that might prevent you to just attach your disk to a new system.

But it's a rare case and if you have installed Debian using default options your "initramfs" is generic and contains all necessary elements.

or a customized Kernel for specific hardware which lacks drivers and modules to properly run all possible hardware.

  • +1 for mentioning potential optimized kernel issue, but there is either won't happen such a case or will be kept a generic kernel for such situations. – ceremcem Sep 1 '18 at 17:31

Lots of tiny details, if your grub works fine (which is easy to solve but has a huge direct can't boot impact).

If you use default settings for boot processes, then usually you're fine, since udev will load proper drivers for all kinds of devices, except for those super uncommon ones(not having a kernel driver installed on the disk).

Xorg need some sort of user mode DDX drivers provided by xf86-video-xxx, which is not installed for new graphic card.

The real hard to solve problem is configurations for upper layer applications, like you has a script with hard coded device names. Camera apps use hard coded camera device name. Network service use hard coded device names which doesn't exist any more or you no longer use wireless network anymore etc. Your IP changed, so some internet services may refuse to accept your cookies and require you to re-login.

Anyway, I think if you use default distro settings and successfully boot on your new computer, and Xorg works fine, you can shot not working anymore problems one by one, don't need to solve them until you find them.

PC is made of so many different parts mamufactured by so many companies, there's no neat solution to write a script to switch to new PC. You need to use portable configuration as possible to make your OS portable. That's how PC OS is designed.

  • If my applications don't written in such a portable way, yes, they might be broken on new hardware. I'll take those into account. – ceremcem Sep 1 '18 at 17:32

You can literally swap HDD/SSD in different laptops and Linux will work just fine. If NVidia GFX does not exist on different hardware - driver just won't use it. Thanks to Linux open-source generic drivers - even on new hardware you are not likely to face any issues.

My story: One night I've decided to test windows 10, so with this command I copied everything to my USB stick:

# rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/backup/folder

Then I installed windows, it was "mehh" and then I decided to restore my Linux set-up with the same command (just change directories):

# rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /path/to/backup/folder /

After that, all I had to do is:

  1. Update /etc/fstab to refer to the new partitions, since their UUID has changed after partitioning.
  2. Update/install grub. Not sure about this, but I did and it worked.

NOTE: If you have any scripts, where you wrote things like ethernet or wifi adapter names - you probably need to update them as well since they might change in new hardware.

Not the answer you're looking for? Browse other questions tagged or ask your own question.