# bsdinstall unattended disk partitioning



## emulder (Apr 3, 2015)

Hi all,

I'm having an issue with applying my desired disk partitioning scheme in an unattended `bsdinstall`, FreeBSD 10.1 (32GB root disk, da0).  After reading the `bsdinstall` man page and related threads on web, I'm still unsure how to apply the scriptedpart target as I have listed below.
I'm calling `bsdinstall script /etc/installerconfig` from rc.local. My relevant etc/rc.local and etc/installconfig are below.


```
# bsdinstall scriptedpart da0 { 8G freebsd-ufs /, 8G freebsd-swap, 8G freebsd-ufs /var, auto freebsd-ufs /usr }
```

I tried adding this line to rc.local before calling `bsdinstall script /etc/installerconfig`, which will indeed partition the disk properly, however the installer then repartitions my disk to it's liking before installing the system.
I also tried to integrate the `bsdinstall scriptedpart da0`  into /etc/installerconfig but could not find proper way to do so. I am able to complete a successful installation with the configuration I listed, but not with the partitioning scheme I desire.  thanks in advance for any help in how to do so,
Eric

/etc/rc.local:

```
#!/bin/sh
export DISTRIBUTIONS="kernel.txz base.txz"
bsdinstall script /etc/installerconfig
```

/etc/installerconfig:

```
PARTITIONS="da0"
DISTRIBUTIONS="kernel.txz base.txz"

#!/bin/sh

echo "Installation complete, running in host system"
echo "autoboot_delay=\"5\"" >> /boot/loader.conf

echo "==> Setting up rc.conf"
cat > /etc/rc.conf << RC_CONF
sshd_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"

RC_CONF

echo "Setup done."
poweroff
```


----------



## getopt (Apr 6, 2015)

I've never done it before, but I was curious enough to look into it. 
So I'm not 100% certain on what follows: 

Regarding rc.local I see no need to mess with that when sitting at a console and having to plug-in an USB stick manually ( /dev/da0).

When /etc/installerconfig is running, it just does what was put in:

```
PARTITIONS="da0"
```
Now that's what you are complaining about. 

If I had a USB-stick here I could have tried before, but you you can try this yourself:

```
PARTITIONS="da0 { 8G freebsd-ufs /, 8G freebsd-swap, 8G freebsd-ufs /var, auto freebsd-ufs /usr }"
```


----------



## emulder (Apr 6, 2015)

Yes, this syntax in installerconfig indeed gives the intended results.


```
PARTITIONS="da0 { 8G freebsd-ufs /, 8G freebsd-swap, 8G freebsd-ufs /var, auto freebsd-ufs /usr }"
```

Thanks getopt.


----------

