From owner-freebsd-questions@FreeBSD.ORG Thu Mar 19 11:01:29 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AF3AA08 for ; Thu, 19 Mar 2015 11:01:29 +0000 (UTC) Received: from smtpauth.rollernet.us (smtpauth.rollernet.us [IPv6:2607:fe70:0:3::d]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F5BAE64 for ; Thu, 19 Mar 2015 11:01:29 +0000 (UTC) Received: from smtpauth.rollernet.us (localhost [127.0.0.1]) by smtpauth.rollernet.us (Postfix) with ESMTP id 2A0875940A6 for ; Thu, 19 Mar 2015 04:01:24 -0700 (PDT) Received: from w500-wifi.ramos.link (w500-wifi.ramos.link [IPv6:2a01:240:fe00:82e4:216:eaff:fec1:77da]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtpauth.rollernet.us (Postfix) with ESMTPSA for ; Thu, 19 Mar 2015 04:01:20 -0700 (PDT) Message-ID: <1426762872.4641.29.camel@miguel.ramos.name> Subject: FreeBSD alternatives to Linux's switch_root and vm.block_dump From: Miguel Lopes Santos Ramos To: freebsd-questions@freebsd.org Date: Thu, 19 Mar 2015 11:01:12 +0000 Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rollernet-Abuse: Processed by Roller Network Mail Services. Contact abuse@rollernet.us to report violations. Abuse policy: http://www.rollernet.us/policy X-Rollernet-Submit: Submit ID 27c3.550aac80.804d0.0 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2015 11:01:29 -0000 Hi, My home server is FreeBSD since the 1990s. Motherboards change, processors, disks, something is always kept to maintain a thread of continuity. However, I've been running Linux on the laptop, so I have to make these two questions as an outsider. The context is this: up to now I survived with a part-time server, 8h/24h to save electricity, and now I want it up 24h/24h. Moved it to a low power Intel j1900 mb and now I need to keep the 4 disks from spinning. I have been trying several options: - All normal, except /var/{at,cache,log,run} and maybe spool all tmpfs. - /var is tmpfs, with separate UFS /var/{backups,db,heimdal}. - / is mdmfs with rootfs_name="image" in loader.conf, but this system is so slow reading the image file! - An init_script creates a tmpfs, dump|restore from the real root in an init_script and then init_chroot to the tmpfs. Very fast, but chroot isn't working. There is also the USB pen option, however, that is far from the reliability of running the system from RAM. Two resources have been most helpful: - http://freebsd.1045724.n5.nabble.com/compiling-root-filesystem-into-kernel-preferably-tmpfs-root-filesystem-td4051224.html - https://wiki.freebsd.org/AvgLiveCD In this context, I have two questions: 1) In Linux, there is a sysctl vm.block_dump which allows us to see on dmesg what process caused disk activity. Is there a way to achieve the same on FreeBSD? 2) I don't get the effect I wanted setting the init_chroot variable to init. The init_script mounted tmpfs on /rootfs and setting init_chroot="/rootfs" does chroot, but when I run: # mount /dev/gpt/rootfs on / (ufs, local, read-only) devfs on /dev (devfs, local, multilabel) tmpfs on /rootfs (tmpfs, local) devfs on /rootfs/dev (devfs, local, multilabel) /dev/gpt/usr on /rootfs/usr (ufs, local, noatime, journaled soft-updates) ... This, even though all processes appear to have their root relative to /rootfs. Also, when the rc scripts try to mount the root read-only, they actually try to mount /dev/gpt/rootfs mixing with the mount options for the tmpfs (size=1g). Everything appears mixed. In Linux, there is a utility called switch_root which not only chroots, but it also gets the old root unmounted and the old world really does go away. Is this possible to achieve in FreeBSD? Oh, and a third question: 3) Why is the loader so slow to read an mfs root image (even compressed)? Can I speed it up? Thank you all, comments are welcome too, -- Miguel Ramos pgp:A006A14C