Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ZFS on Linux - right way to upgrade to newer version
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1127

PostPosted: Fri Nov 22, 2013 1:12 pm    Post subject: ZFS on Linux - right way to upgrade to newer version Reply with quote

hello.

right now, I'm using sys-fs/zfs-0.6.2-r2 on my storage system and sys-fs/zfs-0.6.2-r3 become available. root/boot are on ext4.
what should be the right procedure to upgrade to newer zfs version?

1. stop all services (there are many) using zfs pool
2. export pool
3. stop /etc/init.d/zfs service (which will probably unload old modules)
4. check if zfs modules are unloaded and if not unload them manually
5. emerge -u zfs
6. start /etc/init.d/zfs
7. import pool ???
8. start all services needing zfs

do I miss some step here or am I wrong in any other way?

should procedure be similar or even the same with more major upgrade, like from 0.6.2 to 0.6.3 once it becomes available?


thx.
_________________
gentoo user
Back to top
View user's profile Send private message
peje
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jan 2003
Posts: 89

PostPosted: Fri Nov 22, 2013 5:14 pm    Post subject: Reply with quote

Normaly I just emerged the newer version and rebootet..
cu Peje
Back to top
View user's profile Send private message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1127

PostPosted: Sat Nov 23, 2013 1:43 am    Post subject: Reply with quote

so, the recipe should be:

1. upgrade the packages
2. cross your fingers
3. reboot

?

:)
_________________
gentoo user
Back to top
View user's profile Send private message
peje
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jan 2003
Posts: 89

PostPosted: Sat Nov 23, 2013 9:10 am    Post subject: Reply with quote

Yep that is my receipt (it would be wise to take a snapshot..)
cu Peje
Back to top
View user's profile Send private message
ryao
Developer
Developer


Joined: 27 Feb 2012
Posts: 122

PostPosted: Mon Nov 25, 2013 1:56 pm    Post subject: Reply with quote

All of the ways stated here will work fine when dealing with revision bumps. Since I received a request to make an official comment on the proper way to update, hereere is a generic procedure for doing updates:

  1. Snapshot your rootfs. This is not strictly necessary, but it is a good practice.
  2. Emerge the updates
  3. If ZFS is loaded by your initramfs, rebuild the initramfs.
  4. Reload the kernel module. If your rootfs is on ZFS, this involves a reboot. Otherwise, you can just stop everything using ZFS datasets, export your pools, modprobe -r zfs, modprobe zfs, import your pools and restart your services.


It is basically what people here already here. Since my rootfs is on ZFS, here are the exact commands that I run on my system:

  1. zfs destroy rpool/ROOT/gentoo@install
  2. zfs snapshot rpool/ROOT/gentoo@install
  3. genkernel ': genkernel all --no-clean --no-mountboot --makeopts=-j12 --zfs --bootloader=grub2 --callback='emerge @module-rebuild'
  4. kexec -l /boot/kernel-genkernel-x86_64-3.12.0 --initrd=/boot/initramfs-genkernel-x86_64-3.12.0 --append='root=ZFS=rpool/ROOT/gentoo'
  5. /etc/init.d/xdm stop
  6. kexec -e


Note that this latter procedure is specific to my system in a few key ways:

  1. I am using the Nvidia X11 driver, which is able to reinitialize the graphics hardware if X11 is killed before kexec -e is called. Nvidia tells me that this is not supported, but I found that it works (on my system anyway). Nouveau was able to reintialize the graphics hardware regardless before Linux 3.7, but this broke in Linux 3.7. I don't know about other graphics drivers.
  2. Using kexec in this way is similar to a sudden power loss followed by regaining power. Therefore, this can really mess up most non-ZFS filesystems, including those used in virtual machines. I do not use any non-ZFS filesystems on my system and my virtual machine guests use either ZFS or virtfs, so I can get away with this.
  3. My rootfs contains both / and /boot. Therefore, a rollback will properly rollback everything that changed.


With that said, the /dev/zfs ioctl API is not stable, so there can be problems when the userland tools and kernel modules are mismatched. This only happens between upstream tags and it is perfectly safe to mix and match ebuild revisions. However, I recommend always running the latest kernel and userland tools that I tag because they contain important fixes. The procedures that I outlined above should both be fine for dealing with /dev/zfs ioctl API changes.
Back to top
View user's profile Send private message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1127

PostPosted: Wed Nov 27, 2013 4:15 pm    Post subject: Reply with quote

thank you very much for the official reply.

should some part of your post be included in
http://wiki.gentoo.org/wiki/ZFS ?
_________________
gentoo user
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum