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.
parted: invalid token:), and if you instead use thenamecommand, it sets the name to a space, which you can't see with parted without -m; see it withparted -sm $dev print. The only thing I found so far that works is to usesgdisk $dev -c 1:""– Peter Jan 12 '21 at 13:26parted -sm /dev/sdj mklabel gpt mkpart "'\ '" ext4 1MiB 8MiB printand got what I needed. – ForDummies Jan 18 '22 at 19:07