bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to clone to a smaller HDD without messing up partitions?


From: Dr. Anonymous
Subject: Re: How to clone to a smaller HDD without messing up partitions?
Date: Sat, 26 Oct 2019 12:06:04 +0300

There is one more way to do exactly you want! Without copying any unneeded 
sectors and without determining the exact sizes!
Assuming /dev/sdc to be the source and /dev/sdb to be our destination.
First, copy the MBR (the very first sector):
ddrescue /dev/sdc /dev/sdb -s1s
Then, either reboot the system or anyway make the kernel recognize the new MBR 
of the destination drive.
Then copy the initial partitions to the destination:
ddrescue /dev/sdc1 /dev/sdb1 ~/1.log
ddrescue /dev/sdc2 /dev/sdb2 ~/2.log
That's all.

----- Original Message ----- 
From: "Ketil Froyn" <address@hidden>
To: "Shahrukh Merchant" <address@hidden>
Cc: "dd-rescue" <address@hidden>
Sent: Saturday, October 26, 2019 10:30 AM
Subject: Re: How to clone to a smaller HDD without messing up partitions?


>I have a different suggestion. Set up your target device with some sort of
> deduplication and/or compression. For example btrfs or zfs or vdo. Then you
> can clone to a file on the target, and hopefully you'll have space for the
> whole thing.
> 
> On Sat, Oct 26, 2019, 04:03 Shahrukh Merchant <address@hidden>
> wrote:
> 
>> I have a 500 GB HDD (source) that I want to clone to a 320 GB HDD
>> (destination). Both are MBR. Only about 60 GB of the source drive is
>> actually in use (in 2 partitions), the rest (400+ GB) is in unallocated
>> space.
>>
>> I will ask more specifically in two different ways:
>>
>> 1. I would like to tell ddrescue to clone the entire drive, i.e.,
>>
>> ddrescue -f -n /dev/sda /dev/sdb
>>
>> BUT with options that effectively say "and don't worry if you run out of
>> space on the destination drive--just stop copying since the important
>> stuff is at the start anyway." Can I do that, and how? (And other than
>> relying on the Windows Disk Management visual to believe that the
>> unallocated space is all at the end, which it seems to be, is there some
>> other tool I can use to let me confirm that explicitly?)
>>
>> 2. If the answer to the above is "No" or "Not recommended," then I would
>> have to do the clone partition by partition. There are two partitions on
>> the source disk as follows:
>>
>> lsblk version
>> -------------
>> sda             465.8G
>>   -sda1 RECOVERY   9.8G ntfs
>>   -sda1 OS        54.9G ntfs
>>
>> Windows 7 Disk Management version
>> ---------------------------------
>> Disk0 Basic/465.76 GB/Online
>> --------
>> 9.77 GB
>> Healthy (Active, Recovery Partition)
>> --------
>> OS (C:)
>> 54.93 GB (NTFS)
>> Healthy (Boot, Page File, Crash Dump, Primary Partition)
>> --------
>> 401.07 GB
>> Unallocated
>> --------
>>
>> So if I do the clone partition by partition, two things are not clear:
>>
>> (a) What is the sequence of commands I need to use (and how to I prepare
>> the destination drive in advance). Can I do, for example:
>>      ddrescue -f -n /dev/sda1 /dev/sdb
>>      ddrescue -f -n /dev/sda2 /dev/sdb
>> and have ddrescue figure out that I mean "put them in their
>> corresponding places on the destination drive based on how it was on the
>> source drive and fix the MFT so it does the right thing" (seems a lot to
>> ask for, but maybe it does!)?
>>
>> (b) How do I maintain the integrity of the destination drive w.r.t. the
>> MFT of that drive being properly configured (since it is not part of the
>> ddrescue copy, as I understand it, if I do a partition at a time), and
>> in terms of the destination drive booting fine in exactly the same way?
>>
>> Basically, the unallocated space at the end is the only part that I want
>> to be different, owing to the different in drive sizes.
>>
>> Thanks!
>>
>> Shahrukh
>>
>>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]