[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: |
Felix Ehlermann |
Subject: |
RE: How to clone to a smaller HDD without messing up partitions? |
Date: |
Sat, 26 Oct 2019 10:39:57 +0200 |
Hi Shahrukh,
You can just specify partitions (/dev/sda1) rather than the entire device
(/dev/sda) without problems.
Of course this requires the partition table to be without damage.
I would recommend to
* always use a mapfile - it does never hurt, takes very little space and in
very many cases you will be happy to not have omitted this.
* if possible use an file not a blockdevice as outfile
So rather than running
> ddrescue -f -n /dev/sda /dev/sdb
which has a lot of risks and implications (e.g. the destination drive should be
zeroed first, etc.), I would go with the following command(assuming sda2 is the
partition with your relevant data)
> ddrescue /dev/sda2 /media/my-usb-hd/sda2.img /media/my-usb-hd/sda2.map
Once you have finished recovery you can partition a healthy drive and then
restore the image into the according partition with `ddrescue -f
/media/my-usb-hd/sda2.img /dev/sdb2`.
If anything fails, you can retry from the image-file without risk of losing
more data.
You can also run recovery tools on the image file (or rather a copy of it, in
case the tool messes something up) to recover your data.
Kind Regards
Felix
P.S.
> lsblk version
> -------------
> sda 465.8G
> -sda1 RECOVERY 9.8G ntfs
> -sda1 OS 54.9G ntfs
Is this a typo or are there really two sda_1_ partitions on sda?
-----Original Message-----
From: Bug-ddrescue <bug-ddrescue-bounces+fehlermann=address@hidden> On Behalf
Of Shahrukh Merchant
Sent: Samstag, 26. Oktober 2019 04:04
To: address@hidden
Subject: How to clone to a smaller HDD without messing up partitions?
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