I am trying to clone my boot drive to move to a larger volume, but am having issues using the dd command. I booted with the Live iso from my USB (I wanted to make sure the old and new ssd drives were not active), but when I tired to execute the dd command, I got a message that the command could not be found. I then tried to install the coreutils package (that is where dd is located), but got the message that coreutils was already installed. I could just re-install release 40 on my new drive, but I would like to avoid the 6-8 hours it takes to rebuild the system, load all of my user date and applications. Any suggestions?
It is odd that your dd command is not being found. It should be in the coreutils package as you say (it should show in the output of rpm -ql coreutils | grep /bin
).
dd isn’t the best tool for the job though. It is quite inefficient because it spends a lot of time copying all the “empty” space as well. On today’s terabyte-sized HDDs and SSDs, the wasted time and energy is very significant.
I would do something like that using a combination of sgdisk (to duplicate the partitions on the second disk) and partclone (to copy the partition contents).
Edit: I might use dd to copy just the 440-byte 1st-stage boot loader from the old drive to the new one on a legacy BIOS system because I don’t think any other tool would be able to do that. But you are probably using a UEFI system, so that shouldn’t be necessary.
Simple to the extreme (but dd would not be what I would use).
- boot to a live media device so the drive being copied is NOT in use
- use dd from the live media to copy the original drive content to the new drive.
If the new drive is not identical to the older one (it is larger) then you will need to resize partitions once the copy has completed.
Note that dd makes anexact
copy, including device ID, partition tables, UUID, etc., so it may not be the best choice for your plan. - replace the original device with the new one then boot.
I personally would get a quick list of the packages and configs I did manually, then would do a new install on the new drive. It is relatively quick to then add the additional packages that were previously installed and rsync can be used to copy everything from your home directory onto the new drive home directory.
The full user installed package list can be gotten with the command dnf history userinstalled
. If that is saved into a file the list can then be used to reinstall everything from a script.
grub2-install
would do that. You would run that anyway because the first stage loader has hard coded sector addresses to the rest of the grub loader.
Of course, you should not run grub2-install
on UEFI systems.
I agree, with the caveat that some use cases rely on packages that are no longer available, but were installed on an old Fedora release. If the system was originally installed with an older release, using dnf list installed
to check for packages from older releases could be useful.
I appreciate the quick responses, but there were still issues. I did boot from the Fedora live ISO, so that the drives woud not be in use. The command “dd” was not available on the FC Release 40 live ISO. I don’t know what the issue is, but coreutils shows as installed and there seemed to be no way to add it. It just appears to be missing from the package. Net: any way of using dd wasn’t available without a lot of work. I ended up reloading a new system, reinstalling all apps and then restoring all of my user data. Problem now solved.
Thanks for the suggestions. I will have to sort out how to access dd when I have more time.
Strange that dd was not available. I just tested my install iso and found the app as soon as I booted up.
Thanks for that. I must be doing something incorrect - will have to work on it. Perhaps I need to be in a different directory to access that command. I was working from my home directory when I tried to use that command. And, all other commands from my home directory seemed to work. In any case - clearly it is a user issue. Thanks.
Linux systems are usually configured so commands are available independently of the current working directory. You might find Linux Command useful for an explanation of how linux finds a command. It has helped many colleagues over the years, and doesn’t suffer from the AI-generated nonsense found on clickbait web sites.
I wonder if dd
was considered not “essential” for Fedora Core. In Fedora Workstation:
% type dd
dd is /usr/bin/dd
I’ll give that a try later today.