Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
UnionFS on tmpfs?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
CPUFan
n00b
n00b


Joined: 21 May 2015
Posts: 58

PostPosted: Sat Jun 13, 2015 9:54 pm    Post subject: UnionFS on tmpfs? Reply with quote

Hi,

I read this article: https://wiki.gentoo.org/wiki/Portage_TMPDIR_on_tmpfs.

Now, tmpfs has the drawback that it is limited in space. So my idea was: use a UnionFS on top. More exactly, this results in 3 file systems:
  • /tmp/hdd - some 20 GB large partition, enough for every compile
  • /tmp/ram - a 2-4 GB large RAM partition
  • /tmp/mix - a UnionFS over the two other ones, having priority for /tmp/ram. Portage should use it.

Interesting questions are, for me:
  1. Will this work at all?
  2. Will this work well/Are there issues?
  3. Usually, I do not want to compile anything (most of the time). Let's assume /tmp/mix contains 0 files currently. Can I simply unmount /tmp/mix and /tmp/ram, and then my non-Portage applications (e.g. games, office, multimedia) can use 100% of the RAM?

Many thanks on advance.

- Johannes
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Sat Jun 13, 2015 10:47 pm    Post subject: Reply with quote

Use ZRAM instead... there should be an entry in the official wiki for that. Else, follow my sig./mkinitramfs-ll to svc/zram.{conf,init}d if using OpenRC. (Sorry, no SystemDebug service there.)

If using a recent kernel, e.g. >=linux-3.14 IIRC, choose lz4 for speed and efficiency which would gives you roughly 30% to 50% compression ratio. 4GB of RAM should be almost enough for LibreOFFICE for sure, Firefox, Chrom*, maybe a little on the line for IcedTEA (a monster to compile.)

Naturally, lz4 compression option can be easily set in zram.confd if you follow my sig. (Just install the init service e.g. `install -m 755 zram.initd /etc/init.d/zram; install -m 644 zram.confd /etc/conf.d/zram'.)
_________________
home/:mkinitramfs-ll/:supervision/:e-gtk-theme/:overlay/
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sun Jun 14, 2015 6:26 am    Post subject: Reply with quote

I think you misunderstand how UnionFS works.
(BTW: Current only implementations are overlayfs (in kernel), aufs (outside kernel), or unionfs-fuse (does not require special kernel module except fuse)).

A UnionFS does not decide "by priority" where to write data, but writes data always to the same place.

What you want is really what was prevoiusly implemented in zram (keep it compressed in RAM and write to the file system only as a fallback). Unfortunately, since it is officially in kernel, the fallback-writing was removed.

BTW, there are also other init-scripts to initialize zram, e.g. zram-init from the mv overlay (older versions of zram-init are in the tree).
Back to top
View user's profile Send private message
Aquous
l33t
l33t


Joined: 08 Jan 2011
Posts: 700

PostPosted: Sun Jun 14, 2015 11:57 am    Post subject: Reply with quote

mv wrote:
What you want is really what was prevoiusly implemented in zram (keep it compressed in RAM and write to the file system only as a fallback). Unfortunately, since it is officially in kernel, the fallback-writing was removed.
Doesn't it simply start swapping to disk if it's full? I thought the way zram worked (for compressing ram, that is) is that it created a swap file on the zram block device (which is compressed, hence why this swap file in ram gives your system the performance equivalent to what you would get if it were possible to compress the ram itself). Then if the swap files on the zram block device are full, won't the system simply fall back to the next available source of swap space, e.g. a 20 GB swap partition on the HDD?
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sun Jun 14, 2015 1:55 pm    Post subject: Reply with quote

Aquous wrote:
Doesn't it simply start swapping to disk if it's full?

Yes, but this is independent of zram. zram need not necessarily define a swap disk, it can also provide a ram disk. But in new versions, it cannot provide a ram disk which "swaps to disk" in a controlled manner but just falls back to "usual" kernel swapping if your ramdisk is too full.
Back to top
View user's profile Send private message
CPUFan
n00b
n00b


Joined: 21 May 2015
Posts: 58

PostPosted: Sun Jun 14, 2015 2:38 pm    Post subject: Reply with quote

Thanks to all, this seems to be exactly what I needed. I wonder that it is not mentioned in the install handbook, I guess it would have saved me hours of compile time :lol:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum