cancel
Showing results for 
Search instead for 
Did you mean: 

How to mount a volume read-only

Chiristian
Not applicable

Hi, 

I need to edit the main.cf file to mount a volume read-only.

the path is "/mnta2/bmp", I have this in the /etc/VRTSvcs/conf/config/main.cf file: 

group mnta2_DG (
    SystemList = { emmsrv1 = 0, emmsrv2 = 1, emmsrv3 = 2, emmsrv4 = 3 }
    AutoFailOver = 0
    Parallel = 1
    AutoStartList = { emmsrv1, emmsrv2, emmsrv3, emmsrv4 }
    )

    CFSMount cfsmount3 (
        Critical = 0
        MountPoint = "/mnta2/bmp"
        BlockDevice = "/dev/vx/dsk/mnta2dg/shared_volume"
        MountOpt @emmsrv1 = "cluster"
        MountOpt @emmsrv2 = "cluster"
        MountOpt @emmsrv3 = "cluster"
        MountOpt @emmsrv4 = "cluster"
        NodeList = { emmsrv1, emmsrv2, emmsrv3, emmsrv4 }
        )

    CVMVolDg cvmvoldg3 (
        Critical = 0
        CVMDiskGroup = mnta2dg
        CVMVolume = { shared_volume }
        CVMActivation @emmsrv1 = sw
        CVMActivation @emmsrv2 = sw
        CVMActivation @emmsrv3 = sw
        CVMActivation @emmsrv4 = sw
        )

    requires group cvm online local firm
    cfsmount3 requires cvmvoldg3


    // resource dependency tree
    //
    //    group mnta2_DG
    //    {
    //    CFSMount cfsmount3
    //        {
    //        CVMVolDg cvmvoldg3
    //        }
    //    }

 

 

Does anyone know how to edit main.cf file to mount read-only?

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Gaurav_S
Moderator
Moderator
   VIP    Certified

Hi,

you need to specify "ro" option in MountOpt

CFSMount cfsmount3 (
        Critical = 0
        MountPoint = "/mnta2/bmp"
        BlockDevice = "/dev/vx/dsk/mnta2dg/shared_volume"
        MountOpt @emmsrv1 = "ro,cluster"
        MountOpt @emmsrv2 = "ro,cluster"
        MountOpt @emmsrv3 = "ro,cluster"
        MountOpt @emmsrv4 = "ro,cluster"
        NodeList = { emmsrv1, emmsrv2, emmsrv3, emmsrv4 }
        )

I would suggest following steps here

1. Take the mount resource offline using GUI or via command line (hares -offline cfsmount3 -sys <system>)

2. Make the changes using hares command

# cp -p /etc/VRTSvcs/conf/config/main.cf /etc/VRTSvcs/conf/config/main.cf.260814

# haconf -makerw

# hares -modify cfsmount3 MountOpt ro,cluster   (make sure no space between ro,cluster)

# hacf -verify /etc/VRTSvcs/conf/config

# haconf -dump -makero

 

If you want to manuall edit main.cf & make the changes, you would need to offline group first, shutdown cluster process using "hastop -all -force", make the modification indicated above in main.cf of all the nodes or you can do it one node & then make sure to start cluster on that node first using hastart command..

Also, I would assume that CFSMount agent should run CFSMount command & hence should not really need a "cluster" option however if this is working setup, don't want to take a try

G

View solution in original post

mikebounds
Level 6
Partner Accredited

You could edit main.cf to change MountOpt to "ro,cluster" but this would require that you restart VCS for this to take effect so better to use command line:

hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv1
hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv2
hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv3
hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv4

 

This will mount /mnta2/bmp as read only.  You may also want to look at CVMActivation mode depending on what you are trying to acheive - see extract fom CFS Admin guide


readonly (ro)

The node has read access to the disk group and denies write access
for all other nodes in the cluster. The node has no write access to the
disk group. Attempts to activate a disk group for either of the write
modes on other nodes fail.


sharedread (sr)

The node has read access to the disk group. The node has no write
access to the disk group, however other nodes can obtain write access.


sharedwrite (sw)

The node has write access to the disk group. Attempts to activate the
disk group for shared read and shared write access succeed. Attempts
to activate the disk group for exclusive write and read-only access fail.


off

The node has neither read nor write access to the disk group. Query
operations on the disk group are permitted.

 

You can set this similarly using hares.

 
Mike

View solution in original post

2 REPLIES 2

Gaurav_S
Moderator
Moderator
   VIP    Certified

Hi,

you need to specify "ro" option in MountOpt

CFSMount cfsmount3 (
        Critical = 0
        MountPoint = "/mnta2/bmp"
        BlockDevice = "/dev/vx/dsk/mnta2dg/shared_volume"
        MountOpt @emmsrv1 = "ro,cluster"
        MountOpt @emmsrv2 = "ro,cluster"
        MountOpt @emmsrv3 = "ro,cluster"
        MountOpt @emmsrv4 = "ro,cluster"
        NodeList = { emmsrv1, emmsrv2, emmsrv3, emmsrv4 }
        )

I would suggest following steps here

1. Take the mount resource offline using GUI or via command line (hares -offline cfsmount3 -sys <system>)

2. Make the changes using hares command

# cp -p /etc/VRTSvcs/conf/config/main.cf /etc/VRTSvcs/conf/config/main.cf.260814

# haconf -makerw

# hares -modify cfsmount3 MountOpt ro,cluster   (make sure no space between ro,cluster)

# hacf -verify /etc/VRTSvcs/conf/config

# haconf -dump -makero

 

If you want to manuall edit main.cf & make the changes, you would need to offline group first, shutdown cluster process using "hastop -all -force", make the modification indicated above in main.cf of all the nodes or you can do it one node & then make sure to start cluster on that node first using hastart command..

Also, I would assume that CFSMount agent should run CFSMount command & hence should not really need a "cluster" option however if this is working setup, don't want to take a try

G

mikebounds
Level 6
Partner Accredited

You could edit main.cf to change MountOpt to "ro,cluster" but this would require that you restart VCS for this to take effect so better to use command line:

hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv1
hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv2
hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv3
hares -modify cfsmount3 MountOpt ro,cluster -sys emmsrv4

 

This will mount /mnta2/bmp as read only.  You may also want to look at CVMActivation mode depending on what you are trying to acheive - see extract fom CFS Admin guide


readonly (ro)

The node has read access to the disk group and denies write access
for all other nodes in the cluster. The node has no write access to the
disk group. Attempts to activate a disk group for either of the write
modes on other nodes fail.


sharedread (sr)

The node has read access to the disk group. The node has no write
access to the disk group, however other nodes can obtain write access.


sharedwrite (sw)

The node has write access to the disk group. Attempts to activate the
disk group for shared read and shared write access succeed. Attempts
to activate the disk group for exclusive write and read-only access fail.


off

The node has neither read nor write access to the disk group. Query
operations on the disk group are permitted.

 

You can set this similarly using hares.

 
Mike