some requests for ZFS

Norikatsu Shigemura nork at FreeBSD.org
Sat Dec 20 15:48:03 UTC 2008


Hi Doug!

	I confirmed that your zfsboot code is good on my i386/amd64 note
	PCs after r186243!  Thanks for your works!


	I have two requests:
		1. To support zpool for lsdev like following.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OK lsdev -v
cd devices:
disk devices:
    disk0:   BIOS drive C:
        disk0s1a: ZFS 72GB (63 - 151048055)
        disk0s1b: swap 5120MB (302096047 - 312581808)
        disk0s1a: ZFS 72GB (151048055 - 302096047)
pxe devices:
zfs devices:
  pool: tank
config:

        NAME             STATE
        tank             ONLINE
          ad4s1a         ONLINE
OK
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

		2. To support case of "slice has only zpool and no bsd partition".
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# zpool create tank ad0s1
 and
boot from ad0s1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	SEE ALSO:
	http://lists.freebsd.org/pipermail/freebsd-fs/2008-July/004895.html


--- sys/boot/i386/libi386/biosdisk.c.orig	2008-11-20 01:04:07.000000000 +0900
+++ sys/boot/i386/libi386/biosdisk.c	2008-11-21 02:00:56.078793628 +0900
@@ -469,6 +469,7 @@
 	 * unused.
 	 */
 	if ((lp->d_partitions[i].p_fstype == FS_BSDFFS) ||
+            (lp->d_partitions[i].p_fstype == FS_ZFS) ||
             (lp->d_partitions[i].p_fstype == FS_SWAP) ||
             (lp->d_partitions[i].p_fstype == FS_VINUM) ||
 	    ((lp->d_partitions[i].p_fstype == FS_UNUSED) && 
@@ -477,6 +478,7 @@
 	    /* Only print out statistics in verbose mode */
 	    if (verbose)
 	        sprintf(line, "  %s%c: %s %s (%d - %d)\n", prefix, 'a' + i,
+		    (lp->d_partitions[i].p_fstype == FS_ZFS) ? "ZFS " : 
 		    (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap " : 
 		    (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" :
 		    "FFS  ",
@@ -485,6 +487,7 @@
 		    lp->d_partitions[i].p_offset + lp->d_partitions[i].p_size);
 	    else
 	        sprintf(line, "  %s%c: %s\n", prefix, 'a' + i,
+		    (lp->d_partitions[i].p_fstype == FS_ZFS) ? "ZFS" :
 		    (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap" : 
 		    (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" :
 		    "FFS");
@@ -696,7 +699,8 @@
 
 	if (lp->d_magic != DISKMAGIC) {
 	    DEBUG("no disklabel");
-	    return (ENOENT);
+	    od->od_flags &= ~BD_LABELOK;
+	    od->od_boff = sector;	/* no partition, must be after the slice */
 	}
 	if (dev->d_kind.biosdisk.partition >= lp->d_npartitions) {
 	    DEBUG("partition '%c' exceeds partitions in table (a-'%c')",


More information about the freebsd-current mailing list