dd command help

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Thornton_KenB
Level 1
Level 1
Posts: 8
Joined: Sun Nov 15, 2020 1:25 pm
Location: CO, USA

dd command help

Post by Thornton_KenB »

Ok folks,
Newbie here.... I probably extended myself over my skis here but I need some help.

I cloned a 500GB HD that I have setup in RAID1. The drive had 367GB of data (133 GB free). I cloned that to an external 1TB SSD.

Being a newbie I didn't understand that the dd command would clone the 500GB onto the TB drive not just using 500GB but filling the TB drive. My TB drive now shows that it has 133GB of free space. I would like to restore what was cloned onto the TB drive back to the 500GB drive.

I thought I could simply use the dd command to send the data back to the 500GB drive. (you experienced folks are shaking your heads no....) What I'm finding is that the process is trying to image back as a TB drive and not the 500GB of data that was originally on the drive.
Additional detail......I wanted to try and create a boot drive of the 500GB drive. With that, I attempted to load the Mint install on the 500 GB drive. Due to "family issues" I need to nix that idea and just bring the configuration back to the way it was previously.
  • Is there a way to do what I want to do
  • If yes, how do I do that?
  • If no, any suggestions?
Thanks in advance for the support.
mikeflan
Level 3
Level 3
Posts: 115
Joined: Sun Apr 26, 2020 9:28 am

Re: dd command help

Post by mikeflan »

My TB drive now shows that it has 133GB of free space.
That is what is should do. I suspect you have a 500 GB unformatted partition also.
I thought I could simply use the dd command to send the data back to the 500GB drive. (you experienced folks are shaking your heads no....)
I'm not very experienced, but I am not shaking my head no. You should be able to do that.

If you mount the hard drives and show us the results of

Code: Select all

df -h
and also show the partitions reported by GParted, there are smart guys here who may be able to help.
Also show us the commands you tried and the problems reported.
User avatar
Flemur
Level 18
Level 18
Posts: 8850
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: dd command help

Post by Flemur »

Thornton_KenB wrote:
Sun Nov 22, 2020 12:47 am
Being a newbie I didn't understand that the dd command would clone the 500GB onto the TB drive not just using 500GB but filling the TB drive. My TB drive now shows that it has 133GB of free space. I would like to restore what was cloned onto the TB drive back to the 500GB drive.
Take a look at the drive in gparted; with your undefined "TB drive now shows", you might be seeing a 500GB partition with 133 free, and NOT seeing 500GB unallocated space on the drive.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
linux-rox
Level 5
Level 5
Posts: 531
Joined: Sun Jul 19, 2020 9:17 pm

Re: dd command help

Post by linux-rox »

Is preservation of the RAID aspect important? (Frankly, I don't understand what you mean when you say the 500 GB drive is "setup in RAID1," except perhaps that it was originally part of an array.) If not, I'd reformat the 500 GB drive and transfer back the data at file level. Simple, reliable, and easy to set up. Will take longer. In my experience, file level copy takes about twice as long as block level copy. OTOH, doesn't copy unused blocks, so you get back some of that for the 133 GB in block copy you won't be doing. If the approach appeals, say so and we can talk about commands.
Thornton_KenB
Level 1
Level 1
Posts: 8
Joined: Sun Nov 15, 2020 1:25 pm
Location: CO, USA

Re: dd command help

Post by Thornton_KenB »

First..... thanks everybody for the responses.
linux-rox wrote:
Mon Nov 23, 2020 12:38 am
....... I'd reformat the 500 GB drive and transfer back the data at file level. .....
linux-rox... Almost on point with your suggestion.

I broke the array, recreated the volume and reformatted the 500GB. At this point I'm considering not an image from the TB drive to 500GB drive, but simply copy the files over.

Is that what you're referring to? I am teachable :)

Thanks in advance.
linux-rox
Level 5
Level 5
Posts: 531
Joined: Sun Jul 19, 2020 9:17 pm

Re: dd command help

Post by linux-rox »

For simplicity, I'm going to assume you have a live USB/DVD available. That's the best way to do this job, as it has all the tools you need and it boots independently of the drives you're working on. Or, you could use your regular system, installing GParted which you won't have by default.

Boot the live session. Turn off screensaver and screen blanking (the latter is in Power Management). Open GParted. Use that to format, partition, and label the 500 GB drive. Also use it to label the partition on the 1 TB drive. (If either of these are attached to a USB port, you'll have to unmount them before GParted can do anything.) Doesn't matter what labels you use, except no spaces (use hyphens or underscrores instead, if you want pseudo spaces). Close GParted. Open File Manager. Click on both partitions in the left pane, which will mount them to /media/mint.

In theory, you could copy the files with File Manager, but I prefer to use rsync in Terminal. Either way, don't do the job in one fell swoop. Break it up into parts, say, directory by directory, so the computer isn't completely locked up for the duration. If using File Manager, you'll have to open it as Root/Admin (so it has permission to copy everything) and I'd use two-pane view. For rsync, use a command in this form:

Code: Select all

sudo rsync -axHAX --info=progress2 /media/mint/Label1/Directory1/ /media/mint/Label2/Directory1
This will copy Directory1 from Label1 (whatever you called the 1 TB drive) to Label2 (whatever you called the 500 GB drive). Notice there's a backslash after the source but not the target. That's intentional. The flags preserve meta-data (e.g., timestamps), hard links, etc. --info=progress2 tells how many bytes have been transferred; right-click the directory in File Manager to find out how much will be sent. As you work through the directories, use the up arrow key to retrieve the previous command string, then change only the directory/folder name.

Let me know if you have any questions.
Post Reply

Return to “Software & Applications”