Re: [Dorset] Is "dd" adequate for cloning a disk?
Hi John, > > sudo -i parted /dev/sda unit B print > > This gives: > > Model: ATA CT500MX500SSD1 (scsi) > Disk /dev/sda: 500107862016B > Sector size (logical/physical): 512B/4096B > Partition Table: msdos > Disk Flags: > > Number Start End Size Type File system > Flags > 1 1048576B 537919487B 536870912B primary fat32 > boot > 2 538967040B 498109251583B 497570284544B extended > 5 538968064B 482185576447B 481646608384B logical ext4 > > Presumably, the PT should not be msdos? No, that could be fine. It's a 512 MiB partition. You might find it mounted once the system boots if you're curious what's in it. Partition 2 reaches furthest into the disk but still leaves a large gap at the end should you want to use GPT. $ units 500107862016B-498109251583B 'GiB;MiB;KiB;B' 1 GiB + 882 MiB + 24 KiB + 1 B $ > > > gdisk says: > > > > > > Partition table scan: > > >MBR: MBR only > > >BSD: not present > > >APM: not present > > >GPT: not present > > > > > > *** > > > Found invalid GPT and valid MBR; converting MBR to GPT format > > > in memory. > > > *** ... > > > I've had no problems so far, so the question is: can I Carry On > > > Regardless? Yes. I think gparted is being misleading. It says GPT is not present but then says it found an invalid GPT. I think it didn't find one and your booting works happily without out. As you were, carry on. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Is "dd" adequate for cloning a disk?
Ralph, On 03/11/2023 16:26, Ralph Corderoy wrote: sudo -i parted /dev/sda unit B print This gives: Model: ATA CT500MX500SSD1 (scsi) Disk /dev/sda: 500107862016B Sector size (logical/physical): 512B/4096B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1048576B 537919487B 536870912B primary fat32 boot 2 538967040B 498109251583B 497570284544B extended 5 538968064B 482185576447B 481646608384B logical ext4 Presumably, the PT should not be msdos? John -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Is "dd" adequate for cloning a disk?
Hi John, > I do have a partition table issue. gdisk says: > > Partition table scan: > MBR: MBR only > BSD: not present > APM: not present > GPT: not present > > *** > Found invalid GPT and valid MBR; converting MBR to GPT format > in memory. > *** What's the output of sudo -i parted /dev/sda unit B print assuming /dev/sda is the SSD drive. This command just prints the partition table, it doesn't modify the disk. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Is "dd" adequate for cloning a disk?
Thanks, Ralph and Andrew. To add to what Ralph said, if the disk uses GUID Partition Table (GPT) then after the clone the backup GPT - which was at the end of the original disk - will now be in the middle. GParted should detect and fix this automatically, otherwise gdisk can do it. You could use Clonezilla instead of dd, which is designed for the task, although you'll still have to expand the partition with something like GParted afterwards. https://clonezilla.org/ Clonezilla is faster as it only clones areas of the filesystems which actually contain data, but that probably doesn't matter for a one-off clone. A good point. dd(1) obviously doesn't do that. I had an idea GParted could when copying a partition because it could use an external filesystem-specific program to do the copy but browsing https://gparted.org suggests I'm wrong. Copying only the important bits is a useful optimisation and it's been used by many over the years. But I always wonder ?If it goes wrong for me, how many years pass before I find the end of some file is missing??. Then I go for dd and copy all the bits, even the ?unused? ones. I did the copy with dd; seems OK but slow - 6 hours. I extended the partition over the whole SSD with gparted. The good news: The speed up for reading was as good as I hoped: TaskHDD SSD From boot to logged in 166s35s Load Visual Studio Code 80s 9s Load OpenOffice Calc40s 9s I didn't create a good test of write speed. I saved a big spreadsheet but that didn't speed up. I suppose buffering could be at work. The bad news: I do have a partition table issue. gdisk says: Partition table scan: MBR: MBR only BSD: not present APM: not present GPT: not present *** Found invalid GPT and valid MBR; converting MBR to GPT format in memory. *** In AskUbuntu (https://askubuntu.com/questions/1314111/convert-mbr-partition-to-gpt-without-data-loss) I found an 18 step procedure to create the GPT but I don't trust myself to do this without error! I've had no problems so far, so the question is: can I Carry On Regardless? The idea to swap to an SSD came from a which? magazine. Understandably, that article didn't mention partition tables. They were providing guidance on Windows laptops, but wouldn't users come up with the same issue? Thanks again, John -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Is "dd" adequate for cloning a disk?
Hi Andrew, > Clonezilla is faster as it only clones areas of the filesystems which > actually contain data, but that probably doesn't matter for a one-off > clone. A good point. dd(1) obviously doesn't do that. I had an idea GParted could when copying a partition because it could use an external filesystem-specific program to do the copy but browsing https://gparted.org suggests I'm wrong. Copying only the important bits is a useful optimisation and it's been used by many over the years. But I always wonder ‘If it goes wrong for me, how many years pass before I find the end of some file is missing?’. Then I go for dd and copy all the bits, even the ‘unused’ ones. :-) -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Is "dd" adequate for cloning a disk?
To add to what Ralph said, if the disk uses GUID Partition Table (GPT) then after the clone the backup GPT - which was at the end of the original disk - will now be in the middle. GParted should detect and fix this automatically, otherwise gdisk can do it. You could use Clonezilla instead of dd, which is designed for the task, although you'll still have to expand the partition with something like GParted afterwards. https://clonezilla.org/ Clonezilla is faster as it only clones areas of the filesystems which actually contain data, but that probably doesn't matter for a one-off clone. -- Andrew. -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
Re: [Dorset] Is "dd" adequate for cloning a disk?
Hi John, > I've bought a SSD to replace the sole HDD in an old laptop (Thinkpad > T410) and I intend to use dd to copy the disk. Does that seem > sensible? I think it should work. This Arch Linux wiki page may be useful as much isn't specific to Arch Linux. It includes using dd(1). https://wiki.archlinux.org/title/Disk_cloning Note, partitions tend to have unique random IDs at the start of them these days and the copy means they are no longer unique because two are present at once. This shouldn't matter much if soon after the copy the machine is shutdown and one of the drives removed. > In particular: > Will the SSD be bootable immediately or is some configuration > change needed? All the disk being copied means the partition table and instructions for booting at the start of the disk will be copied too. Unless your laptop's BIOS needs some change to boot from an SSD, booting once the HHD is removed and the SSD remains should ‘just work’. > The SSD is bigger that the HDD - what will the unused portion look > like Disk which isn't allocated to a partition. > and can I use gparted to expand the single partition or create a > second one? Yes. Others who have done disk cloning more recently may have up to date advice. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk
[Dorset] Is "dd" adequate for cloning a disk?
I've bought a SSD to replace the sole HDD in an old laptop (Thinkpad T410) and I intend to use dd to copy the disk. Does that seem sensible? In particular: Will the SSD be bootable immediately or is some configuration change needed? The SSD is bigger that the HDD - what will the unused portion look like and can I use gparted to expand the single partition or create a second one? Thanks, John -- Next meeting: Online, Jitsi, Tuesday, 2023-11-07 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk