r/linuxquestions • u/Meri_Stormhood • 20d ago
Support Is cloning a linux drive (including OS, specifically fedora) safe? in the instance of transferring the contents to a different drive.
I am buying a new laptop and I need to transfer the contents of the old one, when I moved away from windows I had to copy manually anything I wanted saved, but I was hoping this is not the case with linux, is it? Or are there more efficient ways?
EDIT: Thank you all immensly for the help! I appreciate it a lot!
5
Upvotes
8
u/DroiidBro 20d ago
Cloning a storage drive to other it's normally safe, but be aware that the second drive preferably must be the same storage size that your primary or bigger. Mostly to prevent any issues with the partitions. (You can also try to shrink your original partitions first so that way you could clone it to a smaller drive or reduce the time of cloning specifying the max size the tool must clone)
13
u/Grand-Satisfaction55 20d ago
I prefer to do a fresh install. Keeps my system clean rather than having those apps that I installed and never used again from taking up space.
But Clonezilla will do what you are asking about. It doesn't destroy the data from the original drive so there's no harm.
4
u/ungabunga-engineer 20d ago
generally yes. boot into a live usb, use the lsblk and dd commands to clone one drive to another
3
u/Wally-Gator-1 20d ago
Is it safe: yes. Is it doable: yes. Should you do it: no, because the hardware and the drives identifiers will be different. Do a fresh install and move a backup of /etc (configs), /home directory and any directory with user content.
2
u/Klutzy_Cat1374 20d ago
A clean install and copying of the data over to the new drive will fix any broken things. Just don't use Windows to clone a Linux drive because it will 100% not work (easily). Clonezilla has always worked well for me. Keep your old laptop for a while in case Nvidia drivers break the new system.
2
u/No_Base4946 20d ago
It's probably easier just to do a clean install and copy any data over. It won't take long, assuming you've got both disks in the same machine. Just remove the "old" disk while you're installing in case of accidents.
Copying stuff across on the face of it makes sense but then you either have to resize the partition which is a pain to do or live with wasting a chunk of disk space, and you'll still need to play about installing a new bootloader. It's just neater doing a clean install from scratch.
1
u/absnotkinkyreggae 20d ago
i think it will work.
you need to fix the bootloader at the UEFI firmware. search that and i think you will be good to go.
Some settings might need to be adapted if your network devices change names, etc.
1
u/xXEMO_POTATOXx 20d ago
Yes it's safe I have done it several times I distro hop alot to find my perfect setup I have several 250gb sata m.2 drives but only like 2 nvme m.2 drives so I test what I want on the sata m.2 and when I find a good setup I might copy it over to the nvme m.2 using DD yes I copy my active drive to my nvme but has never caused an issue for me just let the copy finish before you do anything.
1
u/Just_Badger_4299 20d ago
Is Clonezilla (on a live USB) still a thing?
Otherwise, 'dd' is your friend. 😉
1
u/Confident_Dragon 20d ago
I've just copied the drive using
ddand checksummed everything, or just moved the drive. It was some time ago and it was Mint, but I don't see why things should be different. Maybe you'll need to fix bootloader or install drivers for GPU if you are migrating between Nvidia and AMD.1
u/nhermosilla14 20d ago
Clonezilla works great for this, but this kind of instance is usually a good chance to do some cleanup starting fresh. If you must clone the entire thing, though, either Clonezilla or Rescuezilla, both work just fine.
1
u/erroneousbosh 20d ago
It's considerably simpler just to do a fresh install and copy what you want over. You probably want a lot less of your old crap than you think.
I know because I have a moving crate of old hard disks going back 20 years.
1
u/dronostyka 20d ago
No, it can explode both computers half way
1
u/chuggerguy Linux Mint 22.3 Zena | MATÉ 20d ago
I've used different methods. When I had Windows I would occasionally image my Linux device with Macrium Reflect. I no longer have Windows but I still have the rescue ISO it allowed me to make. I haven't used it for a long time but it worked just as well imaging Linux as Windows and the image could be restored to another device, either larger or smaller I believe.
A lot of drive manufacturers provide free migration tools. (making the transfer smooth increases the chance you'll buy from them again?)
I've never used Timeshift to migrate to a different device but it sound like it should work. Just create a snapshot on a second device (USB perhaps) and restore it to the new device. I haven't personally tested that but... maybe.
(image also shows my old Macrium Reflect rescue ISO which is about 600MB)
What I do now (using a script) goes something like this:
rsyncfiles from each source partition to their respective target partition.chrootinto the target and make it bootable.Others have mentioned
clonezilla,dd, etc. Those are all good options, I'm just mentioning a couple more. I use Mint though; although I suspect they would be just as viable in Fedora, I can't say for sure.Good luck.
1
u/oshunluvr 20d ago
Yes, I've done this very often in a production environment.
1
u/corpse86 20d ago
Just take a look at Rescuezilla.
1
u/lnxguy 20d ago
Use Clonezilla. Super easy.
1
u/3string 20d ago
I've cloned boot drives before, or yanked a boot drive from one machine and thrown it in another. Linux mint doesn't seem to care lol
1
u/skyfishgoo 19d ago
did you consider just moving the physical drive from one machine to the other?
but if use foxclone or rescuzilla to clone the drive (assuming the new one is the same size or larger), then it should boot from the new drive as if nothing changed.
1
u/iHarryPotter178 20d ago
Just reinstall the os and copy your personal data over. Cleaner..
0
u/codeasm Arch Linux and Linux from scratch 20d ago
Its possible, but you better install a fresh copy of your os, you can make a installed softeare list on the old laptop, and try install these freshly on ghe new laptop and only copy config files, cooying your /home/[username] is supported and you can do so. Handy for most software and your customizations and configs. Maybe browser sessiosn/cookies and ssh keys transfer over fine too.
If home was a seperate partition, you could transfer it aswell.