[CentOS] Need a Centos 6 USB hard drive recovery procedure

Sat Jun 1 03:37:47 UTC 2013
Rock <Rocksockdoc at gmail.com>

On Sat, 11 May 2013 23:31:07 +1000, Anthony K wrote:

> dd if=/dev/sda of=/path/to/hdd-image-file.img bs=4M

I'm not sure how to figure out what to put into that dd command.

Q: Is this the right sequence given the disk information below?
   1. Boot to Centos 6
   2. Plug in the old (500GB) & new (2TB) USB drives
Note: I'm trying to test this on a test 500GB drive; 
once it works, I'll use it on the real 150GB drive.
   3. $ sudo parted --list (this finds /dev/sdb & /dev/sdc)
Note: In this case, sdb is the 500 GB test drive; and 
      sdc is the 2TB brand new drive for the dd copy to reside.
   4. su root (do we need to be root?)
   5. # dd if=/dev/sdb of=/dev/sdc/hdd-image-file.img bs=4M

Q: Is that the right sequence given the disk information below?
 

--- see below for my attempt finding the logical disk name ---

Pluggin in the new 2TB drive and a test 500MB drive, they both
show up in /media; but that doesn't tell me what their sda path is.

Since the dd command requires the two paths to the two drives, 
how do I find out that information?

Googling, I find this reference:
http://unix.stackexchange.com/questions/4561/how-do-i-find-out-what-hard-disks-are-in-the-system

I tried the suggested commands, as shown below:

1. The disklabel command wasn't found:
$ disklabel
==> bash: disklabel: command not found
$ sudo yum install disklabel
==> No package disklabel available.
==> Error: Nothing to do

2. Neither was the lshw command:
$ lshw -class disk
==> bash: lshw: command not found
$ sudo yum install lshw
==> No package lshw available.
==> Error: Nothing to do

3. The by-label directory simply gave the disk name:
$ ls /dev/disk/by-label
==> My\x20Passport	SignatureMini

4. And the by-id gave a cryptic set of numbers:
$ ls /dev/disk/by-id
==> usb-Hitachi_HTS545050KTA300_008061300001-0:0
==> usb-Hitachi_HTS545050KTA300_008061300001-0:0-part1
==> usb-WD_My_Passport_0748_575833314142323938373338-0:0
==> usb-WD_My_Passport_0748_575833314142323938373338-0:0-part1

5. Likewise with by-uuid, only the numbers were even worse:
$ ls /dev/disk/by-uuid
==> horrid set of numerical results

6. It doesn't seem that the by-path is at all useful:
$ ls /dev/disk/by-path
==> pci-0000:0f:00.0-usb-0:1:1.0-scsi-0:0:0:0
==> pci-0000:0f:00.0-usb-0:1:1.0-scsi-0:0:0:0-part1
==> pci-0000:0f:00.0-usb-0:2:1.0-scsi-0:0:0:0
==> pci-0000:0f:00.0-usb-0:2:1.0-scsi-0:0:0:0-part1

7. And, the hwinfo command wasn't found:
$ hwinfo --disk
==> bash: hwinfo: command not found
$ sudo yum install hwinfo
==> No package hwinfo available.
==> Error: Nothing to do

8. Maybe the scsi directory contained what I needed?
$ cat /proc/scsi/scsi
Host: scsi8 Channel: 00 Id: 00 Lun: 00
  Vendor: WD       Model: My Passport 0748 Rev: 1019
  Type:   Direct-Access                    ANSI  SCSI revision: 02
Host: scsi8 Channel: 00 Id: 00 Lun: 01
  Vendor: WD       Model: SES Device       Rev: 1019
  Type:   Enclosure                        ANSI  SCSI revision: 06

9. Finally, I think "parted" found logical device /dev/{sdb,sdc}:
$ sudo parted --list
Model: WD My Passport 0748 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2000GB  2000GB  primary  ntfs

Model: Hitachi HTS545050KTA300 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      32.3kB  500GB  500GB  primary  ntfs

10. Yet, fdisk found /dev/sdb1 & /dev/sdc1: 
$ sudo fdisk -l
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xdf7bffc7

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       60801   488384001    7  HPFS/NTFS

Disk /dev/sdc: 2000.4 GB, 2000365289472 bytes
255 heads, 63 sectors/track, 243197 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005f107

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      243198  1953480704    7  HPFS/NTFS