I'm trying to create software to restore backups that I already create with scripts. I haven't needed to restore any, fortunately, but now I want to move the contents of one of my backups to a SSD drive, and it turns out it's harder than I expected.
Right now I'm trying to recreate the partition table. I'd like to use parted because it seems the easiest of the available tools to use in a script. I see two things that are puzzling me.
First, a command like
parted /dev/sdh mklabel gpt mkpart primary fat32 2048 4096 print
makes a gpt partition table and a partition, but it shows a name "primary" and that is what blkid calls a "PARTLABEL". Reading the info and man pages seems to indicate it should be the filesystem type, not name. On experimentation, it appears no fs type is accepted any more, and that is the name instead.
The second problem is: I do not want a name on the partition at all, but I've tried ""
and " "
with no luck.
So: how do I create a partition without a PARTLABEL? I can certainly do it in gparted, but I cannot script that.
I found the way, and boy is it odd. If I want parted to accept a blank string (at least for this purpose) I have to quote it three times. That's right, three.
It looks like this:
So it's a backslash-space inside single quotes inside double quotes. That works, and I've been unable to find anything simpler. For instance if I just leave it out, parted still accepts the command, but uses 'ntfs' both as a filesystem type and a partition name.
Grrrrr.