Change Disk Label for a ZFS Dataset?

All your general support questions for OpenZFS on OS X.

Change Disk Label for a ZFS Dataset?

Postby Haravikk » Sun Jan 23, 2022 4:22 am

Is it possible to independently set a disk label for a ZFS dataset?

Currently I have a dataset named zdata/haravikk/Games, but whose mount point is actually /Users/haravikk/Applications/Games/Downloads, intended for games managed by Steam and the like (i.e- can be independently verified and re-downloaded, so they're not a priority for backing up).

My (extremely minor) issue is that the disk label appears to come from the dataset name, so even though it's mounted at ~/Applications/Games/Downloads, it appears in the Finder as if the path were ~/Applications/Games/Games; this isn't an issue for scripts, symlinks or the like as they still reference it via ~/Applications/Games/Downloads as expected, so this is a purely cosmetic issue.

For any other type of device I would just rename the disk to "Downloads" so that it appears correct, but this doesn't appear to be possible for ZFS datasets as trying to rename the drive in the Finder results in an error.

Anyway, I'm just wondering if there is some other way to rename the folder? I don't want to change the dataset name to Downloads as I feel like Games is clearer as to its purpose, and I don't want to create a nested dataset just so that it can be zdata/media/Games/Downloads. Are there any alternatives?
Haravikk
 
Posts: 75
Joined: Tue Mar 17, 2015 4:52 am

Re: Change Disk Label for a ZFS Dataset?

Postby FadingIntoBlue » Sun Jan 23, 2022 3:26 pm

I'm pretty sure the Finder name is set by the name of the mount point directory - I'm wondering why either:

/Users/haravikk/Applications/Games/ or;

/Users/haravikk/Applications/Games/Games-DL

wouldn't be acceptable to you?
Last edited by FadingIntoBlue on Sun Jan 23, 2022 4:10 pm, edited 1 time in total.
FadingIntoBlue
 
Posts: 106
Joined: Tue May 27, 2014 12:25 am

Re: Change Disk Label for a ZFS Dataset?

Postby Haravikk » Sun Jan 23, 2022 3:41 pm

FadingIntoBlue wrote:The finder name is set by the name of the mount directory

Thanks for the response but this isn't the case; the disk appears as "Games" despite the mount directory being "Downloads". This occurs with HFS, APFS etc. volumes as well; you can rename them independently of their mount point, but in the case of ZFS datasets this doesn't appear to work (the name is possibly read-only)?
FadingIntoBlue wrote:I'm wondering why either:
/Users/haravikk/Applications/Games/ or;
/Users/haravikk/Applications/Games/Games-DL
wouldn't be acceptable to you?

I can't use ~/Applications/Games because it contains other games obtained from other sources, e.g- downloaded directly from sites (not via a marketplace), copied from an installer disk (back when I had a drive for those) and so-on, and I will want to keep these in all my backups (as I may not have access to the original installers etc.). I want a separate dataset for games where I don't need to, i.e- ones from Steam where only a single local backup is plenty since I can also re-download them. Games/Games-DL or similar isn't really what I had in mind as it's redundant to have Games twice.

I'm fine living with the appearance of ~/Applications/Games/Games if there's no alternative, I was just hoping there might be some way to rename it or trick the Finder into using another name.
Last edited by Haravikk on Sun Jan 23, 2022 3:51 pm, edited 1 time in total.
Haravikk
 
Posts: 75
Joined: Tue Mar 17, 2015 4:52 am

Re: Change Disk Label for a ZFS Dataset?

Postby Haravikk » Sun Jan 23, 2022 3:44 pm

Actually, having posted that I just tried something I hadn't thought of before, by changing the mount point instead to /Users/haravikk/Applications/Games/Downloads.localized this has forced it to appear as "Downloads" in the Finder.

Presumably adding the .localized extension forces the Finder to look for strings files (you can see what these are like inside ~/Movies/Movies/Media.localized if you have one) but since I didn't actually provide any it just uses the name (without extension).

This isn't quite an ideal solution, as it means the path has .localized in it, but I can always use a hidden symlink to conceal that detail.

So for anyone interested in doing the same the commands would be:

Code: Select all
zfs set mountpoint=/Users/haravikk/Applications/Games/Downloads.localized zdata/haravikk/Games
ln -s Downloads.localized /Users/haravikk/Applications/Games/Downloads
chflags hidden /Users/haravikk/Applications/Games/Downloads


(substituting paths and names accordingly)

This will set the .localized mount-point, create a symbolic link for the same name without .localized (for cleaner script paths etc.) and then hides it in the Finder.

I'm still interested in whether there's a cleaner way to do this though, i.e- mount the volume anywhere I like (no .localized required) and also display whatever name I want without it being the dataset name.
Haravikk
 
Posts: 75
Joined: Tue Mar 17, 2015 4:52 am

Re: Change Disk Label for a ZFS Dataset?

Postby FadingIntoBlue » Sun Jan 23, 2022 4:39 pm

FadingIntoBlue wrote:
The finder name is set by the name of the mount directory

Haravikk wrote:
Thanks for the response but this isn't the case; the disk appears as "Games" despite the mount directory being "Downloads".


Oops, had that backwards, I use the rename command which also changes the mountpoint.

I'v played around with the mountpoint property quite a bit, with a view to hiding a parent filesystem and mounting the child or similar. It is quite flexible, maybe that is worth exploring. My main interest was setting up a /Volumes/Media which included two separate filesystems /Volumes/Media/Music and /Volumes/Media/Video, all of which show up separately in the Finder Sidebar as Media, Music and Video. I can sit all of those within an encrypted filesystem which is not mounted, and is also not the root filesystem of the pool. Use Hazel to direct processed and completed files where I want them, encrypting as they go.

I suspect we have slightly different intentions though, as I back up all 3 of those, and discard things analogous to your Steam games.
FadingIntoBlue
 
Posts: 106
Joined: Tue May 27, 2014 12:25 am

Re: Change Disk Label for a ZFS Dataset?

Postby lundman » Mon Jan 24, 2022 12:14 am

Side note, there is in fact a setattr(rename volume) method, that we have not implemented, we build the name returned to Finder from the mountpoint/dataset name. The rename volume call could be easily added, but where to store the name would be what would need to be thought about.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Change Disk Label for a ZFS Dataset?

Postby Haravikk » Mon Jan 24, 2022 12:36 am

lundman wrote:Side note, there is in fact a setattr(rename volume) method, that we have not implemented, we build the name returned to Finder from the mountpoint/dataset name. The rename volume call could be easily added, but where to store the name would be what would need to be thought about.

Would this be macOS specific? If so then adding another com.apple. ZFS property might make sense, e.g- com.apple.label or com.apple.name?
Haravikk
 
Posts: 75
Joined: Tue Mar 17, 2015 4:52 am

Re: Change Disk Label for a ZFS Dataset?

Postby lundman » Mon Jan 24, 2022 1:07 am

Yeah, it would have to be HIDDEN, and its not really a dataset attribute, but we could certainly use it that way. Probably fits better than SA object. Although, if it wasn't HIDDEN, you could also rename it using zfs set.
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Change Disk Label for a ZFS Dataset?

Postby Jaw3000 » Sat Oct 08, 2022 8:03 pm

I'm trying to do something similar I believe. I have tank/data and I've set canmount=off tank and set mountpoint=/Volumes/tank tank/data to have the child dataset mount as the parent pool name. I've also set the parent to set mountpoint=/Volumes/tank_root to avoid issues, even though it isn't supposed to mount. This all works fine on Linux, with tank/data mounting as tank. It does not work on Mac, as tank/data still mounts as data and tank still mounts as tank and not tank_root. Is there anyway to get this to work?
Jaw3000
 
Posts: 4
Joined: Thu May 06, 2021 11:15 pm


Return to General Help

Who is online

Users browsing this forum: Google [Bot] and 33 guests