Cloning Win HP to smaller SSD - Page 1
Forum section: electronics / general

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 10:12:05 am
content: This is a continuation ofFailing Win XP HDDhttps://www.eevblog.com/forum/general-computing/failing-win-xp-hdd/where I managed to successfully clone a 1TB HDD to a 3TB HDD and Win XP runs fine there.But that 3 TB HDD is for something else and too big anyway so I want to clone the 336 GB Win XP partition to a smaller 500 GB SSD.So this is what I want to doOrigin:sda = MBR, total 3TB, HDD- sda1 : 336 GB NTFS Win XP- sda2 : 663 GB NTFS Storage- Empty space : 2 TBDestination:sdb : 480 GB, empty, SSDI want to clone the Win XP partition here.I didsudo ddrescue -- force --size 350GB /dev/sda /dev/sdb /home/user/Desktop/mapfile.txtand after a couple hours it completed the cloning successfully. So far so good.Now the SSD has the WIN XP 336 GB partition but when it tries to boot it crashes and it restarts the computer and then just crashes again and again.I thought maybe the second, incomplete partition on the SSD was causing the problem. In Linux it shows a second partition which extends outside the size and boundaries of the SSD. Y tried to delete this (defective) partition but I get the following error:Error deleting partition /dev/sda2: Command-line 'parted --script "/dev/sda" "rm2"' exited with non-zero exit status 1: Error: Can't have a partition outside the disk!gparted gives the same error and will not even start.Well, yes, so now what? How can I make that bad partition just empty space?I think that might correct the problem and let Win XP start.

author: shapirus
author_rank: Super Contributor
timestamp: May 30, 2024, 10:28:34 am
content: It's weird that those partition editing tools crash/error out like that.Try the normal standard "fdisk" (linux). Let's see if it works.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 10:45:59 am
content: Code:sudo fdisk -l /dev/sdaDisk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x3d1f3d1eDevice Boot Start End Sectors Size Id Type/dev/sda1 * 28 655359767 655359740 312.5G 7 HPFS/NTFS/exFAT/dev/sda2 655359768 1953523655 1298163888 619G f W95 Ext'd (LBA)/dev/sda5 655359796 1953523655 1298163860 619G 7 HPFS/NTFS/exFATsda2 and sda5 are bad and need to be deleted. But how? Now what?

author: shapirus
author_rank: Super Contributor
timestamp: May 30, 2024, 10:50:55 am
content: Quote from: soldar on May 30, 2024, 10:45:59 amWell, 1) make sure you have a backup image2) sudo fdisk /dev/sda3) use the interactive command prompt:Command (m for help):

author: Halcyon
author_rank: Unknown
timestamp: May 30, 2024, 11:05:57 am
content: Why do we need another thread, that's just a continuation of the other?

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 11:17:57 am
content: Quote from: Halcyon on May 30, 2024, 11:05:57 amWell, sorry, I considered this is a new and different question. The other one was about rescuing a disk going bad and that was done and the thread kind of got muddled with people arguing side issues so I thought it might be better to start a new thread.This one is a totally different issue which is cloning a good disk to a smaller disk.But if you feel like merging them I have no objection at all.

author: m k
author_rank: Super Contributor
timestamp: May 30, 2024, 11:58:39 am
content: sudo ddrescue -o 462 --size=16 /dev/zero /dev/sdbfrom other thread is how you do it without any hassle.462 is starting point and 16 is length.So changing 16 to 32 and you're clearing tables 2 and 3.You can also edit that earlier created 1st block file by zeroing those above locations.And then write it back using regular dd.sudo dd if=/home/user/Desktop/1st_blk.img of=/dev/sdaBut using fdisk in interactive way is much better.

author: coromonadalix
author_rank: Super Contributor
timestamp: May 30, 2024, 12:16:09 pm
content: you should have stayed in the same thread

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 12:21:16 pm
content: Quote from: coromonadalix on May 30, 2024, 12:16:09 pmAnd who made you moderator?

author: mariush
author_rank: Super Contributor
timestamp: May 30, 2024, 12:40:07 pm
content: It's probably not this but it's worth checking.... it could be something like difference in sector sizes (ex hard drive uses 512 byte sectors while ssd uses 4096 byte sectors or something like that)I haven't used ddrescue , but I used Macrium Reflect in the past to clone drives to SSDs with different size partitions and had no problems with it.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 12:50:07 pm
content: OK, usingfdiskinteractive I did manage to delete the two bad partitions and that left empty space.Then withgnome-disksI formatted that empty space into a new NTFS partition.Now Windows XP starts fine. Sothank you to those who helped. The problem was the "corrupted" partition, as I had suspected.At this point I have the 480 GB SSD with two partitionsThe OS: 330 GB, 25% used (about 79.7 GB), 75% empty"Data": 150 GB, 100% emptyMaybe I should quit while I am ahead but I am thinking several reasons why I would like to reduce the OS partition to, say, 160 GB and add that space to the data storage partition. Is there and easy a not risky way to do it?Because with the OS partition being 150 - 160 GB I could just clone it every so often as a backup and if the SSD fails I can just plug in the backup and boot from there. I think this is a good alternative to just backing up my files.Another option would be to merge both partitions into a single one taking up the entire disk but I think O prefer the other option. What do you think?Tangent side note. I hate it that every time I start Linux it resets the clock to its liking and then I have to reset it when I return to Windows. It seems Linux uses UTC and Windows uses local time.

