Subject: Re: [vserver] fstab.remote and unmounting
From: "Daniel Hokka Zakrisson" <daniel@hozac.com>
Date: Thu, 29 Nov 2007 20:52:32 +0100 (CET)

Roderick A. Anderson wrote:
> Daniel Hokka Zakrisson wrote:
>> Roderick A. Anderson wrote:
>>> My thanks to Daniel and Herbert for their help on the IRC (I'm raa)
>>> yesterday.  I now have the CIF share mounting in the context/namespace
>>> when the guest is started.
>>>
>>> But when I stop the guest it is not un-mounted and when I start the
>>> guest back up a new mount is created.
>>
>> What makes you think that? When the last process in a namespace exits,
>> everything will be implicitly unmounted.
>
> This is a long post.  Sorry but I wanted to show my results.
>
> Some background.  Host and guests are CentOS 5 with the latest updates
> off your repository.  Four XEON processors.  Old system so only single
> cores.  Hardware RAID 5.
>
> Here is my testing of various startup processes.  Each test is prefixed
> with a ###.   As you will see each guest start/restart with a
> fstab.remote CIFS mount shows up as a new mount using df.
>
> As I ran these I got thinking I probably created the guest with strange
> settings so here is the incantation:
>
> vserver $GUEST build -m yum --context $CONTEXT \
>     --hostname $FQDN \
>     --interface $IFACEID=$NETDEV:$IP/$PREFIX \
>     --initstyle sysv -- -d centos5
>
>
> ### Vserver kernel only from a reboot:
>
> [root@admin ~]# df
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/rd/c0d0p6         5407568   1775760   3352684  35% /
> /dev/rd/c0d0p1          256666     27898    215516  12% /boot
> tmpfs                  1557504         0   1557504   0% /dev/shm
> /dev/rd/c0d0p3         5080828    345592   4472976   8% /var
> /dev/rd/c0d0p2        54668984   4466208  47380960   9% /vservers
> [root@admin ~]# vserver-stat
> CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
>
> ### Vserver kernel with util-vserver, vprocunhide, and vservers-default
> but no CIFS mount in the rptas guest from a system reboot.
>
> [root@admin ~]# df
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/rd/c0d0p6         5407568   1775760   3352684  35% /
> /dev/rd/c0d0p1          256666     27898    215516  12% /boot
> tmpfs                  1557504         0   1557504   0% /dev/shm
> /dev/rd/c0d0p3         5080828    345872   4472696   8% /var
> /dev/rd/c0d0p2        54668984   4466320  47380848   9% /vservers
> [root@admin ~]# vserver-stat
> CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
> 195      7  97.1M   8.5M   0m00s67   0m01s49   0m51s56 db3
> 196      2   4.7M   1.6M   0m00s21   0m00s21   0m43s84 tsdev
> 198      3   9.5M   2.6M   0m00s20   0m00s19   0m44s82 tsda
> 200      3   9.5M   2.7M   0m00s55   0m00s57   0m40s21 rt3
> 204      3   9.5M   2.6M   0m00s60   0m00s61   0m51s56 rptmp
> 1195     3   9.7M   2.5M   0m00s22   0m00s23   0m51s56 asns
> 1196     3   9.8M   2.5M   0m00s23   0m00s20   0m51s56 rptas
> 1197     3   9.8M   2.5M   0m00s22   0m00s21   0m51s56 mx0
> 1199     3   9.8M   2.5M   0m00s23   0m00s22   0m51s56 rad2
>
> ### vserver rptas restart with CIFS mount in the rptas guest:
>
> [root@admin rptas]# df
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/rd/c0d0p6         5407568   1775764   3352680  35% /
> /dev/rd/c0d0p1          256666     27898    215516  12% /boot
> tmpfs                  1557504         0   1557504   0% /dev/shm
> /dev/rd/c0d0p3         5080828    345892   4472676   8% /var
> /dev/rd/c0d0p2        54668984   4466320  47380848   9% /vservers
> //66.162.136.140/5h4r3@h3l7
>                        54668984   4466320  47380848   9%
> /vservers/rptas/mnt/mailas

You're not using fstab.remote here, right? You have an initialize script
doing the mount? Notice how the values are exactly the same as for the
/vservers mount... That's because df is actually probing the /vservers
filesystem. Try cat /proc/mounts to find out what is actually mounted
where. df, mount and friends lie a lot, since they rely solely on
/etc/mtab.

Using fstab.remote will write to the correct mtab file (the one in the
guest). If you want to do the mount from an initialize script, add -n to
your mount command so it doesn't touch /etc/mtab.

> <snip>

-- 
Daniel Hokka Zakrisson