Renaming ZFS datasets without unmount.

Jason Hellenthal jhell at DataIX.net
Sat Jun 11 01:51:09 UTC 2011


Arnaud,

On Wed, Jun 08, 2011 at 03:18:36PM +0200, Arnaud Houdelette wrote:
> 
> When I try to rename a mounted dataset with open files, I get the 
> following error :
> 
> [carenath] /home/tzim# zfs rename unsafe/tmp unsafe/temp
> cannot unmount '/tmp': Device busy
> 
> The mountpoint property is set locally :
> 
> [carenath] /home/tzim# zfs get mountpoint unsafe/tmp
> NAME        PROPERTY    VALUE       SOURCE
> unsafe/tmp  mountpoint  /tmp        local
> 
> 
> zfs(1M) says :
> 
>    Renamed file  systems  can inherit new mount points, in which case 
> they are unmounted and remounted at the new mount point.
> 
> 
> But here, the mountpoint should not change. So the file system does not 
> need to be remounted ...
> 
> Either I don't understand something, or there's an "error" in the man, 
> or a bug in zfs rename.
> 

I think your confusion here is coming from the word 'rename' which is
not operating at the file-level but at the VFS level. And in order to
rename filesystem objects on any filesystem that I know of these days
you need to free it by 'unmount' before you can perform any other
operation on it that would dereference its name. Any other condition
could result in a panic condition and also there is no way for the
proccesses that were using it to be notified it was being moved.

Generally filesystems like /tmp would not normally be renamed after they
are created anyway and planning your filesystem layout properly will
prevent from having too much downtime or maintenance time.

AFAIS the correct description and result from using such commands is
adequate to the results that can be obtained and the administrators
knowledge of filesystems.

Noone would dream of renaming /dev/ad0s1a while in operation so I think
the same thing could be thought of 'zfs rename'. Think of datasets as
devices.

> It could be great if zfs allowed "live" renaming of mounted filesystem, 
> as It can avoid headaches...
> 

-- 

"Unity can only be manifested by the Binary. Unity itself and the idea of Unity are already two." -- Buddha

 Regards, (jhell)
 Jason Hellenthal

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 522 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20110611/86c15333/attachment.pgp


More information about the freebsd-stable mailing list