Experimental raspios Linuxcnc Trixie images.

More
29 Jan 2026 01:01 #342116 by unknown

Please Log in or Create an account to join the conversation.

  • NWE
  • Away
  • Premium Member
  • Premium Member
More
29 Jan 2026 07:57 #342147 by NWE

How do I create an image of the contents of one hard drive to install it on another? This is to avoid having to reinstall the additional applications I use with LCN.

There are various ways clone hard drives, I tend to use dd and make a bit-for-bit clone of the entire drive. Empty space and deleted files included. Takes longer but is the most reliable solution I've found.

The first time I did this was on a test machine containing no valuable data so I don't inadvertently destroy it. A little mistake in the following instructions could wipe your hard drive empty.

Important: the pc doing the cloning must not be booted from either drive; also, do not try booting the original or the clone while BOTH are connected to the pc. I learned that the hard way. Both drives' partitions will have identical UUID's which can be changed but it works as long as you don't boot one while both are connected to the same pc. I wouldn't even try mounting a partition while both are connected. Don't bother trying to clone nvme -> sata or sata -> nvme. I think it can be done, but I will not cover that complication. It is also possible to clone to a different sized drive, but I will not get into that here.

First make backups of everything in case this goes awry. You have been warned.

1: The linuxcnc pc is powered off. I connect an empty drive to it (same size as the original) and also a live-boot USB stick. The linuxcnc installer works great for this.

2: Boot the pc from the live-boot USB stick into the live-boot/testing. Do not launch the installer.

3: Find out which drive is which. One way to do that is to open Gparted and inspect the drives. On my system I might see that /dev/sda contains the installed linux os and /dev/sdb is the new empty drive. Your pc might be completely different. This is the most important detail.

4: Using the information gathered in step 3, I formulate the following terminal command:
be very careful of not copying the empty drive to the linuxcnc drive! You will then have two empty drives and no linuxcnc!
# dd if=/dev/sda of=/dev/sdb status=progress bs=1M conv=sync

I will not explain the very important "#" bit. If anyone reading this does not know what that is for, I would suggest to practice your terminal skills in less destructive ways before trying to do this.

if=/dev/sda is telling dd the "input file" is the sda disk
of=/dev/sdb tells it which is the "output file"
status=progress gives you some feedback what it is doing while it is busy
bs=1M sets the block size for copying I think default block size is 512B which copies insanely slowly. You can use block sizes larger than 1M, you might gain some speed, but if block size is set larger than the drive's internal cache space, your resulting copy will be botched. 1M seems to be a safe number that always works for me.

Depending what versions you're running, the status=progress bit will not work and will not display the progress. Just let it do its thing or find other ways to figure out if the hard drives are actively copying. Back when all I had was spinning rust, we didn't have status=progress, but I could HEAR it was doing its thing.

Depending on the size of your drives and their speed, this cloning can can take anywhere from a few minutes to a few weeks to complete. I've had 4GB spinning rust drives take a couple days. A 1TB ssd is usually way quicker than that.

graon
I just discovered there was already an answer to this question after I typed this up. If anyone has a problem with this I can remove it.

Please Log in or Create an account to join the conversation.

  • NWE
  • Away
  • Premium Member
  • Premium Member
More
29 Jan 2026 08:25 #342148 by NWE
to make an .img file, run the command I posted, except change the of= part to:
of=/path/to/my/hardDiskBackup.img

first make sure your directory has enough free space to hold a file as large as your source disk.

writing that img file to a new empty drive then instead change the if= bit:
if=/path/to/hardDiskBackup.img
The following user(s) said Thank You: unknown

Please Log in or Create an account to join the conversation.

More
29 Jan 2026 08:28 #342149 by unknown
Replied by unknown on topic Experimental raspios Linuxcnc Trixie images.
Well done Sir. :)
The following user(s) said Thank You: NWE

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum