How to reduce ZFS mountpoint?

Hello!

A script had installed zfs() which looks like:
Code:
# zfs list
NAME            USED  AVAIL  REFER  MOUNTPOINT
tank            744M  1.33T    31K  none
tank/root       744M  1.33T   744M  /
tank/root/tmp    36K  1.33T    36K  /tmp
tank/root/var   512K  1.33T   512K  /var

Is it possible to reduce it without disk formatting to:
Code:
tank           /
tank/tmp    /tmp
tank/var     /var
 
I have many times tried to find back where that was properly explained but have never been able to find that back. I was so sure it was in the admin guide but I searched it through carefully without a trace. You are most welcome to prove me wrong on that one and search it your self. Just google "ZFS Admin guide"

But the gist of it is that it's a far too inflexible setup, making it hard to backup, move, reorder, sending remote to other systems. Plus there are many properties that cannot be set on the pool filesystem compared to lower level ones.

/Sebulon
 
To be honest I heavily disagree. I've been using ZFS for quite a long time now (one year (the last) on FreeBSD and earlier on quite a few more on Solaris) and I've always used the approach where the main pool also provided the main (root) filesystem. Heck; even Sun did so themselves back in the days and they invented the whole thing in the first place.

There is nothing wrong with using the main pool as your root file system. Basically; if you don't then technically speaking you're wasting one of the available file systems in the first place, why would you? It doesn't make it hard to backup (it's just like any other regular filesystem out there; the only difference is that it was automatically created at the moment you created your pool). Sending it to other systems also doesn't cause further problems because it's quite easy to import a filesystem on a different location. In my opinion it's no different than using dump to make a snapshot from your (UFS) root filesystem, then using restore on another system to, well, restore it. It's not as if you're limited to overwriting your existing system.

Edit: In fact, not doing so only makes your live a whole lot harder which I think is absurd (no offense intended). Really; if I need to check var, and var only, I use zfs list zroot/var. If I need to check the status on my source filesystem I use zfs get readonly zroot/src. The more overhead you add, the more you need to type and the more easier it becomes to make mistakes. zfs get readonly zroot/root/src? That doesn't look like a very optimal situation to me; now I have to type root twice!

Never forget that us Unix administrators are lazy (or we should be). Having to type something out twice for no other reason than "the install script set this up" is, like I mentioned earlier, in my (strictly) personal opinion quite absurd.
(/edit)

Now, to answer the original question... It is possible without disk formatting, but you will need to do so using other media, like a rescue CD or such.

Also keep in mind that you probably need to edit loader.conf and rewrite the bootcode to keep the system bootable. Other than that I see no obstacles as to why this wouldn't work.
 
Sorry for two messages quickly after another but I wanted to separate the opinion venting from my more technical approach. That other message might be a little (too?) passionate (I honestly feel strongly about this) so to make sure it doesn't side track anything...

As mentioned earlier this is easily doable using other media, and when thinking things over it might be even a whole lot easier than you think too.

djmentos said:
Code:
# zfs list
NAME            USED  AVAIL  REFER  MOUNTPOINT
tank            744M  1.33T    31K  none
tank/root       744M  1.33T   744M  /
tank/root/tmp    36K  1.33T    36K  /tmp
tank/root/var   512K  1.33T   512K  /var
What I'd do is simply copy everything from tank/root into tank. I'd even use zfs to rename tank but that's just me I suppose ;)

Once you've done that you basically made tank/root obsolete, so now you need to rename the other file systems. Because that's an important aspect to keep in mind: these are only names you're working with, nothing more. The only thing the name does is determine the (initial) mount point within the hierarchy, but only if you don't specify it yourself. And even if you don't it isn't carved in stone.

First double check that the mount point of the other file systems is set to inherited. If so then only renaming the file system is enough. If not then you'd need to rename the file system and set the mount point manually yourself.

Finally you'd need to setup the bootcode again, and after that things should work as normal once more.
 
I'm using a mix where all relevant parts of the boot environment is located inside a common file system, all other file systems are located at the root of the ZFS pool. This setup will allow me to install e.g. FreeBSD 10 in a new boot environment while keeping my old FreeBSD 9.2 and common files intact.

Code:
$ zfs list -r zroot
NAME                         USED  AVAIL  REFER  MOUNTPOINT
zroot                       21.0G  80.4G   144K  none
zroot/ROOT                  2.71G  80.4G   144K  none
zroot/ROOT/9.2-RELEASE      2.71G  80.4G   419M  none
zroot/ROOT/9.2-RELEASE/usr  1.88G  80.4G  1.88G  /usr
zroot/ROOT/9.2-RELEASE/var   429M  80.4G   429M  /var
zroot/distfiles              595M  80.4G   595M  /usr/ports/distfiles
zroot/home                  10.6G  80.4G  10.6G  /home
zroot/jails                 5.16G  80.4G   360K  /jails
zroot/jails/basejail        2.32G  80.4G  2.26G  /jails/basejail
zroot/jails/git              387M  80.4G   387M  /jails/git
zroot/jails/newjail         3.55M  80.4G  3.55M  /jails/newjail
zroot/jails/serviio         1.96G  80.4G  1.96G  /jails/serviio
zroot/jails/wiki             512M  80.4G   512M  /jails/wiki
zroot/opt                    607M  80.4G   607M  /opt
zroot/packages               144K  80.4G   144K  /usr/ports/packages
zroot/ports                 1.35G  80.4G  1.35G  /usr/ports
zroot/tmp                   4.55M  80.4G  4.55M  /tmp
 
Hi All,

What about this:

Code:
root@:/usr/home/zodias # zfs list -r system-zfs
NAME                    USED  AVAIL  REFER  MOUNTPOINT
system-zfs             48.1G   108G  5.17G  legacy
system-zfs/host-ports  2.67G  12.3G   751M  /usr/ports
system-zfs/tmp          645K  20.0G   119K  legacy
system-zfs/usr         27.5G   108G  25.9G  legacy
system-zfs/usr-obj     8.68G  11.3G  2.89G  /usr/obj
system-zfs/usr-src      841M  19.2G   748M  /usr/src
system-zfs/var         2.01G  43.0G  1.41G  legacy

and

Code:
root@:/usr/home/zodias # cat /etc/fstab
system-zfs      /       zfs     rw      0       0
system-zfs/usr  /usr    zfs     rw      0       0
system-zfs/var  /var    zfs     rw      0       0
system-zfs/tmp  /tmp    zfs     rw      0       0
 
Back
Top