Date: Thu, 19 Mar 2015 11:01:12 +0000 From: Miguel Lopes Santos Ramos <org.freebsd@miguel.ramos.name> To: freebsd-questions@freebsd.org Subject: FreeBSD alternatives to Linux's switch_root and vm.block_dump Message-ID: <1426762872.4641.29.camel@miguel.ramos.name>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1426762872.4641.29.camel>