LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2017, 02:08 PM   #1
Weber Kai
Member
 
Registered: Jun 2009
Location: Brasília, Brazil
Distribution: Slackware64 14.2
Posts: 38

Rep: Reputation: 24
What's is supposed to be in mtab when using overlay and / readonly?


Hello all!

I am using kvm with slackware64 14.2, with overlay: / is read-only and all data is write in another disk.

Everything works! And I am quite happy. I can clone the empty disk (small qcow2) for each VM and the bigger read-only disk is shared among all VMs!

My setup is: I've added 2 Virtio SCSI disks, each with only 1 partition.
sda1 is the rw one and I have 3 dirs: boot, upper and work.
sdb1 is the ro and I have a fresh new install of Slackware64 14.2 .

After start, lilo loads my custom initrd, then I mount sda1 in /mntrw and sdb1 in /mntro .
I've commented out default /mnt mount command. Instead, I am mounting overlay in /mnt: lowerdir=/mntro,upperdir=/mntrw/upper,workdir=/mntrw/work

I also move the /mntrw and /mntro to /mnt/mnt/mntrw and /mnt/mnt/mntro, so my disks will be accessible after next command.

Finally I do default "exec switch_root /mnt $INIT $RUNLEVEL"

--
This line is commented out in init and instead I execute others below, everything else remains the same:
Quote:
#mount -o ro -t $ROOTFS $ROOTDEV /mnt

mkdir /mntrw
mkdir /mntro

mount -t ext4 /dev/sda1 /mntrw -o rw,discard
mount -t ext4 /dev/sdb1 /mntro -o ro

mount -t overlay -o lowerdir=/mntro,upperdir=/mntrw/upper,workdir=/mntrw/work overlayroot /mnt

mount -o move /mntrw /mnt/mnt/mntrw
mount -o move /mntro /mnt/mnt/mntro
--
But when I execute "mount" to see the mounts... I can't see who is mounted on /, since its a overlay started in /mnt in init filesystem. But the mounts are visible on /proc/mounts.

So my question is... Since / is overlay, what is supposed to be in mtab after all this?
There are some kind of mark to say / is a virtual filesystem, and to mark /dev/sda1 and /dev/sdb1 as already mounted in this system?

Thank you!

Last edited by Weber Kai; 03-25-2017 at 05:35 PM.
 
Old 03-25-2017, 05:58 PM   #2
Weber Kai
Member
 
Registered: Jun 2009
Location: Brasília, Brazil
Distribution: Slackware64 14.2
Posts: 38

Original Poster
Rep: Reputation: 24
Hi,

Adding those lines to /etc/fstab helped:
Quote:
/dev/sda1 /mnt/mntrw ext4 noauto,rw,discard 0 0
/dev/sdb1 /mnt/mntro ext4 noauto,ro 0 0
overlayroot / overlay noauto,lowerdir=/mntro,upperdir=/mntrw/upper,workdir=/mntrw/work 0 0
Now I can see / is overlay, but I still can see /dev/sda1 and /dev/sdb1 only in /proc/mounts, not in mtab?

Thanks!
 
Old 03-25-2017, 06:03 PM   #3
Weber Kai
Member
 
Registered: Jun 2009
Location: Brasília, Brazil
Distribution: Slackware64 14.2
Posts: 38

Original Poster
Rep: Reputation: 24
Hi!

These commands (from Jan Rafaj Slackware FB group) solved the problem!

mount /dev/sda1 /mnt/mntrw/ -o rw,discard,remount
mount /dev/sdb1 /mnt/mntro/ -o ro,remount

Thanks!
 
  


Reply

Tags
fstab, overlay, read only, slackware 14.2



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 Off
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
server startup error: "cannot find / in /etc/fstab or /etc/mtab"; /etc/fstab readonly knee-co Linux - Newbie 8 09-12-2010 05:37 PM
-bash: HISTSIZE: readonly variable -bash: HISTFILESIZE: readonly variable deathsfriend99 Linux - Newbie 4 12-08-2009 12:51 PM
cannot mount internal hard drive: .hal-mtab and .hal-mtab-lock messed up extremewaffles Linux - Newbie 3 07-01-2009 05:15 PM
Difference between Readonly Filesystem and Mounting filesystem as readonly bluepenguine Linux - Newbie 1 06-19-2009 01:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:43 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