Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: transferring data to new HD  (Read 5688 times)

0 Members and 1 Guest are viewing this topic.

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: transferring data to new HD
« Reply #15 on: March 28, 2012, 12:39:38 PM »
Pah, the real pros just create an image file with:

Code: [Select]
dd if=/dev/hda1 -bs 1k | gzip -c > image.tar.gz


and write one using:

Code: [Select]
tar xzOf image.tar.gz | dd of=/dev/hda1 bs=1M

Q. How many utilities does it take to image a hard drive?
A. ONE. the other utilities are unnecessary.

of course this method is not something I would voluntarily use, but it could be useful to bear in mind that the standard tools on most linux distributions provide you with a method of creating and restoring an image, which could be useful in an emergency where other tools aren't available.

(Also, an additional tip for creating the image would be to create a "zero" file that fills up the unused space on the disk being imaged, and then delete it:
Code: [Select]
dd if=/dev/zero of=/mnt/hda1/zeros
then delete it:
Code: [Select]
rm -f /mnt/hda1/zeros
this way the resulting image compresses better. I'm sure using the -c option of gzip you could even pipe the image directly through an ssh connection to a server somewhere.

of course most of this stuff is dealt with by tools such as Clonezilla, Macrium, etc., but if you need to get points with a grizzled Unix veteran, it's worth considering this option, since it's possible he might even give you his emacs configuration file.
I was trying to dereference Null Pointers before it was cool.

joy division

  • Guest
Re: transferring data to new HD
« Reply #16 on: March 28, 2012, 01:41:25 PM »
Well now, it will take more than that assertion to tempt me away from CloneZilla;)  CloneZilla can do the cloning and also some partition resizing.  In fact I just used ddrescue (a program included on the CloneZilla disk) to clone a faulty (i.e. physically damaged) hard drive.  CloneZilla can be a little intimidating at first, but for most purposes you can just run it in beginner mode and it's a piece of cake.

I also use Clonezilla.  Works great. 

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: transferring data to new HD
« Reply #17 on: March 29, 2012, 01:17:05 AM »
Pah, the real pros just...

Only in edge cases, like for example you're attempting to clone a disk with LVM2 volumes, which earlier CloneZilla distributions can't read.  The major disadvantages with dd are it's slow and you can't easily work with different sized partitions/disks.  Taking a moderately-loaded 160GB drive test case, CloneZilla manages to image this in 20 minutes and produces 16GB of image files.  dd takes 8 hours (with no progress bar) and produces a 160GB image file.  For a disk-to-disk copy with identical drives and a file system CloneZilla's other tools struggle with, I'll agree that dd is the only tool for the job.  Much like, when all else fails, you're going to need to take that blocked drain completely apart - but I'm darn sure going to try the sink plunger first.  :D
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

JJ 3000



    Egghead
  • Thanked: 237
  • Experience: Familiar
  • OS: Linux variant
Re: transferring data to new HD
« Reply #18 on: March 29, 2012, 02:36:37 AM »
dd takes 8 hours

It depends on the specified block size. If you don't specify one, it defaults to 512 bytes in each transfer. The optimal block size depends on the hardware you're using.

Also, if the op is seriously considering using dd to copy his failing hard drive, he should add the noerror option to the command.
Save a Life!
Adopt a homeless pet.
http://www.petfinder.com/

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: transferring data to new HD
« Reply #19 on: March 29, 2012, 03:28:50 AM »
if the op is seriously considering using dd to copy his failing hard drive, he should add the noerror option to the command.

Or better yet, use ddrescue.
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: transferring data to new HD
« Reply #20 on: March 29, 2012, 06:58:42 PM »
dd takes 8 hours (with no progress bar) and produces a 160GB image file. 

That's why the commands I noted include the blocksize option, as well as piping directly to or from tar in order to create a compressed file. First one could probably use a larger block size though, 1k is awfully small. If a zero file is used to fill up unused space before hand, the resulting image will typically be smaller than the actual used data on the drive.

Of course as noted I wouldn't typically use this myself. But it could be useful since it also allows you to directly transfer the resulting image over a network or through SSH, or through any tool accepting standard input.
I was trying to dereference Null Pointers before it was cool.