Jump to content

How to move OS between hard drives?


RainDreamer

Recommended Posts

1 hour ago, Camacha said:

As indicated before, whether a drive operates in IDE or AHCI mode has considerable impact on performance. This is also governed by the drivers, which can also impact performance and operation.

True, but that really controls how the chipset / BIOS presents the drive to the OS. AHCI can expose new ATA features to the host, so you may miss out on e.g. NCQ if running in "legacy" / emulation mode, but this is true whether the disk is spinning rust or nand. If the chipset supports AHCI, you should use it anyway - depending on what the hardware supports, it might even perform better.
If a particular chipset driver is slow, it's probably going to be slow for newer spinning disks as well - you just won't notice.
I guess a reinstall could be an excuse to fix this, but as your link demonstrates, you can also switch drivers without re-installing.

Aside, all modern drives are IDE - the acronym is Integrated Drive Electronics, meaning that the drive controller is on the drive, as opposed to say, MFM, where a separate controller board does all the donkey work, like positioning the heads. ATA drives, whether using the old parallel or newer serial transfer architecture still use the same ATA command set, plus any AHCI extensions, if available.

1 hour ago, Camacha said:

One notable thing Windows does is to disable the defragmentation service for flash drives.

Yeah, ok. It's been so long since I used a filesystem that needs regular defragmentation I had forgotten all about that "service". Even back when I still used FAT/NTFS I just defragged as needed, when needed. :P
But surely this also falls into the category of "can be fixed at any time, without reinstalling".
 

 

Link to comment
Share on other sites

Linux can do it with the dd command. Open a terminal and use

sudo fdisk -l

 to find the identifiers for the old and new disks - they look like "sdX" where X can be any letter (sda, sdb, sdc and so on). Write these down and make sure you know which one is which or you'll lose all your data! Then do

sudo dd if=/dev/sdX of=/dev/sdY 

where sdX is the identifier of the old disk and sdY is the identifier of the new disk ("if" stands for "input file" and "of" stands for "output file", so input should be the old disk and output should be the new one). Check once more that you got it right and then hit enter.

 

It won't actually show you what it's doing but it'll let you know once it's done. Depending on the size of the disk and other factors, the transfer might take several hours. However, there is a way to see a progress report - open another terminal window and run

sudo pkill -USR1 -n -x dd

What it does is it sends the USR1 signal to the dd process which tells it to print I/O statistics (volume of files already copied, elapsed time, current transfer speed and some other things). These will show up in the window the dd process is running in. If you want periodic progress reports you can run it with the "watch" command like

sudo watch -n 5 'pkill -USR1 -n -x dd'

which will automatically run the command every 5 seconds, printing stuff in the dd window. You can change the "5" to any other number to alter the frequency at which it runs the command. Or you can just wait until the transfer is complete if you want to keep it simple.

 

Once it's done copying, open GParted (you might have to install it first depending on what Linux distro you're using) and look at the old disk. Find the partition that has the "boot" flag enabled. Then find the corresponding partition on the new disk and set that to bootable as well (it might be already, I don't know if the dd command copies partition flags) and save the changes. You should then be able to reboot, go to BIOS and select the new disk as primary boot device and boot Windows from it. Then simply use the Windows disk management tool to expand the partitions so that you're using all available space.

 

DISCLAIMER: I'm not responsible for any potential loss of data, I've never actually cloned an entire disk at once but these commands do work fine for writing files onto USB sticks and SD cards etc, HDDs/SSDs should be no different.

Edited by CaptainKorhonen
Link to comment
Share on other sites

1 hour ago, CaptainKorhonen said:

make sure you know which one is which or you'll lose all your data!

It didn't get the nickname "destroyer of disks" for nothing ;)
(and no, that's not what it actually stands for. As with many things unix, the original naming rationale is probably lost to the sands of time)

1 hour ago, CaptainKorhonen said:

HDDs/SSDs should be no different.

Agreed, and yeah, it does work.
Caveats I know of:
You'll need to shrink the filesystem/partition first if the destination disk is smaller - as is often the case moving to an SSD.
The windows bootloader gets liquidy this profanity filter is ridiculous upset if you move the start sector of the "System reserved" or Windows (C:) partition.

For live progress, you could also pipe through pv, e.g. 'dd if=/dev/source | pv | dd of=/dev/destination'

Or dispense with dd altogether and just redirect the data, using pv in place of 'cat' like:

pv /dev/source > /dev/destination

Added bonus of this method: You'll get a progress bar, speed and an ETA, since it knows the total size to transfer, whereas dd does not.

pv /dev/sda > /dev/null
40MiB 0:00:02 [ 125MiB/s] [>                                                         ]  0% ETA 0:39:34

You really only need to use dd if you want to to skip/seek/truncate/convert the data stream in the process, for a straight up copy it can be rather slow as it uses silly small block sizes. You will probably find a dd disk copy is a fair bit quicker if you also set 'bs=4M' or so, or just use pv or cat, as they'll use a more sensible block size by default.

Edited by steve_v
Code blocks.
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...