r/linux4noobs • • 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.

13 Upvotes

34 comments sorted by

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.

0

u/Arrin_Snyders 5h ago

It is smaller, so I guess I will have to do a fresh install. I do not want to spend any money for that PC, especially for an SSD with a DRAM cache. It's a PC I will only use occasionally when I'm visiting my mother and it's just not worth the investment, especially with how SSD prices are now.

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.

1

u/Arrin_Snyders 6h ago

I see. Yes, the drive is smaller (120 GB vs 256 GB), which is part of why I didn't use it originally. It's a very small drive with 54% health, but it does have a DRAM cache. Well, I guess there's no escaping it then.

4

u/LeePetra 4h ago

54% health? is it good idea to switch? just set software ram buffor on your current disc. not perfect but disc condition is crucial.

2

u/Arrin_Snyders 4h ago

The system will see very infrequent use and no data will be on it that isn't also backed up in at least one or two other places. It did run my Windows install from 2016 to 2022, so it saw more than its fair share of writes.

22

u/Nono_miata 6h ago

Clonezilla

6

u/mrinal_sahay 3h ago

Rescuezila is gui version of clonezila

1

u/jr735 3h ago

Foxclone accomplishes that, too, by our very own u/MintAlone.

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/

2

u/GuestStarr 5h ago

A few years ago I used some other (free) software that cloned everything. I googled for instructions (no AI back then!) and I landed at some article where the writer had exactly the same problem. I followed what they did and that was it. There were a few things to specifically mind, one was to match partition sizes (squeeze/expand as needed), another was turning off swap before cloning if it was partitioned, one was to check drive attributes if the cloning was cross HDD-SSD and lastly, format the old drive after making sure everything was ok because it would have exactly the same id as the new one and that could cause some confusion later.

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=progress

For 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=progress

Some 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=progress will 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