Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2013, 06:20 PM
Zplay Zplay is offline
Senior Member
 
Join Date: May 2008
Location: France
Posts: 295
Thanks: 1
Thanked 20 Times in 18 Posts
Arrow Adding a disk to the root zpool + log device + cache device
Hello dear PC-BSD user.

Please find this litle guide explaining how to add a disk to your root zpool, which is named "tank" by default. This works also if you want to add a log device.

Normally, if you add a new disk to your root pool, it won't work, and shows this error message
Quote:
root pool cannot have multiple vdevs or separate logs
We will see how to bypass this.
Adding a disk to the zpool
In the following example, I'll add gpt/newdisk to my current pool, as root of course.

Code:
zpool get bootfs tank

NAME  PROPERTY  VALUE              SOURCE
tank  bootfs    tank/ROOT/default  local
Okay, our zpool has "tank/ROOT/default" has bootfs, we need to temporarly remove this, so he won't know he's root anymore !

Code:
zpool set bootfs="" tank
zpool add tank gpt/newdisk

zpool set bootfs=tank/ROOT/default tank
Now, your zpool is composed of two disks ! You can verify with zpool status -v
Adding a log device to the zpool

In the following example, I'll add the log devicegpt/log1 to my current pool. I'm using a laptop with 2 HDD. A mechanical hard drive as my root disk, and a SSD as caching device and separate log. With this, I can have both a lot of space and decent performances. Of course, performances aren't as great as if I used only the SSD alone.

Same as before :


Code:
zpool get bootfs tank

NAME  PROPERTY  VALUE              SOURCE
tank  bootfs    tank/ROOT/default  local
Take note : bootfs= "tank/ROOT/default" has bootfs

Code:
zpool set bootfs="" tank
zpool add tank log gpt/log1

zpool set bootfs=tank/ROOT/default tank
You can verify that your device is correctly added with zpool status -v

Code:
zpool status -v
  pool: tank
 state: ONLINE
  scan: none requested
config:

        NAME         STATE     READ WRITE CKSUM
        tank         ONLINE       0     0     0
          ada1s1a    ONLINE       0     0     0
        logs
          gpt/log1   ONLINE       0     0     0
        cache
          gpt/cache  ONLINE       0     0     0

errors: No known data errors
Adding a cache device to the zpool

This time, this is very easy !

Code:
zpool add tank cache gpt/cache
That's all ! You can verify as usual with zpool status -v


__________________
BSD Associate
Planet BSD : news about *BSD !

Last edited by Zplay; 09-19-2013 at 09:04 PM.
Reply With Quote
The Following User Says Thank You to Zplay For This Useful Post:
Tiberius Duval (09-20-2013)
  #2  
Old 10-13-2013, 09:41 AM
LGE LGE is offline
Junior Member
 
Join Date: Nov 2011
Posts: 22
Thanks: 2
Thanked 3 Times in 3 Posts
Default
This is a very dangerous thing to do.

The problem is not that the root pool is root, the problem is the bootfs flag. This flag means that the bootloader will read from that pool to load the kernel. If the bootloader does not know that the root pool has multiple disks, it may fail to boot.

This bit me quite hard before, at least with the FreeBSD bootloader, maybe grub supports this now.

What happens is the following: ZFS is a Copy-on-Write filesystem; if you modify anything in /boot (yourself or though an update), the blocks written may not be written on the first disk, but the second. This is perfectly fine as far as the OS is concerned, but if the bootloader does not know how to read from more than one disk, it will fail to boot because it won't be able to fetch the blocks from the second disk.

Believe me, if you get into this situation it will be a PITA to get out.
Reply With Quote
  #3  
Old 10-13-2013, 10:25 AM
Zplay Zplay is offline
Senior Member
 
Join Date: May 2008
Location: France
Posts: 295
Thanks: 1
Thanked 20 Times in 18 Posts
Default
Originally Posted by LGE View Post
This is a very dangerous thing to do.

The problem is not that the root pool is root, the problem is the bootfs flag. This flag means that the bootloader will read from that pool to load the kernel. If the bootloader does not know that the root pool has multiple disks, it may fail to boot.

This bit me quite hard before, at least with the FreeBSD bootloader, maybe grub supports this now.

What happens is the following: ZFS is a Copy-on-Write filesystem; if you modify anything in /boot (yourself or though an update), the blocks written may not be written on the first disk, but the second. This is perfectly fine as far as the OS is concerned, but if the bootloader does not know how to read from more than one disk, it will fail to boot because it won't be able to fetch the blocks from the second disk.

Believe me, if you get into this situation it will be a PITA to get out.
Thanks for the information. This case is only when you add a new disk to the pool, not when you add a cache or a log device.

I'm not sure about grub. For my servers with ZFS, I use a gpt-boot partition that I do on every disk, so in case of failure, I need to boot from another disk and it works, and I don't need to mess with grub2.
__________________
BSD Associate
Planet BSD : news about *BSD !
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:16 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.