zfs configuration

Volodymyr Kostyrko c.kworr at gmail.com
Mon Jan 21 17:20:56 UTC 2013


21.01.2013 17:50, Don Dugger:
> Hi All,
>
> So I use zfs for the root file system. Works well. However now I want to
> move /tmp to ram-disk (memory disk or what ever). When I try to unmount
> /tmp with the zfs command of course it won't because its busy. With ufs I
> would just edit fstab and reboot what do I don with zfs??

I've been moving a lot of machines from 9.0 to 9.1 with some patches 
this days (like tmpfs-nrbtree). I inject some code inde /etc/rc.d/zfs to 
update this. I'm adding this to /etc/fstab:

     tmpfs /tmp tmpfs rw,nosuid 0 0

After this I'm changing /etc/rc.d/zfs:

@@ -23,6 +23,12 @@

  zfs_start_main()
  {
+       umount /tmp
+       zfs destroy mypool/tmp
+       rm -rf /tmp
+       mkdir -p /tmp
+       chmod ugo+rwxt /tmp
+       mount /tmp
         zfs mount -a
         zfs share -a
         if [ ! -r /etc/zfs/exports ]; then

After reboot zfs filesystem for tmp is gone and tmpfs is in charge.

The code is harmless upon reexecution and just does the job. I haven't 
found easier way of doing this.

-- 
Sphinx of black quartz, judge my vow.


More information about the freebsd-questions mailing list