Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread daniel
Quoting Armin Ranjbar :


> but what about when we are shutting down? there will be attempt unmount
> /root, but i think nothing will ever
> to unmount /wr and /ro (which were mounted at initramfs level)
> am i right here?

In our setup the rootfs is ro NFS. It only becomes rw when combined  
with the tmpfs using AUFS. In this case we don't unmount the rootfs as  
it unnecessary.

In Gentoo in /etc/conf.d/net you can define a predown() function that  
can be used to detect which network interface cannot be downed during  
a shutdown. This is useful when PXE booting as shutting down the PXE  
interface will cause the system to hang.

Using the predown() we can detect if the rootfs is using AUFS and NFS  
and choose to keep the interface up so the system can gracefully  
shutdown or reboot.

Regards,
Dan


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread Armin Ranjbar

   Interesting, isnt /rw and /ro "in use" since mounted by aufs?

   On Jul 12, 2012 3:08 PM, "Guan Xin" <[1]guanx@gmail.com> wrote:

 On Thu, Jul 12, 2012 at 11:23 AM, Armin Ranjbar <[2]z...@zoup.org> wrote:
 >
 > Â  Â but what about when we are shutting down? there will be attempt
 unmount
 > Â  Â /root, but i think nothing will ever
 > Â  Â to unmount /wr and /ro (which were mounted at initramfs level)
 > Â  Â am i right here?
 Is your "/wr" in "/etc/mtab"? I usually "umount -l /wr" before calling
 "switch_root"; Never bothered with umount-ing "/wr" on shutdown.
 Guan

References

   1. mailto:guanx@gmail.com
   2. mailto:z...@zoup.org
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread sfjro

Hello Armin,

Armin Ranjbar:
> but what about when we are shutting down? there will be attempt unmount
> /root, but i think nothing will ever
> to unmount /wr and /ro (which were mounted at initramfs level)
> am i right here?

After initramfs, you can unmount fs as usual which was mounted in initrams.
But you cannot unmount root.
For aufs-rooted system, please refer to the aufs manual. Particulary,

(from the aufs manual)
--
When your aufs is the root directory of your system, and your system
tells you some of the filesystem were not unmounted cleanly, try these
procedure when you shutdown your system.
.nf
# mount -no remount,ro /
# for i in $writable_branches
# do mount -no remount,ro $i
# done
.fi
If your xino file is on a hard drive, you also need to specify
`noxino' option or `xino=/your/tmpfs/xino' at remounting root
directory.
--


J. R. Okajima

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread Guan Xin
On Thu, Jul 12, 2012 at 11:23 AM, Armin Ranjbar  wrote:
>
>but what about when we are shutting down? there will be attempt unmount
>/root, but i think nothing will ever
>to unmount /wr and /ro (which were mounted at initramfs level)
>am i right here?

Is your "/wr" in "/etc/mtab"? I usually "umount -l /wr" before calling
"switch_root"; Never bothered with umount-ing "/wr" on shutdown.

Guan

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread Armin Ranjbar

   On Thu, Jul 12, 2012 at 10:02 AM, <[1]sf...@users.sourceforge.net> wrote:

 It is totally up to what you mount and how you use it.
 If you use aufs as your root dir, then you should use initramfs or
 initrd instead of /etc/fstab.

   not related to this question, but i was wondering if you could describe this
   a little more;
   on initramfs level:
   we mount readonly blockdevice as /ro and writable one as /wr , aufs mounts
   them as /root and initrd chroots and executes init.
   it perfectly fine.
   but what about when we are shutting down? there will be attempt unmount
   /root, but i think nothing will ever
   to unmount /wr and /ro (which were mounted at initramfs level)
   am i right here?
   --
   
   Armin Ranjbar

References

   1. mailto:sf...@users.sourceforge.net
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread Ilya Sretensky
Hello, Dan.
Are those /var and /etc required for aufs or any network booted
diskless client needs them mounted before the /etc/fstab file is
parsed?
It appears that now my sysinit runlevel script does it, and you
suggest Dracut modules to do it.
Junjiro says that is probably possible with /etc/fstab itself.
How are /var and /etc usually mounted for those who use network booted
diskless clients?

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-12 Thread daniel
Hi Ilya,

We bring up diskless clients via NFS using Gentoo and AUFS with tmpfs  
for rootfs, /var /etc and a few other folders.

We use a dracut generated initrd with custom dracut modules in order  
to mount rootfs, /var and /etc cleanly at boot.

The issue is getting /var /etc and rootfs mounted with AUFS early  
enough in the init process to make it workable. The only way to do it  
is to have dracut mount it before init.

Let me know if you would like more information about the Dracut modules.

Cheers,
Dan


Quoting Ilya Sretensky :

