From owner-freebsd-questions@freebsd.org Mon Jan 15 12:52:51 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F529E7B632 for ; Mon, 15 Jan 2018 12:52:51 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from relay2.tomsk.ru (mail.sibptus.tomsk.ru [212.73.124.5]) by mx1.freebsd.org (Postfix) with ESMTP id 4BD8F735A8 for ; Mon, 15 Jan 2018 12:52:49 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) X-Virus-Scanned: by clamd daemon 0.98.5_1 for FreeBSD at relay2.tomsk.ru Received: from [212.73.125.240] (HELO admin.sibptus.transneft.ru) by relay2.tomsk.ru (CommuniGate Pro SMTP 5.1.16) with ESMTPS id 39913080; Mon, 15 Jan 2018 18:47:57 +0600 Received: from admin.sibptus.transneft.ru (sudakov@localhost [127.0.0.1]) by admin.sibptus.transneft.ru (8.15.2/8.15.2) with ESMTP id w0FCqiaU061887; Mon, 15 Jan 2018 19:52:46 +0700 (+07) (envelope-from vas@mpeks.tomsk.su) Received: (from sudakov@localhost) by admin.sibptus.transneft.ru (8.15.2/8.15.2/Submit) id w0FCqfZ3061885; Mon, 15 Jan 2018 19:52:41 +0700 (+07) (envelope-from vas@mpeks.tomsk.su) X-Authentication-Warning: admin.sibptus.transneft.ru: sudakov set sender to vas@mpeks.tomsk.su using -f Date: Mon, 15 Jan 2018 19:52:41 +0700 From: Victor Sudakov To: Manish Jain Cc: "freebsd-questions@freebsd.org" Subject: Re: Dualboot and ZFS Message-ID: <20180115125241.GB60956@admin.sibptus.transneft.ru> References: <20180115051308.GA45168@admin.sibptus.transneft.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: AO "Svyaztransneft", SibPTUS X-PGP-Key: http://www.dreamwidth.org/pubkey?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2018 12:52:51 -0000 Manish Jain wrote: > > > > I have a box with dual boot: Windows and FreeBSD/UFS: > > > > $ gpart show ada0 > > => 63 976773105 ada0 MBR (466G) > > 63 1985 - free - (993K) > > 2048 293029888 1 ntfs [active] (140G) > > 293031936 598958080 2 ntfs (286G) > > 891990016 83886080 3 freebsd (40G) > > 975876096 897072 - free - (438M) > > > > $ gpart show ada0s3 > > => 0 83886080 ada0s3 BSD (40G) > > 0 75497472 1 freebsd-ufs (36G) > > 75497472 8388607 2 freebsd-swap (4.0G) > > 83886079 1 - free - (512B) > > > > $ > > > > boot0 handles the OS selection, everything works just fine. > > > > Can I install FreeBSD with root-on-zfs into ada0s3 somehow? > > > > Hi Victor, > > Yes, you can. But you will need a spare slice somewhere - another disk > (SATA / USB). If the used potion of your ada0s3a is small, you can even > use a USB pen drive. > > You can rsync your current installation to the spare slice, and then > mirror the sync back to a newly created ada0s3-zfs. Sorry if my question was misleading, I did not mean converting the existing system from UFS to ZFS at ada0s3. Suppose ada0s3 is an unused slice, I can probably create a zpool thereon. But a few questions remain: 1. Can I install a root-on-zfs system on ada0s3 with bsdinstall? I suppose not? 2. In case of rsync/restore/installworld, what do I do about the VBR in ada0s3? This VBR should support booting from ZFS. Looks like zfsboot(8) allows this. 3. Please see the other questions below, step by step. > > Let's say your spare disk is da0 with 40G spare (or at least the used > size of ada0s3a). > > gpart destroy -F da0 # only if needed > gpart create -s MBR da0 # only if needed > > If da0 already has a spare slice, the 2 steps above are not needed, but > then you will need to replace the slice number instead of da0s1 in the > steps below. > > gpart add -t freebsd da0 # adds da0s1; note the slice number here > gpart create -s BSD da0s1 > gpart set -a active -i 1 da0 > gpart add -t freebsd-zfs da0s1 > zpool create zroot /dev/da0s1a Why are you creating a zpool within a BSD "a" partition, and not in da0s1 directly? I have never seen such a configuration. Is it even possible to set the "freebsd-zfs" type on a BSD partition? And a pool created this way would be non-compatible with beadm. If anyone has a script to create a beadm-compatible set of datasets, please share it. But it's already a different matter. > zpool set bootfs=zroot zroot > gpart bootcode -b /boot/boot0 da0 > zpool export zroot So you suggest using boot0 in MBR with zfsboot in VBR? Will that work? > dd if=/boot/zfsboot of=/tmp/zfsboot1 count=1 > gpart bootcode -b /tmp/zfsboot1 /dev/da0s1 > dd if=/boot/zfsboot of=/dev/da0s1a skip=1 seek=1024 It looks like the procedure described in zfsboot(8) but the da0s1a (the "a" partition) beats me. Should not the pool be in da0s1 ? > zpool import zroot > zfs set checksum=fletcher4 zroot > > > { > cat <<- EOF > > /dev/* > /proc/* > /sys/* > /tmp/* > /mnt/* > /media/* > /lost+found > /usr/ports > /usr/src/* > /zroot > } > /root/excl > > rsync -aAHXv --delete --exclude-from /root/excl / /zroot/ > > > echo 'zfs_load=YES' > /zroot/boot/loader.conf > echo 'vfs.root.mountfrom="zfs:zroot"' >> /zroot/boot/loader.conf > echo 'kern.geom.label.disk_ident.enable=0' >> /zroot/boot/loader.conf ^^^^^^^^^^^^^^^^^^^^^^^^^^^ why would I need to set this sysctl to 0? It's "1" by default on my root-on-zfs boxes. -- Victor Sudakov, VAS4-RIPE, VAS47-RIPN AS43859