{"id":3835,"date":"2012-06-21T22:17:22","date_gmt":"2012-06-22T05:17:22","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=3835"},"modified":"2012-06-21T22:17:22","modified_gmt":"2012-06-22T05:17:22","slug":"size-discrepany-in-the-du-command","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/","title":{"rendered":"Size Discrepany in the &#8216;du&#8217; Command"},"content":{"rendered":"<p>I had a problem today while using the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Du_%28Unix%29\">common Unix command &#8216;du&#8217;<\/a>. As a refresher, &#8216;du&#8217; stands for disk usage and is a handy tool for understanding how much disk space is being occupied.<\/p>\n<p>I think &#8216;du&#8217; is probably doing the right thing. The problem might be that I&#8217;m getting strange (read: 1\/2 the expected number) when running the tool against directories on vmhgfs, the VMware filesystem.<\/p>\n<p><strong>Science Project<\/strong><br \/>\nOn an Ubuntu Linux VMware session, my home directory is on the main file system, which is ext4. The directory \/mnt\/hgfs is reported by &#8216;mount&#8217; to be of type vmhgfs and is shared with the host machine.<\/p>\n<p>Create a directory in the home directory and generate a 10 MiB file:<\/p>\n<pre>\r\nmkdir \/home\/melanson\/dir\r\ndd if=\/dev\/urandom of=\/home\/melanson\/dir\/random-file bs=1048576 count=10\r\n<\/pre>\n<p>Create  a directory on the shared drive and copy the same file:<\/p>\n<pre>\r\nmkdir \/mnt\/hgfs\/vmshare\/dir\r\ncp \/home\/melanson\/dir\/random-file \/mnt\/hgfs\/vmshare\/dir\r\n<\/pre>\n<p>Run &#8216;du&#8217; on each directory using the -k and -h options:<\/p>\n<pre>\r\ndu -k \/home\/melanson\/dir \/mnt\/hgfs\/vmshare\/dir\r\n10244   \/home\/melanson\/dir\r\n5120    \/mnt\/hgfs\/vmshare\/dir\r\n\r\ndu -h \/home\/melanson\/dir \/mnt\/hgfs\/vmshare\/dir\r\n11M    \/home\/melanson\/directory\r\n5.0M   \/mnt\/hgfs\/vmshare\/directory\r\n<\/pre>\n<p>I noticed this discrepancy when I was trying to pack a set of files (akin to &#8216;tar&#8217;-ing) living in a directory in the shared location. I was going mad trying to understand why the original directory was only 2 MB as reported by &#8216;du&#8217; but the final packed file was 4 MB.<\/p>\n<p>To be fair, the man page for &#8216;du&#8217; succinctly states that the tool&#8217;s purpose is merely to <em>&#8220;<strong>estimate<\/strong> file space usage&#8221;<\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Either the &#8216;du&#8217; command has an issue or the vmhgfs filesystem works in a strange manner<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3835","post","type-post","status-publish","format-standard","hentry","category-general"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Either the &#039;du&#039; command has an issue or the vmhgfs filesystem works in a strange manner\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"Either the &#039;du&#039; command has an issue or the vmhgfs filesystem works in a strange manner\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2012-06-22T05:17:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2012-06-22T05:17:22+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Either the &#039;du&#039; command has an issue or the vmhgfs filesystem works in a strange manner\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#article\",\"name\":\"Size Discrepany in the \\u2018du\\u2019 Command | Breaking Eggs And Making Omelettes\",\"headline\":\"Size Discrepany in the &#8216;du&#8217; Command\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2012-06-21T22:17:22-07:00\",\"dateModified\":\"2012-06-21T22:17:22-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":5,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#webpage\"},\"articleSection\":\"General\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/general\\\/#listItem\",\"name\":\"General\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/general\\\/#listItem\",\"position\":2,\"name\":\"General\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/general\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#listItem\",\"name\":\"Size Discrepany in the &#8216;du&#8217; Command\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#listItem\",\"position\":3,\"name\":\"Size Discrepany in the &#8216;du&#8217; Command\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/general\\\/#listItem\",\"name\":\"General\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/\",\"name\":\"Size Discrepany in the \\u2018du\\u2019 Command | Breaking Eggs And Making Omelettes\",\"description\":\"Either the 'du' command has an issue or the vmhgfs filesystem works in a strange manner\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/size-discrepany-in-the-du-command\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2012-06-21T22:17:22-07:00\",\"dateModified\":\"2012-06-21T22:17:22-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes","description":"Either the 'du' command has an issue or the vmhgfs filesystem works in a strange manner","canonical_url":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#article","name":"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes","headline":"Size Discrepany in the &#8216;du&#8217; Command","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2012-06-21T22:17:22-07:00","dateModified":"2012-06-21T22:17:22-07:00","inLanguage":"en-US","commentCount":5,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#webpage"},"articleSection":"General"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/general\/#listItem","name":"General"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/general\/#listItem","position":2,"name":"General","item":"https:\/\/multimedia.cx\/eggs\/category\/general\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#listItem","name":"Size Discrepany in the &#8216;du&#8217; Command"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#listItem","position":3,"name":"Size Discrepany in the &#8216;du&#8217; Command","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/general\/#listItem","name":"General"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/","name":"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes","description":"Either the 'du' command has an issue or the vmhgfs filesystem works in a strange manner","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2012-06-21T22:17:22-07:00","dateModified":"2012-06-21T22:17:22-07:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes","og:description":"Either the 'du' command has an issue or the vmhgfs filesystem works in a strange manner","og:url":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/","article:published_time":"2012-06-22T05:17:22+00:00","article:modified_time":"2012-06-22T05:17:22+00:00","twitter:card":"summary","twitter:title":"Size Discrepany in the \u2018du\u2019 Command | Breaking Eggs And Making Omelettes","twitter:description":"Either the 'du' command has an issue or the vmhgfs filesystem works in a strange manner"},"aioseo_meta_data":{"post_id":"3835","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 21:44:34","updated":"2025-12-31 19:42:48","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/general\/\" title=\"General\">General<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSize Discrepany in the \u2018du\u2019 Command\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs"},{"label":"General","link":"https:\/\/multimedia.cx\/eggs\/category\/general\/"},{"label":"Size Discrepany in the &#8216;du&#8217; Command","link":"https:\/\/multimedia.cx\/eggs\/size-discrepany-in-the-du-command\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=3835"}],"version-history":[{"count":6,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3835\/revisions"}],"predecessor-version":[{"id":3841,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3835\/revisions\/3841"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=3835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=3835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=3835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}