1

I've been using parted-magic to backup my computers' system disks for a while.

So far I've been using either sfdisk or sgdisk for saving the partition table; most of the time, if sfdisk fail I'm using sgdisk and everything works, but I got a new notebook with a 32 GB flash storage (seen as /dev/mmcblk0) and I cannot really understand what is going on.

As you can see in the screen capture bellow, sfdisk did work, but the label of the device is "GPT"... So I tried using sgdisk, which ended up in a lot of "Error 38 when determining sector size"

sfdisk vs sgdisk

I thought that because the "disk" was small, they had used an "old style" MBR partition table, but after some googling I tried the command "gdisk -l" and it says it does have a GPT partition table.

gdisk -l

To make things a little more weird, now "sgdisk --backup" seems to work without any error...

So my questions are:

  • What is the best way to determine the type of partition table of a new computer (and to backup/restore it)?
  • Why is there no longer "error 38" messages with sgdisk? (did I accidentally modify something on the partition?)
  • How can I check that a sgdisk backup file is correct? (with sfdisk, this was an ascii file so you could just look into it, but it doesn't seems to work with sgdisk)
  • Bonus: What is the difference between sgdisk and gdisk?
LeFauve
  • 250

1 Answers1

1

After some searching, I was able to partially answer the questions, so here are my findings:

  • What is the best way to determine the type of partition table of a new computer (and to backup/restore it)?

    gdisk -l device_name seems to be the way to go to find out which partition table is used.

    Once you get this, if you have a GPT you backup it with sgdisk --backup=filename, if you don't you backup it with sfdisk -d device_name> filename

  • How can I check that a sgdisk backup file is correct? (with sfdisk, this was an ascii file so you could just look into it, but it doesn't seems to work with sgdisk)

    I think you should be able to load it into gdisk using the recovery menu command l (lowercase L) and then print it with command p. It should be safe as long as you don't use the w command to write back to the device the new GPT.

    To make things easier, I added the following line to my backup script so I can access important information about the GPT: gdisk -l device_name >filename 2>&1. That's a different filename that the one I used with sgdisk --backup of course.

  • Bonus: What is the difference between sgdisk and gdisk?

    sgdisk is the scriptable version of gdisk. The most notable difference is that sgdisk will perform dangerous operations without asking for any confirmation... so be careful when using it.

I still don't know why the "error 38" messages disappeared so feel free to add an answer for that, and to confirm that what I answered is right... or wrong.

LeFauve
  • 250