path: root/cddl/usr.sbin
diff options
authorAlexander Motin <mav@FreeBSD.org>2018-02-21 00:18:57 +0000
committerAlexander Motin <mav@FreeBSD.org>2018-02-21 00:18:57 +0000
commite5a4a83784d26b3804df1c9519078e64776bf10b (patch)
treeba06d0fb4b60e26c2b5cc942efdfe2c91db7e262 /cddl/usr.sbin
parente73c944fc079f7f08a32270eb83854e3270b05e4 (diff)
parent9df2d6f729b7642daf9a1d5d3d610959ba894c3d (diff)
MFV r318941: 7446 zpool create should support efi system partition
illumos/illumos-gate@7855d95b30fd903e3918bad5a29b777e765db821 https://github.com/illumos/illumos-gate/commit/7855d95b30fd903e3918bad5a29b777e765db821 https://www.illumos.org/issues/7446 Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi- system partition. I have borrowed the idea from oracle solaris, and introducing zpool create - B switch to provide an way to specify that boot partition should be created. However, there is still an question, how big should the system partition be. For time being, I have set default size 256MB (thats minimum size for FAT32 with 4k blocks). To support custom size, the set on creation "bootsize" property is created and so the custom size can be set as: zpool create B - o bootsize=34MB rpool c0t0d0 After pool is created, the "bootsize" property is read only. When -B switch is not used, the bootsize defaults to 0 and is shown in zpool get output with value ''. Older zfs/zpool implementations are ignoring this property. https://www.illumos.org/rb/r/219/ Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Yuri Pankov <yuri.pankov@gmail.com> Approved by: Dan McDonald <danmcd@kebe.com> Author: Toomas Soome <tsoome@me.com> This commit makes no sense for FreeBSD, that is why I blocked the option, but it should be good to stay closer to upstream.
Notes: svn path=/head/; revision=329681
Diffstat (limited to 'cddl/usr.sbin')
1 files changed, 9 insertions, 1 deletions
diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index c14009bdf678..19c4abe45fc9 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -239,6 +239,8 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
ZpoolList zpl(ZpoolList::ZpoolByGUID, &m_poolGUID);
zpool_handle_t *pool(zpl.empty() ? NULL : zpl.front());
+ zpool_boot_label_t boot_type;
+ uint64_t boot_size;
if (pool == NULL || !RefreshVdevState()) {
@@ -331,7 +333,13 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
/* Write a label on the newly inserted disk. */
- if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str()) != 0) {
+ if (zpool_is_bootable(pool))
+ boot_type = ZPOOL_COPY_BOOT_LABEL;
+ else
+ boot_type = ZPOOL_NO_BOOT_LABEL;
+ boot_size = zpool_get_prop_int(pool, ZPOOL_PROP_BOOTSIZE, NULL);
+ if (zpool_label_disk(g_zfsHandle, pool, devPath.c_str(),
+ boot_type, boot_size, NULL) != 0) {
"Replace vdev(%s/%s) by physical path (label): %s: %s\n",
zpool_get_name(pool), VdevGUIDString().c_str(),