r/linuxquestions • u/Relentless_Troll • 23d ago
Support Is it possible to move Linux to another drive without reinstalling it?
Several months ago I decided to give Linux a try since I've been very unhappy with Microsoft as a whole. I finally took the plunge after weeks of research, and gave Fedora KDE Plasma a shot in a dual-boot config with Windows, unsure if I'd stick with it. Now I find myself spending at least 90% of my time on my PC in Linux, and only booting into Windows for a handful of games I still enjoy that can only be played on Windows.
To make the dual-boot setup work, I salvaged my old 1TB Samsung SATA SSD from my old PC. This is now my only drive I'm using with Fedora. Since I like Linux so much, I now find myself kinda regretting that it's on the older, slower SSD while Windows 11 gets to enjoy the NVMe performance. So I began thinking, since I rarely boot into Windows these days, what if I temporarily nuked Windows off the NVMe drive, moved Linux over to the faster NVMe drive, and reinstalled Windows 11 from scratch on the old 1TB SSD?
My only question now is, is it possible to basically clone my Fedora install and essentially "copy/paste" it onto a different drive? Does it break stuff to try to do this? Do I need to reinstall all my programs? Do I need to redo all of my settings I've tweaked over the months? How does it work? What gets affected, if anything? I'd really rather go the route of just moving the OS and not reinstalling it.
EDIT: I also use the GRUB menu every time my PC boots in order to select from booting into the Linux kernels, and Windows. So how would moving the OS also affect the GRUB menu?
6
u/DickBrainTime 23d ago
Yes, you can move Fedora without reinstalling your apps or redoing your settings. The tricky part is the boot setup, not the files. Run `lsblk -f` and `findmnt /boot/efi` first: in a dual-boot setup the EFI partition might actually live on the Windows NVMe, even if Fedora itself is on the SATA SSD.
Back up both drives before wiping either. From a live USB you can clone/migrate the Fedora partitions to the NVMe (Clonezilla is one option if the target has enough room), but the EFI boot files/entry need to move or be recreated too. Disconnect the old SATA drive for the first test boot so duplicate partition UUIDs don't cause confusion.
Once Fedora boots independently from the NVMe, then reinstall Windows on the SATA drive. You may need to adjust UEFI boot order and GRUB's Windows entry afterward, but the Fedora applications and settings should remain. Posting `lsblk -f` and `sudo efibootmgr -v` output would help people guide the exact migration.
6
u/ephemeralmiko deca: ostree/bootc w. cinnamon 23d ago edited 22d ago
dd if=/dev/$oldSSD of=/dev/$newSSD bs=1M conv=noerror,sync status=progressreplace $oldSSD and $newSSD with their filepaths (e.g.
nvme0n1orsda, not single partitions likenvme0n1p3orsda3)Then use something like Gparted to stretch the main partition to fill the rest of the space if the drives are different size
Make sure not to mix up $oldSSD and $newSSD or your PC will overwrite your entire drive.
E: added status=progress
1
u/Alarming_Treacle578 23d ago
What you can do is save your desktop config and flatpak apps with the Flatpak app called save Desktop https://github.com/vikdevelop/SaveDesktop Backup all your files and do a fresh install. After the fresh install install Save Desktop and then just import the config and after about 10 - 20 mins, depending how many apps you previously had installed, your desktop will be as was.
1
u/michaelpaoli 23d ago
Absolutely, done it many times. Heck, VMs, I do it quite regularly. Thinking of which, even have VM that moves both drives, and physical hosts, live, easy peasy. So, yeah, not an issue.
Microsoft doesn't play so nice with other OSes. You may have better results (and Microsoft less likely to f*ck sh*t up), if you have the Microsoft installed on there first, e.g. (re)install it there first before adding Linux to the drive, or take the existing there, resize if/as needed, then move Linux there. Anyway, if you go that route, you can't simply just image copy your whole SSD to the NVMe, you'll need to do partition(s) properly, possibly resize, and may need to reconfigure (e.g. GRUB, /etc/fstab, etc.) bit to have that then all play reasonably nice together o the NVMe with both, and without the SSD.
You can mostly do that with Linux fine. But don't want to have duplicate UUIDs, nor duplicate host private keys, etc. on distinct hosts. So should adjust as appropriate on that, e.g. once copied, clobber them on the source if the source isn't going to be used anymore. Notwithstanding that, and the config bits I noted further above, can generally do cold image copy/clone fine, e.g. disk to disk, partition to partition, etc. as relevant.
Anyway, may be simplest and least troublesome in your scenario:
boot from ISO or the like, and do any relevant configuration fix-ups, e.g.:
(re)configure Linux if/as needed, e.g.
That's probably (about?) it, just sync && sync those changes, reboot, and if you got it all right, should be set. If not, well, e.g. boot that ISO again and finish fixin' up whatever needs be adjusted.
Oh, also, Fedora, defaults to using LVM, right (or maybe they don't even let you not use LVM?)? Yeah, that can actually make much of it quite a bit easier. Can even live migrate much of the data, rather than going the clone route - at least for the bulk of it.
2
u/chikamakaleyley 23d ago
i think you would... clone fedora onto the new NVME, install a fresh GRUB on the boot partition; Fedora generates a new grub config. I think Fedora might use fstab which is basically tells the OS what should be mounted when you start your system, so your new NVME has a UUID that you would need to replace and update the entry in fstab
aka the grub part you dont' want to clone
I think this is how it works, I've only used arch
2
u/corpse86 23d ago
Rescuezilla
1
u/seismicpdx 23d ago
Could be diminishing returns, but it will work if you execute correctly.
I moved my 2.5-inch SATA SSD from a 3rd Gen Intel into a 12 Gen Intel SFF, and it's fast as ****.
I only game with 0AD. This is my coding learning computer; Kubuntu, emacs, VS Code, terminals.
My point is it will be faster, but you may not realize how much or little you will gain. Consider doing some benchmarks before and after.
Be sure to do backups, including an rsync copy.
1
u/green_meklar Debian 23d ago
It should be. I've never actually moved Linux that way, but I've moved Windows that way, and it worked fine, and if anything, Linux should be easier.
Aside from a bit of extra SSD wear, this should work fine. You do need to make sure to clone the Linux drive as a bootable drive, switch the drive priority correctly in the BIOS, and potentially update your fstab.
Drive mappings, maybe.
There's also the issue that, if the Windows partition is currently larger than the entire Linux drive, cloning it onto the Linux drive becomes more complicated.
No. As long as everything is mapped correctly and the hardware is fully functional, it will just boot and work normally (except faster).
If I were doing it, I'd start by making a bootable Clonezilla USB drive. (In practice, I already possess one.)
If the Windows partition is larger than the entire 1TB SATA drive, you'll probably need to shrink the Windows partition first. Clear off whatever data needs to be cleared in order to get the entire filesystem usage small enough (under about 1TB in your case, but you'll want at least a few dozen GB of slack, too). Then use the Windows Disk Management Utility to shrink Windows's own partition down small enough to fit onto the 1TB drive (with the aforementioned slack).
Then turn everything off and boot to the Clonezilla drive. Clone the Windows partition to whatever third backup drive you're using. (Actually for this step you can just make a drive image and put it on the backup drive's filesystem, without having to reformat it, assuming the space is available and Clonezilla can recognize the filesystem.) Clone the Linux drive to the original Windows drive, making sure to make it a bootable drive and keep whatever extra partitions you need (EFI, possibly swap, etc). Finally, clone the backup Windows drive image to the 1TB SATA drive, again making sure to make it a bootable drive.
Shut down Clonezilla and boot back into the BIOS. Set the new Linux drive to the top of the boot priority order, if it isn't there already. Proceed with booting to the Linux bootloader. If the filesystems don't load properly, you may need to boot to a recovery drive (or to Windows, if that works) and edit the Linux fstab file.
At least, that's the theory. I haven't done this kind of stuff so frequently as to anticipate all the ways things might go wrong.
1
u/3grg 22d ago
Moving an install to another disk is possible. There are several things to consider. First, does the Linux disk have its own efi partition or does it use the windows one? If the Linux drive is independent of the windows drive, cloning the drive to another disk and then removing it is pretty straight forward with Clonezilla.
If the steps required to clone the drive seem too onerous, you are not alone. Since it is relatively easy to install a fresh copy of your chosen distro to a new drive and then copy data that you need from the old drive, many times people will just choose this path.
1
u/miscdebris1123 20d ago
Clonezilla
0
u/ThiccTilly 23d ago
Yes