Disk 2 Disk (Part Deux)

View: New views
4 Messages — Rating Filter:   Alert me  

Disk 2 Disk (Part Deux)

by Al Grant :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I know it has been partly covered in posts before. But I never felt I had enough info to copy disk to disk.

I have a spare disk here I thought I would give it a go with. The disk is a :

Hitachi 100Gb 2.5

My disks are as follows:

al@al-ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xaf010487

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       30401   244196001   83  Linux

Disk /dev/sdb: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xeed6ce43

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       12136    97482388+   7  HPFS/NTFS
al@al-ubuntu:~$

The 250Gb is my main linux drive and the 100Gb is the Hitachi. I have not yet added another 2.5" drive to image to.

In fact for safetys sake I will image the 100Gb drive in its entirety to my main linux drive (sda). This does raise my first question though:

1) When going disk to disk can you image both the whole drive and all its partitions or can you only go disk to disk on a partition by partition basis?

Off to copy the disk now:

al@al-ubuntu:~$ sudo ddrescue -vn /dev/sdb /home/al/rhonda.bin rhonda.log


About to copy 100030 MBytes from /dev/sdb to /home/al/rhonda.bin
    Starting positions: infile = 0 B,  outfile = 0 B
    Copy block size: 128 hard blocks
Hard block size: 512  bytes
Max_retries: 0    
Direct: no    Sparse: no    Split: no    Truncate: no

Press Ctrl-C to interrupt
Initial status (read from logfile)
rescued:         0 B,  errsize:       0 B,  errors:       0
Current status
rescued:     2653 MB,  errsize:       0 B,  current rate:   39845 kB/s
   ipos:     2653 MB,   errors:       0,    average rate:   37903 kB/s
   opos:     2653 MB,     time from last successful read:       0 s
Copying non-tried blocks...

Look forward to any replies on what I need to do to write rhonda.bin off to a new unformatted disk.

TIA

-Al

Re: Disk 2 Disk (Part Deux)

by Marian Csontos-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/27/2009 08:32 PM, Al Grant wrote:

> I know it has been partly covered in posts before. But I never felt I had
> enough info to copy disk to disk.
>
> I have a spare disk here I thought I would give it a go with. The disk is a
> :
>
> Hitachi 100Gb 2.5
>
> My disks are as follows:
>
> al@al-ubuntu:~$ sudo fdisk -l
>
> Disk /dev/sda: 250.0 GB, 250059350016 bytes
> 255 heads, 63 sectors/track, 30401 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Disk identifier: 0xaf010487
>
>     Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *           1       30401   244196001   83  Linux
>    
Is this ext2 or ext3? Does not matter, as it would not work for either.
Your disks use 1KiB blocks, and according to
http://en.wikipedia.org/wiki/Ext2 max.allowed file size is 16GB :-(

> Disk /dev/sdb: 100.0 GB, 100030242816 bytes
> 255 heads, 63 sectors/track, 12161 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> Disk identifier: 0xeed6ce43
>
>     Device Boot      Start         End      Blocks   Id  System
> /dev/sdb1   *           1       12136    97482388+   7  HPFS/NTFS
> al@al-ubuntu:~$
>
> The 250Gb is my main linux drive and the 100Gb is the Hitachi. I have not
> yet added another 2.5" drive to image to.
>
> In fact for safetys sake I will image the 100Gb drive in its entirety to my
> main linux drive (sda). This does raise my first question though:
>
> 1) When going disk to disk can you image both the whole drive and all its
> partitions or can you only go disk to disk on a partition by partition
> basis?
>    
IMO it should work just fine, they are just block devices.

> Off to copy the disk now:
>
> al@al-ubuntu:~$ sudo ddrescue -vn /dev/sdb /home/al/rhonda.bin rhonda.log
>
>
> About to copy 100030 MBytes from /dev/sdb to /home/al/rhonda.bin
>      Starting positions: infile = 0 B,  outfile = 0 B
>      Copy block size: 128 hard blocks
> Hard block size: 512  bytes
> Max_retries: 0
> Direct: no    Sparse: no    Split: no    Truncate: no
>
> Press Ctrl-C to interrupt
> Initial status (read from logfile)
> rescued:         0 B,  errsize:       0 B,  errors:       0
> Current status
> rescued:     2653 MB,  errsize:       0 B,  current rate:   39845 kB/s
>     ipos:     2653 MB,   errors:       0,    average rate:   37903 kB/s
>     opos:     2653 MB,     time from last successful read:       0 s
> Copying non-tried blocks...
>    
Notice only 2.6GB was copied (or I misunderstand the output.)