> Hello, Junjiro!
>
> Thank you for your reply.
>
> So the mounting script is still necessary for the mounting of ro
> branch, as your answer says.
> That makes my attempt pointless, since it involves the boot time
> mounting script again.
> But why is the ro branch mounting necessary in the script precisely
> and not in the fstab file?
>
> By the way, I am not using any custom initramfs or initrd.
> I just compile the client boot image for the NFS server with
> everything by a single command called genkernel there.
> That is how other Gentoo users recommend me to do to keep things  
> clean and easy.
>
> Where can I read more examples of fstab files that mount aufs
> filesystem and how everything depends on each other at the boot time?
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>




--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-11 Thread sfjro

Ilya Sretensky:
> So the mounting script is still necessary for the mounting of ro
> branch, as your answer says.
> That makes my attempt pointless, since it involves the boot time
> mounting script again.
> But why is the ro branch mounting necessary in the script precisely
> and not in the fstab file?

It is totally up to your root dir.
As you know, aufs requires other (mounted) dirs as its branch (member
dir).
It means that, when you mount aufs you need other dirs already mounted.
And how and when do you mount them?
Usually people makes it in the initramfs and completes the root aufs and
then switch_root.

If you don't want to take this way, I'd suggest you to try these.
- mount nothing in your initramfs script
- write fstab as
/dev/... / ro
tmpfs /brabra
aufs / aufs br=/brabra:/

Note that
- it depends that your mount(8) at the boot time processes these entries
  one by one in the written order in fstab. Otherwise it won't work.
- I have never tried this approach.


J. R. Okajima

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-11 Thread Ilya Sretensky
Hello, Junjiro!

Thank you for your reply.

So the mounting script is still necessary for the mounting of ro
branch, as your answer says.
That makes my attempt pointless, since it involves the boot time
mounting script again.
But why is the ro branch mounting necessary in the script precisely
and not in the fstab file?

By the way, I am not using any custom initramfs or initrd.
I just compile the client boot image for the NFS server with
everything by a single command called genkernel there.
That is how other Gentoo users recommend me to do to keep things clean and easy.

Where can I read more examples of fstab files that mount aufs
filesystem and how everything depends on each other at the boot time?

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Re: How to configure aufs3 mounting in fstab for Gentoo?

2012-07-11 Thread sfjro

Hello Ilya,

Ilya Sretensky:
> I have the details at http://forums.gentoo.org/viewtopic-t-929586.html
> But briefly I wish to combine to put it all into the /etc/fstab file
> to get rid of the script.
> Whether is that possible?

It is totally up to what you mount and how you use it.
If you use aufs as your root dir, then you should use initramfs or
initrd instead of /etc/fstab.
If not, I guess you can put an aufs entry in your fstab.

Your script says that you are using aufs for etc, var and root.
If this "root" is the future root dir (by switch_root or chroot), then
it will be easier to mount aufs in the script.

If you really want to put the root aufs in your fstab, then I guess it
will be reached by,
- mount the ro branch in your script
- boot the true system
- by fstab, mount tmpfs
- by fstab, mount aufs root(rw) of tmpfs+ro branch

I have not tried such operation. This is just my guess.

By the way, as I wrote in the aufs README file, I don't read SF forums.


J. R. Okajima

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


How to configure aufs3 mounting in fstab for Gentoo?

2012-07-11 Thread Ilya Sretensky
I have a complicated mounting scheme for Gentoo Linux network booted clients.
It is made of  a sysinit runlevel mounting script which runs first and
/etc/fstab file which runs after.

I have the details at http://forums.gentoo.org/viewtopic-t-929586.html
But briefly I wish to combine to put it all into the /etc/fstab file
to get rid of the script.
Whether is that possible?


Lines of the /etc/fstab file.

none/   nonero
 0 0
none/mnttmpfs
nodev,nosuid0 0
none/media  tmpfs
nodev,nosuid0 0
proc/proc   proc
defaults0 0
shm /dev/shmtmpfs
nodev,nosuid,noexec 0 0
192.168.1.1:/netboot/gentoo3/   nfs
ro,intr,rsize=8192,wsize=8192   0 0
tmpfs   /tmptmpfs
defaults,nosuid,noatime 0 0
tmpfs   /runtmpfs
defaults,nosuid,noatime 0 0
192.168.1.1:/var/www/var/wwwnfs
rw,nolock   0 0
/dev/disk/by-label/home /home   ext3
rw,nodiratime,noatime   0 0


Lines of the sysinit runlevel mounting script file.

#!/sbin/runscript
description="Configure system for netboot"
depend()
{
before udev
}
start() {
einfo "netboot-mount start"
mount -l
mount -nt tmpfs -o rw none /ramdisk && einfo "mount tmpfs
ramdisk" || eerror "mount tmpfs ramdisk failed"
for i in etc var root; do
mkdir /ramdisk/$i
mount -nt aufs -o dirs=/ramdisk/$i=rw:/$i=rr aufs /$i
done
}


How would you configure it with just /etc/fstab file if that is possible?

By the way, I have posted it also as a sourceforge tracker item at
https://sourceforge.net/tracker/?func=detail&aid=3542890&group_id=167503&atid=843212

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/