# Questions about NanoBSD



## zennybsd (Mar 17, 2011)

After reading the relevant chapters on NanoBSD from the official manuals, the Absolute FreeBSD book and also from the net, I have some questions about the build.

I compiled a nanobsd _.disk.full and _.disk.image and then copied to the usb stick with *dd*. Gets booted to the point where it asks for mountpoint, giving an error that it could not mount /dev/ad0s1a to / in read-only and /dev/ad0s3 to /cfg read-writable. I manually mount "ufs:/dev/da0s1a" and get the root prompt.

As soon as I get the root prompt, I mount /dev/da0s1a to / and /dev/da0s4 to /cfg in read-writable format, and make the necessary changes that I need in /boot/loader.conf and /etc/rc.conf and /etc/fstab replacing the relevant mountpoints from the usb disk. I also copy the contents of the entire /etc/ directory to /cfg/ directory which is reportedly from where the NaonBSD reads the configurations.

But when I reboot, I still have to reconfigure everything, because next boot does not read anything from /cfg and even it fails to mount /dev/da0s4 which is to be mounted from /etc/fstab (/cfg/fstab). Instead in *dmesg*, I saw /dev/ad0s3 is trying to get mounted in place of /dev/da0s4 for rw /cfg mountpoint.

The original /etc/fstab looked like:


```
/dev/ad0s1a / ufs ro 1 1
/dev/ad0s3 /cfg ufs rw,noatime,noauto 2 2
```

After booting I changed to:

```
/dev/da0s1a / ufs ro 1 1
/dev/da0s4 /cfg ufs rw,noatime,noauto 2 2
```

Is this the normal way NanoBSD behaves? I guess not from what I read online and in books. If not why the specified partitions are not mounted?

I expect responses from NanoBSD/FreeBSD gurus, I know there are a lot of daemon-fans hovering around the forum ;-) Thanks!


----------



## zennybsd (Mar 17, 2011)

Since the moderation policy of forum does not allow me to edit (unless I have 10 posts and 10 days old), I am adding more to the above.

The disk information looks like this:


```
# ls -la /dev/da*
crw-r-----  1 root  operator    0,  93 Mar 17 23:30 /dev/da0
crw-r-----  1 root  operator    0,  94 Mar 17 23:30 /dev/da0s1
crw-r-----  1 root  operator    0, 100 Mar 17 23:30 /dev/da0s1a
crw-r-----  1 root  operator    0,  95 Mar 17 23:30 /dev/da0s2
crw-r-----  1 root  operator    0, 101 Mar 17 23:30 /dev/da0s2a
crw-r-----  1 root  operator    0,  96 Mar 17 23:30 /dev/da0s3
crw-r-----  1 root  operator    0,  97 Mar 17 23:30 /dev/da0s4
```

where he da0s1a is first /, da0s2a is second /, da0s3 is 2MB slice and da0s3 is 32MB partition.

I have two HDDs which I am planning to use as a zfs pool.


```
# ls -la /dev/ad*
crw-r-----  1 root  operator    0,  98 Mar 17 23:30 /dev/ada0
crw-r-----  1 root  operator    0,  99 Mar 17 23:30 /dev/ada1
```


```
# zpool status
  pool: zpool
 state: ONLINE
 scrub: none requested
config:

	NAME        STATE     READ WRITE CKSUM
	zpool       ONLINE       0     0     0
	  raidz1    ONLINE       0     0     0
	    ada0    ONLINE       0     0     0
	    ada1    ONLINE       0     0     0

errors: No known data errors
```

Also created a swap in the zpool itself,


```
# zfs list
NAME         USED  AVAIL  REFER  MOUNTPOINT
zpool       8.00G  1.78T   112K  /zpool
zpool/swap     8G  1.78T    72K  -
```

but when I try *swapon*, I get the following error:


```
# swapon /dev/zvol/
swapon: /dev/zvol/: Block device required
```

Any hint appreciated!


----------



## DutchDaemon (Mar 17, 2011)

zennybsd, use the proper formatting tags, please.


----------



## aragon (Mar 18, 2011)

zennybsd said:
			
		

> Is this the normal way NanoBSD behaves?


No.  You need to set NANO_DRIVE in your build script as the default (ad0) is incorrect for your hardware.  Define that variable, set it to "da0", rebuild skipping kern+world compile, check the contents of the fstab that gets generated, then rewrite the image to your boot device if correct.


----------



## zennybsd (Mar 18, 2011)

@aaron: Thank you for your input. I will certainly follow your advice it next time when I build another image.

Instead, with the help of a pretty helpful gentleman, Nick Hibma (http://markmail.org/message/vy5pool2zfradq2k) who is making some practical enhancement to the nanobsd.sh script, and this thread (http://blog.freenas.org/2010/08/ixsystems-freenas-snapshot.html), I managed to overcome the drive mounting problem by adding *mount -o rw /dev/da0s4* to /conf/default/etc/remount and rebooted and it works fine. Thanks Nick! 

However, I am still struggling with why *swapon /dev/label* does not work? The swap slice is created with z*fs create*. Any hints appreciated?


----------

