Re: [Dorset] Is "dd" adequate for cloning a disk?

2023-11-03 Thread JD

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?

2023-11-03 Thread Ralph Corderoy
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?

2023-11-03 Thread JD


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