Author Topic: Duplicating Hard Drive  (Read 1495 times)

0 Members and 1 Guest are viewing this topic.

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: us
Duplicating Hard Drive
« on: October 03, 2022, 03:15:59 am »
I have an old piece of test equipment that runs Win98 and it has a 2.5" SSD 120GB that I installed. The OS works fine, but fear someday the drive will fail.

Long story short, I have an image, but would like to just duplicate the hard drive so I have one or maybe two drives that I can toss in should this drive fail.

I have a duplicator that allows me to insert both drives and it automatically duplicates the drive with the push of a button, but it most likely fail if I use another 120GB drive because the new one may not be a full 120GB causing a duplication error. Going to a larger size drive is a waste of money since I'm only using less than 1GB.

Does a reliable way exist in Linux that will allow me to make an image of only used sectors and then I can burn that image to a new drive?

From what I'm seeing, I can't locate less than 120GB SSD drive regardless.
 

Offline GigaJoe

  • Frequent Contributor
  • **
  • Posts: 511
  • Country: ca
Re: Duplicating Hard Drive
« Reply #1 on: October 03, 2022, 04:21:31 am »
you can attach drive to Windows PC by USB-SATA and make an image by software , goggle will help.,  so it would be backup
you may google how to resize  partition to shrink in size, by software
and make an image again in file as you backup but smaller, using Windows PC


 

Offline nightfire

  • Frequent Contributor
  • **
  • Posts: 587
  • Country: de
Re: Duplicating Hard Drive
« Reply #2 on: October 03, 2022, 09:17:05 am »
In Penguinland, dd is your friend.
You can do something like this:

dd if=/dev/sda of=/mnt/usb1/image-of-old-win98.raw bs=1M

Then an image of the existing harddrive would get put to the usb device. Put only the current partition in, and only the partition blocks will get copied. For enhancement, this could be piped through gzip etc.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 2076
  • Country: us
Re: Duplicating Hard Drive
« Reply #3 on: October 03, 2022, 12:34:25 pm »
Quote
you can attach drive to Windows PC by USB-SATA and make an image by software , goggle will help.,  so it would be backup
you may google how to resize  partition to shrink in size, by software
and make an image again in file as you backup but smaller, using Windows PC

I'd like to try avoiding doing any manual partitioning since I'm not well experienced in it. I think DD in Linux is useful since I've used it before, but I'm unfamiliar with the commands (which were provided in the last post).

Quote
dd if=/dev/sda of=/mnt/usb1/image-of-old-win98.raw bs=1M

This drive is only one partition, so I think this one Linux line may be adequate. Can you give a quick breakdown of what this command is doing?
 

Offline nightfire

  • Frequent Contributor
  • **
  • Posts: 587
  • Country: de
Re: Duplicating Hard Drive
« Reply #4 on: October 03, 2022, 01:14:30 pm »
Attention: Look for the right device descriptors before running dd, as it might overwrite the wrong partition...
Easy way is to look at the dmesg output after start and determine device designators that apply.

dd ->command itself
if= ->input file  (in this case, a device)
of= ->output file
bs ->blocksize

The blocksize parameter is not really needed, but bundles together some transactions, so that not every read/write causes some IRQ load.

Basically dd reads from one file unless it ends, and writes it simultaneously in bs chunks to the target.
Here you can specify the whole raw device, or even partitions. In this case, I would go for the complete device to get everything, and compress the image via gzip.
dd can be piped through gzip, so it can do that whilst writing.

 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: Duplicating Hard Drive
« Reply #5 on: October 03, 2022, 02:02:21 pm »
If you want a smarter tool that only copies used sectors, look at PartImage or FSArchiver. These rely on knowledge of the filesystem, so with obscure operating systems or for ultimate confidence a full bitwise copy like with dd is safer.

g4l is a bootable tool that includes FSArchiver and other tools in a menu-driven interface.

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: ca
Re: Duplicating Hard Drive
« Reply #6 on: October 03, 2022, 02:24:15 pm »
Quote
dd if=/dev/sda of=/mnt/usb1/image-of-old-win98.raw bs=1M

This drive is only one partition, so I think this one Linux line may be adequate. Can you give a quick breakdown of what this command is doing?

"if" is the input file (source); a disk device file in the example
"of" is the output file (destination); a regular file located on a mounted USB device in the example
"bs=1M" sets block size to 1 megabyte; dd will read 1M at a time into memory.  The default is 512 (if bs is not present) and copy speed would be slower if you didn't use a large block size (where seek time > time to read a block).  Although, with SSD, the seek time is much faster, it may not matter much.  You can also add "status=progress" option to show how far along the copy is progressing.

"/dev/sda" in the example provided is very likely the disk that Linux was booted from. Your SSD [to be copied] will probably be the next; "/dev/sdb".   This disk device file includes the MBR (master boot record) where the 4-entry partition table is located.

dd copies all disk blocks verbatim including blocks not allocated to files. As previously mentioned, you can compress dd output on-the-fly; eg: "dd if=/dev/sdb bs=1M | gzip > /DESTINATION_DIR/sdb-backup-20221003.gz"
However, you should first fill those unallocated blocks [containing random data] with repeating characters. You can do that [in Win98] by creating a file (or files) with with the same content (say, all "AAA...") until you almost fill the SSD. Then delete them all.
 

Offline coromonadalix

  • Super Contributor
  • ***
  • Posts: 6599
  • Country: ca
Re: Duplicating Hard Drive
« Reply #7 on: October 03, 2022, 02:48:30 pm »
You have some dock stations who will do this automatically,  a full drive clone

some come with ide / sata connectors,  i have one  with sata only, fully autonomous or usb3 ... push a button for 10 secs and let it go ...


https://www.amazon.ca/Dual-Bay-External-Duplicator-Tool-free-Supported-Update/dp/B073QLNV5Z
 

Offline JohanH

  • Frequent Contributor
  • **
  • Posts: 655
  • Country: fi
Re: Duplicating Hard Drive
« Reply #8 on: October 04, 2022, 07:10:27 am »

Does a reliable way exist in Linux that will allow me to make an image of only used sectors and then I can burn that image to a new drive?

From what I'm seeing, I can't locate less than 120GB SSD drive regardless.

You have to shrink the old partition first if you want to copy it to a potentially smaller disk. In Linux, you can do this with parted (command line) or gparted (GUI frontend). Then whatever clone method should work, but you have to include the boot sector.
 
The following users thanked this post: Helio_Centra

Offline TheNewLab

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: us
Re: Duplicating Hard Drive
« Reply #9 on: December 25, 2022, 12:55:11 pm »
Excellent Question!

For Linux, CLonezilla. Should work with windows. clone or make an ISO image. Just install it on a drive larger than the current one. You can also partition the drive to use all the extra space to a separate volume if you desire.

MacOX is different. Apple uses a hidden partition that prevents a true mirror of cloning of your active drive.
However, that is a shareware app called "carbon copy cloner" or close to that.

I use all the above to clone my systems, after adding all other programs and making all my settings to everything. So I have a clean LT backup working setup.  You might have also guessed, I do keep older OS that I "freeze"

Freeze your OS = no longer safe for the internet or will work with updates.
Also called "lock your system"
 

Offline geggi1

  • Frequent Contributor
  • **
  • Posts: 441
Re: Duplicating Hard Drive
« Reply #10 on: December 26, 2022, 06:42:33 pm »
get one of the tools used for migrating discs.
Most manufacturers of SSD drives got these tools downloadeble for free.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: us
Re: Duplicating Hard Drive
« Reply #11 on: December 28, 2022, 10:20:14 pm »
I have an old piece of test equipment that runs Win98 and it has a 2.5" SSD 120GB that I installed. The OS works fine, but fear someday the drive will fail.

Long story short, I have an image, but would like to just duplicate the hard drive so I have one or maybe two drives that I can toss in should this drive fail.

I have a duplicator that allows me to insert both drives and it automatically duplicates the drive with the push of a button, but it most likely fail if I use another 120GB drive because the new one may not be a full 120GB causing a duplication error. Going to a larger size drive is a waste of money since I'm only using less than 1GB.

Does a reliable way exist in Linux that will allow me to make an image of only used sectors and then I can burn that image to a new drive?

From what I'm seeing, I can't locate less than 120GB SSD drive regardless.

So a 128 GB SSD seems to cost... $12?  For $30 you can get a name brand 250 GB SSD?  If you have the duplicator and want this to work, that seems like a pretty good solution.

Anyway, you can use one of many partitioning / data migration tools to shrink the existing filesystem by a few GB.  Then you can copy that to the new drive without worrying about truncation.

Quote from: nightfire
In Penguinland, dd is your friend.
You can do something like this:

dd if=/dev/sda of=/mnt/usb1/image-of-old-win98.raw bs=1M

This is an adequate way to do a partition backup to an image file, but tools like clonezilla automate this and do it better, often faster, and with fewer chances to make mistakes.  However, it does not address your question at all, since it won't enable you to restore to a slightly smaller drive without causing problems, essentially truncating the last small amount of the filesystem.  Even if no files are there, that still creates a corrupt filesystem.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf