TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Compressed directories on Linux

70 pointsby jamesbowmanabout 8 years ago

12 comments

shmerlabout 8 years ago
Is there a way to mount loop device without sudo? Some kind of FUSE option?<p>It&#x27;s useful as a workaround for 32-bit applications which aren&#x27;t built with LFS (Large File Support) enabled, and because of that fail on large XFS partitions. It&#x27;s a very common bug in games which come out in 32-bit only. Making a loop device is a workaround, but using sudo for it all the time is annoying.<p>Also, there is probably no need to explicitly create a loop device, unless you already used up all existing ones (see man mount):<p><pre><code> if no explicit loop device is mentioned (but just an option `-o loop&#x27; is given), then mount will try to find some unused loop device and use that, for example mount &#x2F;tmp&#x2F;disk.img &#x2F;mnt -o loop </code></pre> I.e. in such case I simply create an empty file of certain size, then format it with some filesystem, and then mount it as a loop.<p>For example:<p><pre><code> dd if=&#x2F;dev&#x2F;zero of=&quot;$image&quot; bs=1024K count=&quot;$img_size&quot; mkfs.xfs &quot;$image&quot; sudo mount -o loop &quot;$image&quot; &quot;$mount_path&quot; sudo chown $USER:$USER &quot;$mount_path&quot;</code></pre>
评论 #14288711 未加载
barrkelabout 8 years ago
Note that it&#x27;s not recommended to use journalled filesystems on file-backed loopback devices: <a href="http:&#x2F;&#x2F;loop-aes.sourceforge.net&#x2F;loop-AES.README" rel="nofollow">http:&#x2F;&#x2F;loop-aes.sourceforge.net&#x2F;loop-AES.README</a><p>This approach is not a useful path to lower overall disk usage IMO because you need to thick provision the directory up front, with an estimate of overall compressed disk usage. That&#x27;s a recipe for usability pain. Thin provisioning with sparse files won&#x27;t work well with a COW tree structured backing store like btrfs either.
评论 #14290622 未加载
wmuabout 8 years ago
What about data safety? Say, a hard drive got a bad sector, then a whole file is broken. This always stopped me from using system-wide compression. But maybe it&#x27;s not as bad as I suppose.
评论 #14290403 未加载
评论 #14290165 未加载
评论 #14289434 未加载
评论 #14289846 未加载
crypto5about 8 years ago
Will this cause double-buffering (one buffer for host FS and another for BTRFS) with doubled RAM consumption?
评论 #14289023 未加载
doomroboabout 8 years ago
I like this article style a lot. A very cool result, presented clearly and step-by-step, in less than a full screen of text.
评论 #14288713 未加载
Zardoz84about 8 years ago
Or you can simply use directly BTRFS with LZO compression enabled.
Filligreeabout 8 years ago
Or you could use a base filesystem that supports compression, such as ZFS. <i>shrug</i>
评论 #14289760 未加载
评论 #14288363 未加载
评论 #14289191 未加载
fsiefkenabout 8 years ago
With ZFS and LZ4 or LZ4HC you might get better compression, BTRFS is more lightweight though, so it&#x27;s a great solution. I wonder if encryption would be possible in a similar way.
评论 #14290486 未加载
jwilkabout 8 years ago
From <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;showhn.html</a> :<p><i>Show HN is for something you&#x27;ve made that other people can play with. HN users can try it out, give you feedback, and ask questions in the thread.</i><p>This blog post is not a &quot;Show HN&quot; meterial.<p>Plase change the title to &quot;Using BTRFS with loopback for compressed directories&quot;.
pmlnrabout 8 years ago
Use ZFS, create a dataset for the dir and turn compression on per dataset.
aeroevanabout 8 years ago
How is this different than a chattr +c on the directory? I suppose the compress option doesn&#x27;t force compression (so it will try to recompress compressed files).
fuzzyfizzabout 8 years ago
I don&#x27;t get it. How does this produce 1TB of storage with a 50GB backing store?
评论 #14297952 未加载
评论 #14293873 未加载