[geeks] ZFS questions
Jonathan Patschke
jp at celestrion.net
Mon Mar 29 09:50:43 CDT 2021
On Thu, 25 Mar 2021, William Barnett-Lewis wrote:
> zpool create export c1t1d0
> zfs create export/home
Don't do this. You likely already have things in /export, and this will
mount the new pool overtop them. In true Unix fashion, your open files
will continue working, but will be come immediately inaccessible. If
you're not logged in as root, and cannot log in as root remotely, you will
have a situation on your hands.
For common directory trees (/export, /opt, and so on), if you want to
shove a new ZFS filesystem underneath them, create the pool so that it
gets mounted elsewhere, and create the filesystem as you want it to
appear, take the old tree offline, and rename the new.
You will want a root shell (sudo su - root) for the duration of performing
something like:
zpool create export2 c1t1d0
zfs snapshot -r rpool/export/home at migrate
zfs send -R rpool/export/home at migrate export2/home
zfs create -o mountpoint=/old-export rpool/old-export
zfs rename rpool/export/home rpool/old-export/home
Do the same for anything else in /export you want to migrate
If you've only migrated a couple directories, set their mountpoints inside
export:
zfs set mountpoint=/export/home export2/home
Or, if you migrated the whole thing, you can give the whole /export tree
over:
zfs destroy rpool/export
zpool export export2 # "export" here is a zpool verb
zpool import export2 export # "export" here is the new name for the pool
Once you're sure everything is safely over, destroy the old tree:
zfs destroy -r rpool/old-export
> This feels like I am missing something but the oracle online manuals aren't
> very clear to me.
ZFS is a lot like git in that there are the things the manual tells you to
do (which is usually how each component works in greater detail than is
useful), and practices that come from the experience of doing things the
wrong way too many times.
--
Jonathan Patschke
Austin, TX
USA
More information about the geeks
mailing list