author: Ian.M
author_rank: Super Contributor
timestamp: May 30, 2024, 01:01:49 pm
content: https://www.howtogeek.com/323390/how-to-fix-windows-and-linux-showing-different-times-when-dual-booting/

author: themadhippy
author_rank: Super Contributor
timestamp: May 30, 2024, 01:04:14 pm
content: QuoteGparted

author: Halcyon
author_rank: Unknown
timestamp: May 30, 2024, 01:05:39 pm
content: Quote from: soldar on May 30, 2024, 11:17:57 amIf it's distinctly different, that's fine. Maybe rename the title to be more specific? Especially since it has a typo in it.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 01:29:27 pm
content: Quote from: Halcyon on May 30, 2024, 01:05:39 pmI added "smaller" to the title which I meant to put there initially and is the crux of the matter and describes the issue better.Could not find a typo though.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 01:33:10 pm
content: Quote from: Ian.M on May 30, 2024, 01:01:49 pmYes, thanks, I am aware but I never dual boot and it is never an issue except now that I am using a Linux Live to rescue a Windows installation. As soon as this is finished that computer should not see Linux again.I like to have separate computers precisely to avoid this kind of issues and MS dirty tricks.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 03:23:54 pm
content: Quote from: themadhippy on May 30, 2024, 01:04:14 pmI did manage to do it albeit with a bit of fumbling around.I am even surprised myself that I have managed to get this far without major mishap because every step was done fumbling in the dark and with trepidation.Gparted is not so bad bcause of the GUI but the command line ones like fdisk and ddrescue are scary.Anyway, all's well that ends well so I call this complete.I will refer to these threads in the future when I clone the OS partition as backup measure.Many thanks to all for your great help.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 03:49:37 pm
content: Oh, now I remember one more thing abut the warning that Win XP did not support TRIM cleanup (which I do not really understand). The impression I got is that this will ony become an issue when the entire partition has been written over and then I will need to do this cleaning up and the process depends on the SSD brand and model.The SSD is Crucial BX500 480GBShould I install any tool and, if so, how should I use it? Or should I just wait until I need it? A search does not clarify the issue for me.

author: amyk
author_rank: Super Contributor
timestamp: May 31, 2024, 01:54:12 am
content: Lack of TRIM is not really a problem unless you want absolute fastest performance, which you're not going to need anyway.Also, that model of SSD is incidentally one that is likely SLC-moddable, probably to 160GB since that's the TLC variant, if you want a lot more endurance.

author: soldar
author_rank: Super Contributor
timestamp: May 31, 2024, 08:07:47 am
content: Quote from: amyk on May 31, 2024, 01:54:12 amI had to look up the acronyms SLC and TLC. It is something I did not know. I do not think I want to mess with this drive but I would buy a 160GB SLC SSD and clone this install there.The thing is that I cannot see that vendors specify the technology of particular drives. How can I know? How can I get a 160GB SLC SSD? I assume Crucial would sell it for about the same price as the TLC 480 GB SSD.

author: shapirus
author_rank: Super Contributor
timestamp: May 31, 2024, 08:39:41 am
content: How much writes will this system do? If it's mostly read only, then you won't gain much from switching to the less dense cell technology.Always keep a sufficiently recent backup image (taken for example withddfrom entire drive), that's pretty much all you need. This is even more important than it is with magnetic drives, because SSDs often fail suddenly and completely rather than gradually.But you will need something to implement TRIM support regardless. I'm not sure there are (still available) tools that can do it under Win XP. Worst case, you can mount the NTFS partitions under linux from time to time and runfstrimmanually (some details athttps://www.vogons.org/viewtopic.php?t=68421)

author: soldar
author_rank: Super Contributor
timestamp: May 31, 2024, 09:00:53 am
content: Quote from: shapirus on May 31, 2024, 08:39:41 amYes, it is not going to get much use and I am sure this SSD drive is OK but I have already reduced the main partition to 160 GB and I am thinking of changing my backup procedure to having three 160 GB SSD drives and periodically cloning and rotating. That way I always have a recent backup and the drives get even wear. Since I already have the main OS partition be 160GB I can just get a couple more 160GB drives and I would rather get them of better quality unless the price difference is huge. Temporarily I might be using some HDDs I was using for backups. I will be backing up the entire partition and not just my data.I am also thinking that formatting and cloning the SSD would obviate the need for TRIM. Yes?

author: shapirus
author_rank: Super Contributor
timestamp: May 31, 2024, 09:13:21 am
content: Quote from: soldar on May 31, 2024, 09:00:53 amThat's reasonable, but watch out: 160 GB isn't always equal to 160 GBMeaning, you want to make sure that the main partition's end offset is below the physical size of the destination SSD drives. Since you will be backing up not only the partition itself, but all data (including the partition table, MBR etc.) from the beginning of the drive to the end of the partition, it may potentially be too big to fit on a 160 GB SSD drive. Check that size before you buy any backup drives. You may need to resize the partition first to, say, 140-150 GB.Quote from: soldar on May 31, 2024, 09:00:53 amThat's an interesting question. I don't know for certain. I'd also like someone to answer this.