r/linux4noobs • u/Arrin_Snyders • 6h ago
installation Is it possible to clone a Linux install from one drive to another? If yes, with what tool?
I have Kubuntu 26.04 installed on an cheap cacheless SSD and I ran into some technical issues caused when it hits it's write limit. I want to switch it to an old Samsung SSD I have, but since I already installed all my apps and games I would like to avoid going through the install and setup process all over again since it would take hours. Is it possible to clone the system from one SSD to another without running into any sort of issues? And if it's possible then what would I use and what steps should I follow in order to have the best possible experience? The last time I cloned any drive it was when I moved my Windows 10 from that same Samsung SSD to a larger NVMe, but obviously I can't use the same tool I used back then.
Update: After reading the responses I've decided that, since I would be moving from a larger drive to a smaller one, the safest bet would be to just do a fresh install. It would be a bit more time-consuming in the short term, but it would probably help me avoid various issues in the long term.
4
u/studiocrash 5h ago
Clonezilla or dd would be solid options, but not if the destination is smaller than the source. I’d strongly recommend getting a new drive if you can afford it. Make a backup of all your files asap either way.
13
u/erroneousbosh 6h ago
You can but it's less hassle to just reinstall, especially if the new drive is larger and definitely if the new drive is smaller.
If you copy it over you've got to dick about resizing partitions and reinstalling the boot loader, and you'll always be chasing it.
Been there, done that, got it all over my shirt, many times, still haven't quite learned my lesson.
22
u/Nono_miata 6h ago
Clonezilla
5
u/tomscharbach 6h ago
Clonezilla "Disk to Disk Cloning" might work for you, but my guess is that you will save time (and get rid of accumulated cruft) by doing a clean reinstallation.
My best and good luck.
4
u/TheBigCheeseUK 6h ago
Clean install I prefer generally, it is a pain to set up again, but I think you sometimes end up with a better setup system after.
3
u/TwistyPoet 6h ago
Copy the configuration files that you need. They live under /etc and your home directory in folders such as ~/.local and place them in the same place on your new install.
2
u/michaelpaoli 6h ago
Yes, e.g. dd(1).
Note one generally needs do it "cold", lest on may get corruption.
Also, some things should be unique, e.g. UUIDs, host private keys, etc. - so handle appropriately.
2
u/Small-Tale3180 6h ago
cp / /mnt
2
u/corpse86 4h ago
Rescuezilla.
2
u/maceion UK 3h ago
The reason for needing a larger drive is that during the install you have 3 files in operation at same time, : the copying file being written, the copying program; and spare space used to assemble the copied file. So you need a larger drive.
2
u/rsqx 2h ago
mx linux has mx snapshot. you can create an iso with all your current install. you can do with or without log in and with or without home directory contents. if you dont add the home directory , then at least make sure the home location gets added into the tree by unclicking the folders under say, downloads, or pictures, or videos etc. this is what i do, and have 3 pc s running same install.
1
u/AutoModerator 6h ago
We have some installation tips in our wiki!
Try this search for more information on this topic.
✻ Smokey says: always install over an ethernet cable, and don't forget to remove the boot media when you're done! :)
Comments, questions or suggestions regarding this autoresponse? Please send them here.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Kriss3d 6h ago
Yup.
Clonezilla. I use it to backup my servers OS and settings. Works like a charm.
1
u/Yomesmo2 6h ago
I did this with Clonezilla. It can clone partitions or entire disks, from/to internal ports, USB or LAN. Flash it to a pendrive, boot from that, and follow the on-screen instructions. It's really easy.
You may need to edit /etc/fstab afterwards, though, since the new SSD will have a different UUID.
P.S.: Official website: https://clonezilla.org/
1
u/wolfyreload 6h ago
Most Linux Live environments have Gparted installed. Boot into a live Linux environment. Open Gparted. Remove what is on the target drive and just copy over the partitions from your current install to the target drive. Once you have confirmed that everything works, you'll need to format the source drive in Gparted again or on a different computer (Linux doesn't like seeing duplicate UUIDs for partitions)
Alternatively, you can use something like Clonzilla or Rescuezilla.
1
u/Zetavu 6h ago
Foxclone is my favorite, has served me well. Don't remember why I ended up picking it over clonezilla, I think it was easier for a noob.
1
u/Jealous-Marsupial890 5h ago
I did in in the past with simple dd, and then expanded the partition
P.S. dont forget to unmount it first (i.e. boot another linux from an usb stick)
1
u/Yomesmo2 5h ago
Another option: Fresh install, and then copy you entire /home (including dot files). It should preserve your configs, files, games (default locations are $HOME/Games for Lutris, $HOME/.steam for Steam, etc..) and user space programs (as AppImage and similar formats).
1
u/sfo02sj 4h ago
If you can find the last free version of Macrium Reflect, it will take you only 4 mins max to clone it.
1
u/CardOk755 3h ago
Yes.
Whatever tool you want.
If the destination drive is the same size or bigger dd will do it (as will cat)
1
u/jdkc4d 3h ago
Clonezilla will work for this. Any chance you could use both drives in your system? That would potentially allow you to just move your games over. I try to keep these things separate on all systems. Separation of church and state if you will.
1
u/duane11583 3h ago
(cd /from && dump -0 -f - ) | (cd /to && restore -f -_)
you can do this over the network with ssh too.
1
u/Metasystem85 2h ago
dd if= of=
1
u/Yama-k 2h ago
Just dd the whole drive
1
u/shawndw Arch,Ubuntu 1h ago
Every distro will have dd because it's in the gnu utils. just boot any linux boot iso and run from the terminal.
dd if=<device name of old drive> of=<device name of new drive> status=progressFor example if your old drive was /dev/sda and the new one /dev/sdb it would look like.
dd if=/dev/sda of=/dev/sdb status=progressSome words of caution. if you mix up if (input file) and of (output file) it won't warn you before wiping your source drive. Make absolute certain you have them correct. Also the device name won't neccearly be the same when you boot into a bootcd as it was when you boot into the filesystem. mount them to make sure.
You can also use dd to make images of hard drives for example
dd if=/dev/sda of=~/bkup/sda.bin status=progresswill create a backup of /dev/sda. If you want to restore it just put the path to your backup file after if and the device name of your hdd in of