NetBSD-Users archive

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

Re: Constructing a GPT disk image




> On May 23, 2021, at 3:01 PM, Michael van Elst <mlelstv%serpens.de@localhost> wrote:
> 
> brook%nmsu.edu@localhost (Brook Milligan) writes:
> 
>> - vnconfig seems to want a file that corresponds to a single partition, =
>> not a partitioned disk.
> 
> vnconfig wants a file that corresponds to a partitioned disk.

Nice to know.  Thanks.

>> Is this a correct procedure?  Is it the best option?  What would be =
>> needed to recognize wedges in a GPT disk image so this could be =
>> simplified (i.e., create the GPT file image and mount the wedges =
>> directly)?
> 
> When you use vnconfig to attach a file as a disk, a GPT is detected
> and wedges are created automatically.

Perfect.  Got it.

So for the record, the procedure is:

- create an empty image file by, for example, dd if=/dev/zero of=disk.img ...

- label image file with gpt create disk.img

- create partitions on image file: gpt add disk.image -t ffs ...

- configure vnconfig: vnconfig -c vnd0 disk.image

- find wedges: dkctl vnd0 listwedges

- create a filesystem: newfs /dev/rdkX

- mount filesystem: mount /dev/dkX /mnt

- populate filesystem with stuff

- unmount filesystem: umount /mnt

- unconfigure vnconfig: vnconfig -u vnd0

- copy filesystem to a device: dd if=disk.img of=/dev/rXXX …

Thanks for your help.

Cheers,
Brook


Home | Main Index | Thread Index | Old Index