# How to force use of /etc/rc.initdiskless?



## hruodr (Apr 18, 2018)

How is it supposed to do that in a non diskless machine?

In the article:

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/solid-state/index.html

it is explained how to install FreeBSD on solid state devices and supposes that use of /etc/rc.initdiskless without explaining how should this happen.

As far as I know, in a real diskless machines this happens automatically because it is recognized that root is mounted with nfs.

Should I edit the rc scripts? Is this the recommended way?


----------



## Bobi B. (Apr 18, 2018)

Read diskless(8). Browse thru /etc/rc (hint: search for `rc.initdiskless`), next is /etc/rc.initdiskless, which contains a large description of what it does, on top.


----------



## hruodr (Apr 18, 2018)

Thanks Bobi,

but before answering, could you please read the question you answer?

Did you realy think that I did not take a look at /etc/rc and /etc/initdiskless and that I never read diskless() man page? And did you read them for feeling so sure that they answer my question?


----------



## SirDice (Apr 20, 2018)

hruodr said:


> Did you realy think that I did not take a look at /etc/rc and /etc/initdiskless and that I never read diskless(8) man page?


Apparently you didn't look closely enough, it took me less than 20 seconds to find it in /etc/rc:

```
dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then
        sh /etc/rc.initdiskless
fi
```

Note the check on the existence of /etc/diskless.


----------



## hruodr (Apr 20, 2018)

You are rihght, I oversaw it. 

Strange mechanism. Is that the only use of /etc/diskless?


----------

