{"id":4233,"date":"2016-09-01T19:15:41","date_gmt":"2016-09-01T19:15:41","guid":{"rendered":"https:\/\/really.zonky.org\/?p=4233"},"modified":"2016-09-01T19:15:41","modified_gmt":"2016-09-01T19:15:41","slug":"linux-zfs-be-careful-with-child-file-systems","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=4233","title":{"rendered":"Linux: ZFS: Be Careful With Child File Systems"},"content":{"rendered":"<p>One of the advantages\u00a0that <a href=\"http:\/\/zfsonlinux.org\/\">ZFS<\/a> brings, is that it is so easy to create file systems, that you can create them for purposes that you would not previously do. For example, I have an additional file system mounted under my home directory for a certain application that generates a lot of data that I do not need backed up. Because the script I use to back up stuff does not cross file system boundaries (i.e. it does not descend into a directory that contains a mounted file system), I can simply exclude a large amount of frequently changing data by making a file system.<\/p>\n<p>Or I might (as it happens I do not, but I could well do) create file systems for large lumps of data to easily see how much space they occupy &#8211; perhaps <em>~\/Pictures<\/em>. You can run a command like\u00a0<em>du -sh ~\/Pictures<\/em>, but that is an expensive command (it takes a while) and it tells you how large the files are; not how much space they occupy on disk. And on-disk compression can make that a significant difference! So simply run\u00a0<em>df -h ~\/Pictures<\/em> if that directory is on a separate file system.<\/p>\n<p><em>But<\/em> there is a bit of a gotcha with that. If you create such file systems in the normal way (such as\u00a0<em>zfs create pool\/mikes-pictures; zfs set mountpoint=\/home\/mike\/Pictures pool\/mikes-pictures<\/em>) you risk creating a situation that may prevent your home directory from mounting. If the &#8220;child&#8221; file system is mounted before the parent, it will not be possible for the parent file system to be mounted when booting.<\/p>\n<p>Instead create the hierarchy properly :-<\/p>\n<pre>zfs create pool\/h2\r\nmkdir \/h2\r\nzfs set mountpoint=\/h2 pool\/h2\r\nzfs create pool\/h2\/mike\r\nzfs create pool\/h2\/mike\/Pictures\r\nls \/h2\/mike\/Pictures<\/pre>\n<p>You will also have to fix the permissions, but this is a far safer way of organising things suitable for future file system creation.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3904\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/damascus-unix-prompt1.png?resize=695%2C463&#038;ssl=1\" alt=\"damascus-unix-prompt\" width=\"695\" height=\"463\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/damascus-unix-prompt1.png?w=792&amp;ssl=1 792w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/damascus-unix-prompt1.png?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the advantages\u00a0that ZFS brings, is that it is so easy to create file systems, that you can create them for purposes that you would not previously do. For example, I have an additional file system mounted under my home directory for a certain application that generates a lot of data that I do <a href='https:\/\/really.zonky.org\/?p=4233' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[4,209],"tags":[43,88],"class_list":["post-4233","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-it","tag-linux","tag-zfs","category-4-id","category-209-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-16h","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/4233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4233"}],"version-history":[{"count":4,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/4233\/revisions"}],"predecessor-version":[{"id":4237,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/4233\/revisions\/4237"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}