From owner-freebsd-questions Thu Aug 19 0: 1:48 1999 Delivered-To: freebsd-questions@freebsd.org Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [212.110.138.1]) by hub.freebsd.org (Postfix) with ESMTP id 61FD014FA5 for ; Thu, 19 Aug 1999 00:01:06 -0700 (PDT) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.9.3/8.9.3/UCB) id JAA26729; Thu, 19 Aug 1999 09:56:02 +0300 (EEST) (envelope-from ru) Date: Thu, 19 Aug 1999 09:56:02 +0300 From: Ruslan Ermilov To: Ludwig Pummer Cc: Gary Kline , Christopher Michaels , questions@FreeBSD.ORG Subject: Re: "shutdown -h now" risk? Message-ID: <19990819095602.C27684@relay.ucb.crimea.ua> Mail-Followup-To: Ludwig Pummer , Gary Kline , Christopher Michaels , questions@FreeBSD.ORG References: <4.2.0.58.19990818161828.00bdc8e0@toy> <6C37EE640B78D2118D2F00A0C90FCB4401105BA8@site2s1> <4.2.0.58.19990818161828.00bdc8e0@toy> <19990818181702.A3248@athena.tera.com> <4.2.0.58.19990818194025.0098b430@toy> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <4.2.0.58.19990818194025.0098b430@toy>; from Ludwig Pummer on Wed, Aug 18, 1999 at 08:55:41PM -0700 X-Operating-System: FreeBSD 3.2-STABLE i386 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Aug 18, 1999 at 08:55:41PM -0700, Ludwig Pummer wrote: > At 06:17 PM 8/18/1999 -0700, Gary Kline wrote: > >On Wed, Aug 18, 1999 at 04:19:50PM -0700, Ludwig Pummer wrote: > > > At 06:35 PM 8/18/1999 -0400, Christopher Michaels wrote: > > > >Can someone explain to me why a "shutdown -r now" would be dangerous? > > > >-Chris > > > > > > It's not. > > > > > > Longer answer: > > > It pops down to single user mode (killing running daemons in the process), > > > syncs the disks, and umounts the filesystems. Those last 2 are the > > > important ones. > > > > > ``shutdown -r now'' does a shutdown and reboot immediately. > > It's ``shutdown now'' that lowers the system from multi-user > > to single-user. > To clarify that "shutdown and reboot immediately": it does first do all > that stuff I mentioned above (except going to single user mode). > > Although I'm no longer so sure about the umounting of the disks. There's no > mention of that in either reboot.c or shutdown.c, but it may be in the > reboot() system call. In any case, fsck doesn't complain when you reboot > after one of the shutdown commands mentioned above. > Exactly, look into /sys/kern/kern_shutdown.c. Syscall reboot() calls boot(), which then calls vfs_unmountall(). > Yes, you're right. It doesn't go to single user mode. I was mistakenly > associating that with killing all of the other processes. > > Looking through the shutdown.c source, I see that 'shutdown -r' just calls > 'reboot -l' and 'shutdown -h' just calls 'halt -l' (and reboot and halt are > just hardlinks to the same program). Reboot does do all of the nice killing > processes and syncing disks, though. > Try looking into the most recent RELENG_3 or HEAD sources. -- Ruslan Ermilov Sysadmin and DBA of the ru@ucb.crimea.ua United Commercial Bank, ru@FreeBSD.org FreeBSD committer, +380.652.247.647 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message