NetBSD-Users archive

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

Re: Constructing a GPT disk image



brook%nmsu.edu@localhost (Brook Milligan) writes:

>- create an empty image file by, for example, dd if=3D/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=3Ddisk.img of=3D/dev/rXXX =E2=80=A6

You can also:

- create an empty image file by, for example, dd if=/dev/zero of=disk.img ...
- configure vnconfig: vnconfig -c vnd0 disk.image
- label vnd0 with gpt create vnd0
- create partitions on vnd0: gpt add -t ffs ... vnd0
and continue as above.

vnd also understands sparse files, with e.g.

   dd if=/dev/zero of=disk.img bs=1k count=1 seek=1048575

you would create a 1 GByte file but only allocate and write the last 1 kB.
When vnd0 then writes it allocates blocks as necessary. As long as the disk
image isn't filled completely, that method is more efficient.



Home | Main Index | Thread Index | Old Index