NetBSD-Users archive

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

Re: Scripting fdisk

On 20.09.2010 10:07, Stephan wrote:
> Hi,
> I would like to use fdisk in a script. It should create one partition (0) in
> a vnd device and assign the whole space to it.
> I tried "-f -u -0" but thats not the answer.

You would have to add "-s id/start/size" in it, although I am not sure
that fdisk(1) can figure out the size by itself "automagically". For
that, I would try with -S, compute the size:

$ PARTSIZE=$(fdisk -S | awk -F= '/BDLSIZE/ {print $2}')
$ PARTSIZE=$(expr $PARTSIZE - 63)
$ fdisk -fu0 -s "169/63/$PARTSIZE" <yourdevice>

or something approaching might work.

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index