Subject: Re: [vserver] fstab.remote and unmounting
From: "Roderick A. Anderson" <raanders@acm.org>
Date: Thu, 29 Nov 2007 11:15:23 -0800

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
[root@admin rptas]# vserver-stat
CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
195      7  97.1M   8.6M   0m00s67   0m01s51   5m18s43 db3
196      2   4.7M   1.6M   0m00s21   0m00s21   5m10s71 tsdev
198      3   9.5M   2.6M   0m00s20   0m00s19   5m10s95 tsda
200      3   9.5M   2.7M   0m00s55   0m00s57   5m07s83 rt3
204      3   9.5M   2.6M   0m00s60   0m00s62   5m18s43 rptmp
1195     3   9.7M   2.5M   0m00s22   0m00s23   5m18s43 asns
1196     3   9.8M   2.5M   0m00s21   0m00s15   0m10s34 rptas
1197     3   9.8M   2.5M   0m00s22   0m00s21   5m18s43 mx0
1199     3   9.8M   2.5M   0m00s23   0m00s22   5m18s43 rad2

### vserver rptas restart (again).

[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    345908   4472660   8% /var
/dev/rd/c0d0p2        54668984   4466320  47380848   9% /vservers
//66.162.136.140/5h4r3@h3l7
                       54668984   4466320  47380848   9% 
/vservers/rptas/mnt/mailas
//66.162.136.140/5h4r3@h3l7
                       54668984   4466320  47380848   9% 
/vservers/rptas/mnt/mailas
[root@admin rptas]# vserver-stat
CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
195      7  97.1M   8.6M   0m00s67   0m01s51   6m39s72 db3
196      2   4.7M   1.6M   0m00s21   0m00s21   6m32s11 tsdev
198      3   9.5M   2.6M   0m00s20   0m00s19   6m32s24 tsda
200      3   9.5M   2.7M   0m00s55   0m00s57   6m28s37 rt3
204      3   9.5M   2.6M   0m00s60   0m00s62   6m39s73 rptmp
1195     3   9.7M   2.5M   0m00s22   0m00s24   6m39s73 asns
1196     3   9.8M   2.5M   0m00s19   0m00s16   0m11s51 rptas
1197     3   9.8M   2.5M   0m00s22   0m00s21   6m39s73 mx0
1199     3   9.8M   2.5M   0m00s23   0m00s22   6m39s73 rad2

### vserver rptas stop

[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    345908   4472660   8% /var
/dev/rd/c0d0p2        54668984   4466308  47380860   9% /vservers
//66.162.136.140/5h4r3@h3l7
                       54668984   4466308  47380860   9% 
/vservers/rptas/mnt/mailas
//66.162.136.140/5h4r3@h3l7
                       54668984   4466308  47380860   9% 
/vservers/rptas/mnt/mailas
[root@admin rptas]# vserver-stat
CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
195      7  97.1M   8.6M   0m00s67   0m01s51   7m57s20 db3
196      2   4.7M   1.6M   0m00s21   0m00s21   7m49s49 tsdev
198      3   9.5M   2.6M   0m00s20   0m00s19   7m49s72 tsda
200      3   9.5M   2.7M   0m00s55   0m00s57   7m45s85 rt3
204      3   9.5M   2.6M   0m00s60   0m00s62   7m57s21 rptmp
1195     3   9.7M   2.5M   0m00s22   0m00s24   7m57s20 asns
1197     3   9.8M   2.5M   0m00s22   0m00s21   7m57s20 mx0
1199     3   9.8M   2.5M   0m00s23   0m00s22   7m57s20 rad2

### vserver rptas start

[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    345928   4472640   8% /var
/dev/rd/c0d0p2        54668984   4466320  47380848   9% /vservers
//66.162.136.140/5h4r3@h3l7
                       54668984   4466320  47380848   9% 
/vservers/rptas/mnt/mailas
//66.162.136.140/5h4r3@h3l7
                       54668984   4466320  47380848   9% 
/vservers/rptas/mnt/mailas
//66.162.136.140/5h4r3@h3l7
                       54668984   4466320  47380848   9% 
/vservers/rptas/mnt/mailas
[root@admin rptas]# vserver-stat
CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
195      7  97.1M   8.6M   0m00s67   0m01s51   8m53s79 db3
196      2   4.7M   1.6M   0m00s21   0m00s21   8m46s81 tsdev
198      3   9.5M   2.6M   0m00s20   0m00s19   8m46s31 tsda
200      3   9.5M   2.7M   0m00s55   0m00s57   8m42s44 rt3
204      3   9.5M   2.6M   0m00s60   0m00s62   8m53s80 rptmp
1195     3   9.7M   2.5M   0m00s22   0m00s24   8m53s80 asns
1196     3   9.8M   2.5M   0m00s19   0m00s17   0m22s65 rptas
1197     3   9.8M   2.5M   0m00s22   0m00s21   8m53s80 mx0
1199     3   9.8M   2.5M   0m00s23   0m00s22   8m53s80 rad2

### Vserver kernel with util-vserver, vprocunhide, and vservers-default 
with 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   1775764   3352680  35% /
/dev/rd/c0d0p1          256666     27898    215516  12% /boot
tmpfs                  1557504         0   1557504   0% /dev/shm
/dev/rd/c0d0p3         5080828    346276   4472292   8% /var
/dev/rd/c0d0p2        54668984   4466328  47380840   9% /vservers
//66.162.136.140/5h4r3@h3l7
                       54668984   4466328  47380840   9% 
/vservers/rptas/mnt/mailas
[root@admin ~]# vserver-stat
CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
195      7  97.1M   8.5M   0m00s68   0m00s99   0m49s10 db3
196      2   4.7M   1.6M   0m00s20   0m00s21   0m41s48 tsdev
198      3   9.5M   2.6M   0m00s20   0m00s20   0m41s96 tsda
200      3   9.5M   2.7M   0m00s58   0m00s55   0m38s52 rt3
204      3   9.5M   2.6M   0m00s62   0m00s59   0m49s10 rptmp
1195     3   9.8M   2.5M   0m00s22   0m00s19   0m49s11 asns
1196     3   9.8M   2.5M   0m00s22   0m00s22   0m48s57 rptas
1197     3   9.8M   2.5M   0m00s23   0m00s22   0m49s10 mx0
1199     3   9.8M   2.5M   0m00s23   0m00s22   0m49s10 rad2

### service vservers-default restart

[root@admin ~]# 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    346496   4472072   8% /var
/dev/rd/c0d0p2        54668984   4466340  47380828   9% /vservers
//66.162.136.140/5h4r3@h3l7
                       54668984   4466340  47380828   9% 
/vservers/rptas/mnt/mailas
//66.162.136.140/5h4r3@h3l7
                       54668984   4466340  47380828   9% 
/vservers/rptas/mnt/mailas
[root@admin ~]# vserver-stat
CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME
195      7  97.1M   8.5M   0m00s70   0m00s94   0m14s31 db3
196      2   4.7M   1.6M   0m00s21   0m00s17   0m11s43 tsdev
198      3   9.5M   2.6M   0m00s21   0m00s16   0m11s38 tsda
200      3   9.5M   2.6M   0m00s55   0m00s51   0m09s71 rt3
204      3   9.5M   2.7M   0m00s62   0m00s60   0m14s34 rptmp
1195     3   9.8M   2.5M   0m00s24   0m00s20   0m14s10 asns
1196     3   9.8M   2.5M   0m00s24   0m00s21   0m14s57 rptas
1197     3   9.8M   2.5M   0m00s24   0m00s19   0m14s13 mx0
1199     3   9.8M   2.5M   0m00s24   0m00s21   0m14s39 rad2


> 
>> I didn't see any mention of how to un-mount (automagically) on the Great
>> Flower Page.  Nor did I see anything like 'initialize' for when the
>> guest has stopped.  (A "vnamespace --enter <xid> -- umount
>> /mnt/mount-point" kind of worked.)
> 
> If you think it's necessary, postpost-stop should do the trick (though the
> vnamespace would be unnecessary, it's already in the namespace).
> 
>> I'll continue looking and playing but a pointer where to look would be
>> great.
>>
>>
>> TIA,
>> Rod
>