BTW, it is recommended to unmount any partitions on the device being
copied beforehand.

> Look forward to any replies on what I need to do to write rhonda.bin off to
> a new unformatted disk.
>    
If /dev/sdc is your new disk, then try following:

   sudo ddrescue -vn /home/al/rhonda.bin /dev/sdc

It should recreate the same structure on the new disk, so it is useless
to format the device, but this would leave unused free space, if new
disk is of different size.

Cheers,

-- Marian

> TIA
>
> -Al
>
>    



_______________________________________________
Bug-ddrescue mailing list
Bug-ddrescue@...
http://lists.gnu.org/mailman/listinfo/bug-ddrescue

Re: Disk 2 Disk (Part Deux)

by andrew zajac-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Al.

--- On Thu, 10/29/09, Marian Csontos <mcsontos@...> wrote:

Is this ext2 or ext3? Does not matter, as it would not work for either.
Your disks use 1KiB blocks, and according to
http://en.wikipedia.org/wiki/Ext2 max.allowed file size is 16GB :-(


No.  Ext3 uses 4096 byte blocks by default.  The theoretical max file size is 4TB.

Use tune2fs -l to list the attributes of your ext filesystem.

So, yes Al, you will be able to image that drive onto your linux partition.

> 1) When going disk to disk can you image both the whole drive and all its
> partitions or can you only go disk to disk on a partition by partition
> basis?
>   

You can do whatever you want.  On a practical level, it depends on what your problem is.

If the partition table of the bad drive is still intact and you can see the partitions on the drive, you can image a partition by itself.  Whether you image it to a file or directly to another drive is irrelevant.  However, if you are imaging a single partition, you probably want to image it to another partition and not to the whole destination drive.  So you would partition the target (destination) drive and image, say the bad drive's partition number one (sda1) to the destination drive's partition one (sdb1).  There would be little point in imaging sda1 to sdb (raw block device) if the destination drive is larger than the source (bad drive) since you will not be able to use that space.

You may just as well image it to a file on the partitioned and formatted destination drive.  That way, you don't have to repartition your destination drive.  You just create one filesystem and don't worry about the extra space  - it will still just be there one you are done.

If the partition table (first block) of the bad drive is unreadable, then you can't access any individual partitions - well, you can figure out where they are supposed to be and then just image that, but why bother?  It's just more straightforward to image the whole drive.  Again, you can image it to a file and then mount the partitions on the image file as loop devices or you can image the whole drive to another destination whole drive.

If you image the whole source (bad) drive to one partition on the destination drive, then, once you are done, you need to go through the process of mounting the partition as a loop device and using an offset since there is not supposed to be a partition table at the beginning of a partition.  I find it more straightforward to just image it as a file and go from there.

I just image everything to a file.  If (for kicks and giggles) I wanted to image directly to another drive, I would probably just do drive to drive (example: sda to sdb) or partition to partition (example sda2 to sdb1) depending on what I need.  Although you can do it, I don't see the point of imaging raw drive to partition (sda to sdb1) or partition to raw drive (sda1 to sdb) - there's fewer steps and less thinking/guessing involved in just imaging to file in those cases.

It's like jazz.  There's no wrong moves, just choices that are less appealing than others.

Cheers!



Looking for the perfect gift? Give the gift of Flickr!
_______________________________________________
Bug-ddrescue mailing list
Bug-ddrescue@...
http://lists.gnu.org/mailman/listinfo/bug-ddrescue

Re: Disk 2 Disk (Part Deux)

by Al Grant :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> 1) When going disk to disk can you image both the whole drive and all its
> partitions or can you only go disk to disk on a partition by partition
> basis?
>   

>You can do whatever you want.  On a practical level, it depends on what your problem is.

Hi Andrew,

Thanks for replying - your replies are always pretty good.

The scenario I am thinking of is a drive with some bad sectors and one partition containing Windows XP (NTFS).

By ddrescue disk-disk, then once on the new disk I can run a repair installation and hey presto I have a new disk with a now booting installation of XP.

In most cases the partition table is not affected.

Sound feeasble?

I cant think why I would want to image a single partition, but If I wanted to image /dev/sda1 to a new blank disk, wouldnt I have to first create that partiton, with the correct size, file system type etc first?

Cheers

-Al
PS: I had no problem using dd to write a ddresuce .bin to a new disk.