Diskless NFS mounts weirdness
Hi, I've set up a pool of diskless workstations loosely following the instructions in http://www.onlamp.com/pub/a/bsd/2004/09/30/diskless_clients.html Everything runs just fine, except for one weirdness with mount and /var: % mount 192.168.122.1:/var/diskless_ro on / (nfs, read-only) devfs on /dev (devfs, local) 192.168.122.1:/pool/diskless_rw/192.168.122.11/etc on /etc (nfs) /dev/md0 on /var (ufs, local, soft-updates) 192.168.122.1:/pool/diskless_rw/192.168.122.11/tmp on /tmp (nfs) 192.168.122.1:/pool/diskless_rw/home on /home (nfs) 1. /var *is* actually mounted on 192.168.122.1:/pool/diskless_rw/192.168.122.11/var but it is not listed in mount(8)s output. Why? 2. Which part of the system created /dev/md0 and mounted that on /var? I don't need that and would like to save some RAM anyway. It is possible to manually mount /var after booting the workstation, though it doesn't seem to be necessary. All this does is add one line to mount's output: # mount /var % mount 192.168.122.1:/var/diskless_ro on / (nfs, read-only) devfs on /dev (devfs, local) 192.168.122.1:/pool/diskless_rw/192.168.122.11/etc on /etc (nfs) /dev/md0 on /var (ufs, local, soft-updates) 192.168.122.1:/pool/diskless_rw/192.168.122.11/tmp on /tmp (nfs) 192.168.122.1:/pool/diskless_rw/home on /home (nfs) 192.168.122.1:/pool/diskless_rw/192.168.122.11/var on /var (nfs) More details: - The first rc script to run is: server# cat /var/diskless_ro/etc/rc #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin; export PATH boot_ip=`kenv boot.netif.ip` mount -t nfs 192.168.122.1:/pool/diskless_rw/${boot_ip}/var /var mount -t nfs 192.168.122.1:/pool/diskless_rw/${boot_ip}/etc /etc mount -t nfs 192.168.122.1:/pool/diskless_rw/${boot_ip}/tmp /tmp mount -t nfs 192.168.122.1:/pool/diskless_rw/home /home . /etc/rc2 exit 0 We see that /var is (or should be) mounted from the NFS server. This is then followed by rc2, which is nothing more than a copy of the regular /etc/rc, adapted for every single diskless client. Every client has its own fstab, e.g.: server# cat /pool/diskless_rw/192.168.122.11/etc/fstab # DeviceMountpoint FStype Options DumpPass# 192.168.122.1:/var/diskless_ro / nfs ro 0 0 192.168.122.1:/pool/diskless_rw/192.168.122.11/etc /etcnfs rw 0 0 192.168.122.1:/pool/diskless_rw/192.168.122.11/var /varnfs rw 0 0 192.168.122.1:/pool/diskless_rw/192.168.122.11/tmp /tmpnfs rw 0 0 192.168.122.1:/pool/diskless_rw/home /home nfs rw 0 0 All this is not terribly important (as said, everything works just fine), but if someone has already experimented with diskless workstations... :) Thanks, -cpghost. -- Cordula's Web. http://www.cordula.ws/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Diskless NFS mounts weirdness
[EMAIL PROTECTED] wrote: 1. /var *is* actually mounted on 192.168.122.1:/pool/diskless_rw/192.168.122.11/var but it is not listed in mount(8)s output. Why? 2. Which part of the system created /dev/md0 and mounted that on /var? I don't need that and would like to save some RAM anyway. I guess you are using 5.3 or newer? the /etc/rc.d/diskless script has been replaced, by among other things, a script /etc/rc.d/var which creates a memory disk, /dev/md0, using up your precious ram. I have tried to remove the script but get an error because nfs wants to update the /var/db/mounttab - before /var is actually mounted - so the mount fails. The /etc/rc.d/var script creates a memory disk if it detects that /var is read-only - which is the case since the nfs mount failed. And the memory disk is then populated. If the root partition is rw-mounted the nfs-mount will succeed. If you have enough ram this is not a problem, simply let var be a memory disk. You can set the size of the memory disk in rc.conf. /dev/md0 on /var (ufs, local, soft-updates) 192.168.122.1:/pool/diskless_rw/192.168.122.11/var on /var (nfs) Now this is wierd - how can you have to mounts on the same mount point? Cheers, Erik -- Ph: +34.666334818 web: http://www.locolomo.org S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt Subject ID: A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9 Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Diskless NFS mounts weirdness
[EMAIL PROTECTED] wrote: 1. /var *is* actually mounted on 192.168.122.1:/pool/diskless_rw/192.168.122.11/var but it is not listed in mount(8)s output. Why? 2. Which part of the system created /dev/md0 and mounted that on /var? I don't need that and would like to save some RAM anyway. I guess you are using 5.3 or newer? the /etc/rc.d/diskless script has been replaced, by among other things, a script /etc/rc.d/var which creates a memory disk, /dev/md0, using up your precious ram. I have tried to remove the script but get an error because nfs wants to update the /var/db/mounttab - before /var is actually mounted - so the mount fails. The /etc/rc.d/var script creates a memory disk if it detects that /var is read-only - which is the case since the nfs mount failed. And the memory disk is then populated. If the root partition is rw-mounted the nfs-mount will succeed. If you have enough ram this is not a problem, simply let var be a memory disk. You can set the size of the memory disk in rc.conf. /dev/md0 on /var (ufs, local, soft-updates) 192.168.122.1:/pool/diskless_rw/192.168.122.11/var on /var (nfs) Now this is wierd - how can you have to mounts on the same mount point? Wierd yes, but very easy to do. A mount point is just a directory. That directory does not have to be empty. First /dev/md0 was mounted, then the NFS share was mounted. So, the NFS share is what is being used as /var. This indicates poor design (or an error). -- Ean Kingston E-Mail: ean_AT_hedron_DOT_org URL: http://www.hedron.org/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Diskless NFS mounts weirdness
On Tue, Feb 15, 2005 at 05:20:32PM +0100, Erik Norgaard wrote: [EMAIL PROTECTED] wrote: 1. /var *is* actually mounted on 192.168.122.1:/pool/diskless_rw/192.168.122.11/var but it is not listed in mount(8)s output. Why? 2. Which part of the system created /dev/md0 and mounted that on /var? I don't need that and would like to save some RAM anyway. I guess you are using 5.3 or newer? the /etc/rc.d/diskless script has been replaced, by among other things, a script /etc/rc.d/var which creates a memory disk, /dev/md0, using up your precious ram. Yes, it's 5.3-STABLE and /etc/rc.d/var is really the culprit! Thanks for the hint. Now everything makes sense again. If the md-based /var is only needed until the nfs /var is mounted, I could try tweaking the varsize knob in /etc/rc.conf, right? I have tried to remove the script but get an error because nfs wants to update the /var/db/mounttab - before /var is actually mounted - so the mount fails. Exactly. The /etc/rc.d/var script creates a memory disk if it detects that /var is read-only - which is the case since the nfs mount failed. And the memory disk is then populated. If the root partition is rw-mounted the nfs-mount will succeed. Yes, the root partition is read-only, therefore the ramdisk. If you have enough ram this is not a problem, simply let var be a memory disk. You can set the size of the memory disk in rc.conf. There's plenty of RAM on the workstations; it shouldn't be a problem to keep the ramdisk. I've done some monitoring for three weeks or so, and there's hardly any swapping to the nfs swapfiles involved. I only wonder if I could simply reuse /dev/md0 for something else than var (say newfs and mounting it somewhere else, e.g. on /tmp), because: /dev/md0 on /var (ufs, local, soft-updates) 192.168.122.1:/pool/diskless_rw/192.168.122.11/var on /var (nfs) Now this is wierd - how can you have to mounts on the same mount point? That's precisely why I'm asking here! Perhaps the nfs mount is on top of the md mount, masking the ramdisk? There's no union-fs or such hackery involved (at least I suppose so). Cheers, Erik -- Ph: +34.666334818 web: http://www.locolomo.org S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt Subject ID: A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9 Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2 Thanks for the help, -cpghost. -- Cordula's Web. http://www.cordula.ws/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Diskless NFS mounts weirdness
[EMAIL PROTECTED] wrote: On Tue, Feb 15, 2005 at 05:20:32PM +0100, Erik Norgaard wrote: If the md-based /var is only needed until the nfs /var is mounted, I could try tweaking the varsize knob in /etc/rc.conf, right? Yes, 1kb should be enough ?! The interesting thing is that mounttab is only created by nfsclient - on my disk'ed system I have no such file. There's plenty of RAM on the workstations; it shouldn't be a problem to keep the ramdisk. I've done some monitoring for three weeks or so, and there's hardly any swapping to the nfs swapfiles involved. Then simply remove the nfs mounted /var. You want to keep an nfs mounted /var if you have data that you want to keep persistent, but if you keep the nfs /var then you also have to bother about cleaning it up. I only wonder if I could simply reuse /dev/md0 for something else than var (say newfs and mounting it somewhere else, e.g. on /tmp), because: The problem is: If you first unmount the memory disk /var, the nfs mount of /var will fail as before. If you unmount /var after the nfs mount - what are you unmounting? Cheers, Erik -- Ph: +34.666334818 web: http://www.locolomo.org S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt Subject ID: A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9 Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Diskless NFS mounts weirdness
[EMAIL PROTECTED] wrote: On Tue, Feb 15, 2005 at 05:20:32PM +0100, Erik Norgaard wrote: Yes, it's 5.3-STABLE and /etc/rc.d/var is really the culprit! Thanks for the hint. Now everything makes sense again. Bth, this script has three modes: YES, NO, AUTO, auto is default in which the check is done: mkdir -p /var/.diskless If this fails a memory disk is created, else /var/.diskless is removed. If you disable var in your rc.conf, then your nfs mounts fails. Actually, I think the nfs mounts mentioned in your rc-script fails and are then mounted at a later stage - I guess you have your nfs-mounts in your /etc/fstab also, right? Cheers, Erik -- Ph: +34.666334818 web: http://www.locolomo.org S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt Subject ID: A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9 Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]