Tuesday, 16 August 2016

ZFS rename

With 'zfs rename'subcommand we can do than renaming the file system.
We can accomplish the following operations:

  • Change the file systems' name
  • Relocate the file system within ZFS hierarchy.
  • Rename the file system & relocate it within ZFS hierarchy.

For relocating the file system the following conditions must be satisfied:

  • The file system can be relocated in the hierarchy of the same pool.
  • If there are quota/reservation properties set then there must be enough space available in the destination location in the hierarchy to complete the move operation.

Examples:

I have the following ZFS file system hierarchy under the pool ztest:

root@solarislab:~# zfs list -r ztest
NAME               USED  AVAIL  REFER  MOUNTPOINT
ztest              302K   976M    32K  none
ztest/z1           124K   976M    31K  none
ztest/z1/z2         93K   976M    31K  none
ztest/z1/z2/z3      62K   976M    31K  none
ztest/z1/z2/z3/z4   31K   976M    31K  none

Now to rename z4 to z5 type the following:

root@solarislab:~# zfs rename ztest/z1/z2/z3/z4 ztest/z1/z2/z3/z9
root@solarislab:~#
root@solarislab:~#  zfs list -r  ztest
NAME               USED  AVAIL  REFER  MOUNTPOINT
ztest              304K   976M    32K  none
ztest/z1           124K   976M    31K  none
ztest/z1/z2         93K   976M    31K  none
ztest/z1/z2/z3      62K   976M    31K  none
ztest/z1/z2/z3/z9   31K   976M    31K  none
ztest/zfstest       31K   976M    31K  /test

To move z9 file system from its current location to immediately after z2 in the hierarchy, type:

root@solarislab:~# zfs rename ztest/z1/z2/z3/z9 ztest/z1/z2/z9

root@solarislab:~#  zfs list -r  ztest
NAME            USED  AVAIL  REFER  MOUNTPOINT
ztest           304K   976M    32K  none
ztest/z1        124K   976M    31K  none
ztest/z1/z2      93K   976M    31K  none
ztest/z1/z2/z3   31K   976M    31K  none
ztest/z1/z2/z9   31K   976M    31K  none
ztest/zfstest    31K   976M    31K  /test

No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...