LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2018, 01:36 PM   #1
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Rep: Reputation: 22
Overlay Mounts


I can't seem to master overlay mounts. (CentOS 7.5)

I want to move changes to /var into tmpfs. Before anyone panics I'll be shipping logs to a log server.

I've created a script called /usr/local/lib/dracut/modules.d/var-mount.sh
Code:
if ! ismounted /run/var; then
        mkdir -m 0755 /run/var
        mount -t tmpfs -o rw,nosuid,nodev,noexec,strictatime,size=512m,mode=0775 tmpfs /run/var >/dev/null
        mkdir -m 0777 /run/var/upper
        mkdir /run/var/work
        mount -t overlay -o lowerdir=/var,upperdir=/run/var/upper,workdir=/run/var/work /run/var >/dev/null
fi
This will be integrated into initramfs next time I run dracut, to be executed on each boot.

Executing these lines singlely, everything works except the overlay mount.
Code:
# mount -t overlay -o lowerdir=/var,upperdir=/run/var/upper,workdir=/run/var/work /run/var
mount: wrong fs type, bad option, bad superblock on tmpfs,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
# dmesg
...
[ 3463.917113] overlayfs: unrecognized mount option "size=524288k" or missing value

Huh? Why doesn't it object to this on the /run/var mount?

Has anyone else successfully moved /var to tmpfs using overlay?
 
Old 10-18-2018, 05:00 AM   #2
bradvan
Member
 
Registered: Mar 2009
Posts: 367

Rep: Reputation: 61
You might want to just to /var/log instead of all of /var. More goes in /var than just logs. Did you look at: OverlayFS? This link also seems applicable: MOUNTING A FILE SYSTEM.
 
Old 10-22-2018, 10:37 AM   #3
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Can't just do logs because of spool, cache, tmp, and other unanticipated subdirs which may need write depending on the application.

I hadn't seen that RHEL article, thanks. There's a bad gotcha with XFS, which is the default filesystem on install. I doubt it's being created with that switch.

Shared mounts aren't really applicable. Overlay is a different animal. And Arch's article hasn't helped at all.

What I know so far is that in order to do the overlay mount early enough in init so as not to modify the underlying /var, it must be done by a script in /usr/local/lib/dracut/modules.d something like this:
Code:
if ! ismounted /run/var; then
        mkdir -m 0755 /run/var
        mount -t tmpfs -o rw,nosuid,nodev,noexec,strictatime,size=512m,mode=0775 tmpfs /run/var >/dev/null
        mkdir -m 0777 /run/var/upper
        mkdir /run/var/work
        mount -t overlay -o lowerdir=/var,upperdir=/run/var/upper,workdir=/run/var/work /run/var >/dev/null
fi
... but I'm still working on it as I get time. This script would be picked up by dracut and put in initramfs to be executed right after mount of the / filesystem.

Last edited by Quantumstate; 10-22-2018 at 10:44 AM.
 
Old 11-03-2018, 12:29 AM   #4
Quantumstate
Member
 
Registered: Jun 2005
Location: Seattle, Ecotopia
Distribution: CentOS 7.4 with KDE
Posts: 262

Original Poster
Rep: Reputation: 22
Great. Nobody knows dracut in-depth.
 
Old 11-05-2018, 04:38 AM   #5
bradvan
Member
 
Registered: Mar 2009
Posts: 367

Rep: Reputation: 61
Sorry, this is the first I've heard of overlayfs. I did a google search on:
Code:
rhel 7 overlay mounts site:redhat.com
and it came up with some interesting hits. The RHEL 7.3 release notes had some good information. There is a pdf presentation about security of overlayfs. I did not see anywhere that you had to write dracut modifications to get it to work. Maybe you are working on some older information?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Live Image mount: union FS overlay vs dmsetup overlay kostya Linux - Software 2 02-16-2012 06:38 AM
Accesslog Overlay evocage Linux - Server 3 02-04-2012 04:20 AM
Video Overlay Mizutsuki Linux - Software 1 11-14-2005 01:36 AM
overlay networks hari_sasidharan Linux - Networking 0 08-05-2005 05:23 AM
Tv-out overlay? overhard Linux - Hardware 3 09-02-2004 03:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration