Duplicating Hard Drive - Page 1
Forum section: electronics / general

author: bostonman
author_rank: Super Contributor
timestamp: October 03, 2022, 03:15:59 am
content: 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.

author: GigaJoe
author_rank: Frequent Contributor
timestamp: October 03, 2022, 04:21:31 am
content: you can attach drive to Windows PC by USB-SATA and make an image by software , goggle will help., so it would be backupyou may google how to resize partition to shrink in size, by softwareand make an image again in file as you backup but smaller, using Windows PC

author: nightfire
author_rank: Frequent Contributor
timestamp: October 03, 2022, 09:17:05 am
content: 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=1MThen 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.

author: bostonman
author_rank: Super Contributor
timestamp: October 03, 2022, 12:34:25 pm
content: QuoteI'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).QuoteThis 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?

author: nightfire
author_rank: Frequent Contributor
timestamp: October 03, 2022, 01:14:30 pm
content: 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 itselfif= ->input file (in this case, a device)of= ->output filebs ->blocksizeThe 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.

author: alm
author_rank: Super Contributor
timestamp: October 03, 2022, 02:02:21 pm
content: 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.

author: pqass
author_rank: Super Contributor
timestamp: October 03, 2022, 02:24:15 pm
content: Quote from: bostonman on October 03, 2022, 12:34:25 pm"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.

author: coromonadalix
author_rank: Super Contributor
timestamp: October 03, 2022, 02:48:30 pm
content: You have some dock stations who will do this automatically, a full drive clonesome 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

author: JohanH
author_rank: Frequent Contributor
timestamp: October 04, 2022, 07:10:27 am
content: Quote from: bostonman on October 03, 2022, 03:15:59 amYou 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.

author: TheNewLab
author_rank: Frequent Contributor
timestamp: December 25, 2022, 12:55:11 pm
content: 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"

author: geggi1
author_rank: Frequent Contributor
timestamp: December 26, 2022, 06:42:33 pm
content: get one of the tools used for migrating discs.Most manufacturers of SSD drives got these tools downloadeble for free.

author: ejeffrey
author_rank: Super Contributor
timestamp: December 28, 2022, 10:20:14 pm
content: Quote from: bostonman on October 03, 2022, 03:15:59 amSo 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: nightfireThis 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.