tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding an ioctl to check for disklabel existence



On Thu 03 Oct 2019 at 10:17:47 -0700, John Nemeth wrote:
> On Oct 3,  2:42pm, Rhialto wrote:
> } I was thinking the other day that it might be useful if gpt had a
> } subcommand to spit out a script to duplicate the partitioning of a disk,
> } but without the "unique" parts. The script would of course be
> } hand-editable for any changes one might want to make.
> 
>      By "unique" parts, do you mean just the UUIDs, or do you mean
> other parts as well?  What would the output look like?

Just the UUIDs, those are the things I'm aware of.

The sort of script I was thinking of would be something like this:

    gpt destroy sd1
    gpt create sd1
    gpt add -a 2m -l efi   -s  128m -t efi  sd1
    gpt add -a 2m -l root  -s  768m -t ffs  sd1
    gpt add -a 2m -l var   -s    3g -t ffs  sd1
    gpt add -a 2m -l swap  -s 8200m -t swap sd1
    gpt add -a 2m -l usr   -s   20g -t ffs  sd1
    gpt add -a 2m -l tmp   -s 1024m -t ffs  sd1
    gpt add -a 2m -l home  -s  128g -t ffs  sd1

It would leave out all/most things that are defaulted.
(probably when automatically generated it would use the -a alignment
only on the first partition, or if there is unused space between them)
(maybe it would even use some shell variables for things like the disk
device)

>      The bit about not modifying it is more of a caution.  You can
> modify it if you're careful (checksums are recomputed during
> restore).  Obviously if you make an error, it may not be usable
> for restore, so you should work with a copy.

Yes, when I wanted to clone the partitioning of my disk, I was indeed
thinking of modifying the output from 'gpt backup', but it seemed a bit
easier to create a little script such as the above, in case I want to
make the same partitions again later. (In fact the version that I really
used had some "are you sure" type prompts in it)

-Olaf.
-- 
Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index