Clone NAS hard drive to SSD

The clone operation did not work because nothing was written to the SSD. It is going to be
difficult for you because of your limited knowledge of Linux.

Ha Ha… didn’t even spell it correctly!

I’m an IBM old main-frame and Access development programmer and spent many an hour with DOS. With that background and having navigated my way to the SSH via Putty I had hoped that learning a few Linux line commands I could handle the clone operation having done that many times with Windows based clone operations.

Was something missing when Wierd instructed me to use “dd if=/dev/sda of=/dev/sdb bs=4096”?

No that is one way to clone the disk. But to clone the disk the new disk needs to be at least the same size as the old disk. The dd command will read 4096 bytes at a time from /dev/sda and write it to /dev/sdb. If you want to know what it would look like if the clone worked. Issue the following:
dd if=/dev/sda of=/dev/null bs=4096
This will take a fair amount of time. But the output will be the same as if the clone was done. What this command does is read the sda disk and write to null. Which goes nowhere.
Your main problem is that when the old disk is in the My Cloud and you connect the SSD. The My Cloud does not see the SSD.

Given that the SSD is quite a bit smaller than the 2TB hard drive, it sounds like cloning is the wrong approach to start with. PC FTFS doesn’t have the size mismatch issue so it never occurred to me that Linux might. Is there a facility that will simply “format” the SSD with the necessary Linux protocols so that it will work in the MyCloud?

It would be possible to recover the situation of a TRUE out of space scenario. The data volume is the last partition on the disk, so the boot partition, the partition table, the persistent configuration storage partition, and pals would have all been copied if the SSD is 200gb. You would just need to use fdisk to recreate the last partition and then format it as EXT4.

However, you copied a teensy amount of data. Looking at the output you provided, it looks like linux does not like your adapter. (It assigned a /dev/sg0, which in my experience happens when the system cannot properly identify it as USB mass storage.) I have a few adapters that do this also.

If you have a different USB adapter, try that.

As for “boggle”-- it was meant as an emotional response given in text form. EG, I was boggled that you were trying to change the root password for no apparent reason.

About the password. When I installed Putty it issued a warning that implied that if the pw didn’t get changed at first opportunity that I would be running the risk of becoming locked out, enough said.

I only have the one USB adapter. It is fairly old and USB 2.0. If I boot up a copy of Linux can I format the 256GB SSD via a direct SATA connection using Linux native utilities? I have an old copy of Kaspersky Rescue and can boot Linux off that or better yet would be to download the latest…

If WD writes some special propitiatory information on its new MyCloud disc this all might be for naught? I.e., if the only way I can accomplish the task is a direct USB connect to the MyCloud.

No, all the file systems are normal linux ones. The only magic is that the boot loader is hard configured to look on partition 3 for the ramdisk and kernel images.

It is possible to hook both disks up natively to a linux PC and do the dd there. (If you dont want to do a full disk dd, you can break it up into individual operations for each partition.) Just be ■■■■ SURE which disk is which!! Rather than give a hard identifier below, I will substitute with /dev/[ssd] and /dev/[wd hdd] because I dont know what identifiers the linux distro you boot will give them.

Individual partitions dd operation:

  1. dd the first 10mb or so of the disk. This gets us the partition table.

     dd if=/dev/[wd hdd] of=/dev/[sdd] bs=4096 count=2560
    
  2. run partx (if not installed, install it with your package manager first.), as this will detect the partition structure we just copied, and produce the needed device nodes under /dev

     partx -u
    
  3. dd each of the partitions except the last one. (your ssd is smaller than the original disk, so we need to rebuild that partition.) The order of the partitions in the table is different than how they are laid out on the disk. The data volume is the last partition on the disk, but is partition number 2 in the table on a gen2, and is partition 4 on a gen1.

For gen2 mycloud:

    dd if=/dev/[wd hdd]1 of=/dev/[ssd]1 bs=4096
    dd if=/dev/[wd hdd]3 of=/dev/[ssd]3 bs=4096
    dd if=/dev/[wd hdd]4 of=/dev/[ssd]4 bs=4096
    dd if=/dev/[wd hdd]5 of=/dev/[ssd]5 bs=4096
    dd if=/dev/[wd hdd]6 of=/dev/[ssd]6 bs=4096
    dd if=/dev/[wd hdd]7 of=/dev/[ssd]7 bs=4096

