From owner-freebsd-questions@FreeBSD.ORG Tue May 28 11:12:15 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 22742D67 for ; Tue, 28 May 2013 11:12:15 +0000 (UTC) (envelope-from trond@fagskolen.gjovik.no) Received: from smtp.fagskolen.gjovik.no (smtp.fagskolen.gjovik.no [IPv6:2001:700:1100:1:200:ff:fe00:b]) by mx1.freebsd.org (Postfix) with ESMTP id 9367FE95 for ; Tue, 28 May 2013 11:12:14 +0000 (UTC) Received: from mail.fig.ol.no (localhost [127.0.0.1]) by mail.fig.ol.no (8.14.7/8.14.7) with ESMTP id r4SBCAd3035991 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 28 May 2013 13:12:10 +0200 (CEST) (envelope-from trond@fagskolen.gjovik.no) Received: from localhost (trond@localhost) by mail.fig.ol.no (8.14.7/8.14.7/Submit) with ESMTP id r4SBCAxu035988; Tue, 28 May 2013 13:12:10 +0200 (CEST) (envelope-from trond@fagskolen.gjovik.no) X-Authentication-Warning: mail.fig.ol.no: trond owned process doing -bs Date: Tue, 28 May 2013 13:12:10 +0200 (CEST) From: =?ISO-8859-1?Q?Trond_Endrest=F8l?= Sender: Trond.Endrestol@fagskolen.gjovik.no To: s m Subject: Re: freebsd8.2 with /etc mount point can't run correctly In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) Organization: Fagskolen Innlandet OpenPGP: url=http://fig.ol.no/~trond/trond.key MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="2055831798-597971615-1369739530=:72982" X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mail.fig.ol.no Cc: saeedeh motlagh , FreeBSD questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2013 11:12:15 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2055831798-597971615-1369739530=:72982 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Tue, 28 May 2013 15:13+0430, s m wrote: > On 5/28/13, Trond Endrestøl wrote: > > On Tue, 28 May 2013 12:25+0200, Trond Endrestøl wrote: > > > >> On Tue, 28 May 2013 13:29+0430, saeedeh motlagh wrote: > >> > >> > On Tue, May 28, 2013 at 1:16 PM, Trond Endrestøl < > >> > Trond.Endrestol@fagskolen.gjovik.no> wrote: > >> > > >> > > On Tue, 28 May 2013 12:57+0430, s m wrote: > >> > > > >> > > > hello all, > >> > > > > >> > > > i want to install freebsd8.2 with different partitions. i want to > >> > > > have > >> > > > a separated partition for /etc. therefore this is my partitions: / > >> > > > , > >> > > > /var, /etc. /tmp, /usr, swap. > >> > > > > >> > > > but after installing, freebsd can not run correctly and have > >> > > > problem > >> > > > with fstab. i checked my fstab file (fstab file in /etc partition) > >> > > > and > >> > > > every thing is ok. i think i should do something in order to use > >> > > > fstab > >> > > > file in different mount point. is it true? what should i do to have > >> > > > a > >> > > > freebsd with a separate /etc mount point? > >> > > > > >> > > > any comments are appreciated. > >> > > > SAM > >> > > > >> > > If you really want to keep /etc as a separate filesystem, then I > >> > > would > >> > > try something like this: > >> > > > >> > > 1. Create the file /etc-mount and give it the following contents: > >> > > > >> > > #!/bin/sh > >> > > /sbin/mount /dev/ada0pX /etc > >> > > exec /etc/rc $* > >> > > > >> > > 2. Make sure to substitute the right device file for the mount > >> > > command. > >> > > > >> > > 2. Make /etc-mount executable: chmod a+x /etc-mount > >> > > > >> > > 3. On the root filesystem, let /etc/rc be a symlink to /etc-mount. > >> > > > >> > > This is just off the top of my head. It may work, or it may not work. > >> > > > >> > > HTH. > >> > >> > thanks Trond but i think it can not help me. > >> > > >> > you know i want to separate my /etc completely from root. for some > >> > reasons, > >> > i want to unmount /etc while root is mounted. > >> > > >> > by your procedure, i think /etc is dependent to root yet. isn't it? > >> > >> When the system boots, init(8) fires up a shell to execute the > >> commands contained in (the real) /etc/rc. At boot only the root file > >> system is mounted, thus you need a mechanism to mount /etc ahead of > >> normal startup and pass whatever arguments the fake /etc/rc was > >> invoked with on to the real /etc/rc. > >> > >> As long as no processes holds open any files within /etc and you > >> don't need any of the files, /etc/{,s}pwd.db and[!] /etc/group comes > >> to mind, you should be able to unmount /etc at your own pace. I > >> guess you should be in single user mode while doing this. > > > > [Typo corrected.] > > > >> Why do you need this strange detachment anyway? > >> Backups? Snapshots? > thanks guys, > > you know i have a server and change my pwd files most of the time. i > want to safe my server, so i prefer to mount my root read-only and > because of changes in pwd files, i should mount /etc read-write. > therefore i want to separate my /etc from root. > > moreover, if i want to enable journaling on /etc, i should unmount it > (journaling cannot been set for root partition). To enable journaling, i.e. soft updates, for the root filesystem, do the exact following: 1. Reboot into single user mode. 2. Run /sbin/tunefs -j enable /dev/ada0pX 3. Issue the reboot command. > now, do you have any suggestion for my status? how can i mount /etc > partition at boot time? As I said earlier in this thread you need a mechanism for mounting /etc prior to running the startup scripts. OK, here's a more detailed list than the previous one, assuming the root filesystem is currently mounted read-write: 1. Create and edit the file /fake-rc, giving it this contents (the next 3 lines): #!/bin/sh mount /dev/ada0pX /etc exec /etc/rc $* 2. Don't forget to substitute the right device file corresponding to the /etc filesystem. 3. Let /fake-rc be executable: chmod a+x /fake-rc 4. Go to single user mode. I'm still assuming the _root_ filesystem is mounted read-write. Please ensure it is. 5. Unmount /etc. 6. Let /etc/rc be a symbolic link to /fake-rc, by issuing the command: /bin/ln -s /fake-rc /etc/rc 7. Remount /etc manually, i.e. mount /dev/ada0pX /etc 8. Make the necessary changes to /etc/fstab so that the root file system is never mounted read-write during startup. 9. Reboot the system and observe to see if the behaviour is the desired one. Remember this, because this is important: When the system boots, init(8) fires up a shell to execute the commands contained in (the real) /etc/rc. At boot only the _root_ file system is mounted, thus you need a mechanism to mount /etc ahead of normal startup and pass whatever arguments the fake /etc/rc was invoked with on to the real /etc/rc. This is what you would accomplish by erecting /etc/rc on the _root_ filesystem as a symlink to the fake /fake-rc, also on the _root_ filesystem. The fake /fake-rc takes care of mounting /etc at startup and resuming running the startup scripts by executing the real /etc/rc, now that the /etc filesystem is finally mounted (read-write). Use this opportunity to really learn how FreeBSD behaves during startup and what its expectations are. -- +-------------------------------+------------------------------------+ | Vennlig hilsen, | Best regards, | | Trond Endrestøl, | Trond Endrestøl, | | IT-ansvarlig, | System administrator, | | Fagskolen Innlandet, | Gjøvik Technical College, Norway, | | tlf. mob. 952 62 567, | Cellular...: +47 952 62 567, | | sentralbord 61 14 54 00. | Switchboard: +47 61 14 54 00. | +-------------------------------+------------------------------------+ --2055831798-597971615-1369739530=:72982--