Cloning an entire SSD Step-by-Step Instructions?

Cloning was successful, however resizing the partition is funky:

Gyro:/home/SJL # resize2fs /dev/sda2 150Gresize2fs 1.43.1 (08-Jun-2016)
The containing partition (or device) is only 28049664 (4k) blocks.
You requested a new size of 39321600 blocks.


Gyro:/home/SJL # resize2fs /dev/sda2
resize2fs 1.43.1 (08-Jun-2016)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 7
The filesystem on /dev/sda2 is now 28049664 (4k) blocks long.


Gyro:/home/SJL # fdisk -l


Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x389a1131


Device     Boot    Start       End   Sectors  Size Id Type
/dev/sda1           2048  16771071  16769024    8G 82 Linux swap / Solaris
/dev/sda2  *    16771072 241168383 224397312  107G 83 Linux


Gyro:/home/SJL # 



I could use a tip

resize partition then file system

Gyro:/home/SJL # fdisk -l

Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x389a1131


Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1           2048  16771071  16769024     8G 82 Linux swap / Solaris
/dev/sda2  *    16771072 446851071 430080000 205.1G 83 Linux


Disk /dev/sdb: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes                                                                                                                                                
I/O size (minimum/optimal): 512 bytes / 512 bytes                                                                                                                                                    
Disklabel type: dos                                                                                                                                                                                  
Disk identifier: 0x0001cc68                                                                                                                                                                          
                                                                                                                                                                                                     
Device     Boot  Start       End   Sectors   Size Id Type                                                                                                                                            
/dev/sdb1         2048    206847    204800   100M  7 HPFS/NTFS/exFAT                                                                                                                                 
/dev/sdb2  *    206848 234436607 234229760 111.7G  7 HPFS/NTFS/exFAT    

Thank you. ‘Almost’ Everything seems to be in working order minus a few unexpected side-effects:
1.gnome-system-monitor is broken. It first of all looks different, like the default GTK Theme, and I triple checked, I have them set as something else, not default.

  1. google-chrome keeps on asking me to set it to default. It IS default.

Do these suggest data corruption, and I should give it another go, while booted from a flash?

FYI, I did the
dd if/of while booted from if mount.

After a little bit of research, I think the data corruption may be due to the smaller block size:
https://wiki.archlinux.org/index.php/disk_cloning

http://www.linuxnix.com/find-block-size-linux/

4KB -> 512bytes
with dd if->of

Thankfully the original ssd has been untouched. I will give this a go:

dd if=/dev/sdb of=/dev/sdc bs=4K conv=noerror,sync

Well, the transfusion has been successful. There in fact was a data corruption. For future references, key example codes:

Actual cloning line:


dd if=/dev/sdb of=/dev/sdc bs=4K conv=noerror,sync

if=source
of=target
bs= block size with suffix capital K, 4KB in my case.

bs of source identification:


blockdev --getbsz /dev/sdb

Resizing was done using gParted. Progression:

  1. Source SSD -> target SSD, while booted from source SSD.
  2. gParted to increase partition size, while booted from Linux Mint 17.3 install dvd
  3. status check performed and failed.
  4. Source SSD -> target SSD, while booted from an(OpenSUSE 13.1 64bit KDE)external HDD
  5. gParted to increase partition size, while still booted from external HDD.
  6. success!.. I hope.

Increase partition

then
increase file system

need both to use the added space

I’m not familiar at all with the term file system. I’m not even sure what I’m supposed to increase after the partition.

Oh dear.

a partitions is simply the container how the files are actually arranged in that container is do to a file system. In Linux there are many possible file systems. in 13.2 the default was I think BTRFS for root and XFS for home. But others are possible but you would have had to set it when you installed. Otherwise you have the default.

Okay, so, the format of the partition-file system.

I have been strongly bound to ext4 eversince BTRFS was glitch on one of my computers.

nothing wrong with ext4 but BTRFS does have more bells and whistles

BTRFS appears pretty stable now the earlier versions were a bit hit and miss

Recently I had a HDD failure and cloned it in the identical manner as I’ve shown.

Something I didn’t quite expect is that partition UUID has also been cloned? I didn’t have to change the /etc/fstab, or mess around in Windows to get the new drive to work identically. Is this typical?

Depends on the software used. The UUID is stored at the front of each partition. If you do a binary copy (clone) of the whole partition the UUID is also copied. If a new partition is created in the process then a new UUID is generated.

I see,
I used dd and went from 2TB to 2TB HDD

If you are cloning to a previously used SSD, then, because of the flash architecture underneath the hood of an SSD, it is helpful to reset the target SSD, to which you are cloning, to factory defaults, before cloning. This can restore the write speed that had been naturally degrading over time and use due to internal fragmentation (again, under the hood – you don’t see this and can’t). The issue is that the internal architecture of an SSD knows nothing of your filesystem; it is operating at a lower level than that. The SSD firmware will not know that you are wiping the SSD, regardless of how you do it (dd, Clonzilla, gparted, whatever).

The following is best done with the device connected directly using SATA and not a USB/SATA adapter, because not all USB/SATA adapter controllers will be transparent to the operation:

Make sure the target SSD’s partitions are not mounted.

hdparm -I /dev/sdX

Verify “not frozen”

If " frozen," then try pulling the SATA power cable, quickly re-insert it, and check again.

hdparm --user-master u --security-set-pass 1234 /dev/sdX
hdparm --user-master u --security-erase 1234 /dev/sdX

Setting the password blocks all further system access to the drive until the erase is done. The erase operation will then also remove the password, as it will reset the SSD to factory defaults.

That is a good idea I haven’t thought of. I will start doing that when I am upsizing/replacing the SSDs.

At the moment, the majority of what I’m using this for is for replacing a failing HDD with an equal size or larger size HDD. It’s been a while since I could afford a larger SSD since I am already at ~512GB for mSATA and NVMe.