For gen1 mycloud:

    dd if=/dev/[wd hdd]1 of=/dev/[ssd]1 bs=4096
    dd if=/dev/[wd hdd]2 of=/dev/[ssd]2 bs=4096
    dd if=/dev/[wd hdd]3 of=/dev/[ssd]3 bs=4096
    dd if=/dev/[wd hdd]5 of=/dev/[ssd]5 bs=4096
    dd if=/dev/[wd hdd]6 of=/dev/[ssd]6 bs=4096
    dd if=/dev/[wd hdd]7 of=/dev/[ssd]7 bs=4096
    dd if=/dev/[wd hdd]8 of=/dev/[ssd]8 bs=4096
  1. recreate the data partition using either gparted (gui), or gdisk (gpt version of cli fdisk). For gen1 it is partition 4. For gen2 it is partition 2. Be sure to format it as ext4.

How do I tell which generation of MyCloud do I have? (I assume that’s what your referring to with “genx”?)

Is “partx” a Linux line command? In your reference to “Linux distro”, is that like drive letters in Windows? E.g., a:, b:, c:, etc.

I won’t be able to do this until Wednesday but I’ll keep you posted on my progress.

Check your mycloud firmware number. Gen2 hardware has a 2.xxxx firmware number. Gen1 has a 4.xxxxx firmware. You should be be able to find that information in the mycloud’s web gui.

partx is indeed a linux command, but it is an optional one. It might not be present. By “distro”, i mean “is it a debian like linux? Is it an Arch like linux? is it a Redhat like linux?” etc. Each one has its own package management system and approach. (debian uses apt, arch uses pacman, and redhat uses yum.) This is why I glossed this the way I did. I have no idea what linux you will try, so I dont know what package manager you will be using, so I cannot give you good advice on how to install partx if it is not present.

Linux systems do not use drive letters. AT ALL. They use a unix like system tree, with file systems mounted at mount points.

Each physical disk is assigned a device node in /dev. Each device’s raw partitions are given a subdevice node with a number in its name. EG, the first sata disk in the system is usually called /dev/sda and its first partition is called /dev/sda1 . Since we dont know much about this linux you are booting, or what order it will detect the sata drives in, we can’t just assume the mycloud’s drive will have /dev/sda. You will need to do some interrogation of the system to find that out. calling “hdparm -i” on each /dev/sd* device one at a time will help you identify which one is which. Just be careful with hdparm. It is not a toy.

Does Linux have a command that will allow me to change the name of the “MyCloud”? From a Windows point-of-view, having two (2) MyCloud drives on the LAN would cause havoc among the apps that use them. Both are private so I don’t MAP the drives and hard-coded IP addresses is most un-desirable.

Try changing the host name of the MyCloud in the GUI. :stuck_out_tongue:
The windows share daemon’s config file gets automagically generated on the Gen2 hardware, and that is where the “server name” for windows shares is defined. IIRC, it grabs it from the hostname, which you can set in the dashboard GUI.

BINGO! (1st generation)

The Kaspersky Rescue Disc (USB ISO) comes with the Gentoo distro. I’m about to disconnect all my Windows SATA devices and boot up Linux to see if I can recognize the [WD HDD] and [SSD] without any fuss. If so I’ll start attempting to add the partitions.
Bill

I apparently didn’t follow your instructions correctly? WD-HDD = sdb and SSD = sda

What did I screw up?

WD-HDD = sdb as viewed in Windows Explorer:

No, I screwed up. Been a while since I used partx.

Try these.

partx -u /dev/sda
partx -u /dev/sdb

That will update all the partition stuff in /dev

I’ll give it another go Thursday afternoon.
Thanks,
Bill

BTW, fDisk is native to Windows. Is there a fDisk in Linux or did you mean for me to format the data partition when I returned the system to Windows?

Same thing:

Give me an ls on /dev

There is an fdisk for linux. It is geared toward msdos style partition tables though, and the mycloud units use a GPT style partition table. That is why you need either gparted (has a pretty GUI) or gdisk (console based). Those know how to work on gpt partition tables.