3
Jun

Mount Block Volume as a Shared File System on multiple Linux servers on Oracle Cloud

Goal:

A single Block Volume to be mounted on multiple servers.
 
We will attach a block volume on node 1 i.e. erpapp1.
The same block volume will be mounted on node 2 i.e. erpapp2.

 
Create a block volume and attach it to the compute instance.
 

There are two unformatted drives on Node 1:

  • /dev/sdc
  • /dev/sdc
     
    Format the drive.
     

    mkfs.xfs /dev/sdc
    mkfs.xfs /dev/sdc


    [root@erpapp1 ~]# mkfs.xfs /dev/sdd
    meta-data=/dev/sdd isize=256 agcount=4, agsize=3276800 blks
    = sectsz=4096 attr=2, projid32bit=1
    = crc=0 finobt=0, sparse=0, rmapbt=0, reflink=0
    data = bsize=4096 blocks=13107200, imaxpct=25
    = sunit=0 swidth=0 blks
    naming =version 2 bsize=4096 ascii-ci=0 ftype=1
    log =internal log bsize=4096 blocks=6400, version=2
    = sectsz=4096 sunit=1 blks, lazy-count=1
    realtime =none extsz=4096 blocks=0, rtextents=0


    [root@erpapp1 ~]# blkid
    /dev/sda3: UUID="b1d6c458-09df-4003-91f8-274d9bb47090" TYPE="xfs" PARTUUID="de4cf50d-6ab6-4b33-a1bb-b702baadb616"
    /dev/sda1: SEC_TYPE="msdos" UUID="87DD-8565" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="8fb535c2-3a84-4cba-b9d1-46861f4ce6fb"
    /dev/sda2: UUID="72b79731-1dec-4324-849b-ce3027278329" TYPE="swap" PARTUUID="a01c99a8-6311-4a73-9861-a107ea867dc3"
    /dev/sdb: UUID="43b5eb95-de8d-452f-a8c3-8c883bf4c587" TYPE="xfs"
    /dev/sdc: UUID="fd78adbf-d224-4552-b59a-89e93bf7bfcc" TYPE="xfs"
    /dev/sdd: UUID="e958eed2-a136-4395-b8c0-e4718d46c571" TYPE="xfs"

     
    Create the directory structure on both the nodes.

    # mkdir /u02
    # chown -R applprod:oinstall /u02
    # mkdir /u03
    # chown -R applprod:oinstall /u03

     
    Add entry in /etc/fstab file of primary node for both the mount points.

    UUID=fd78adbf-d224-4552-b59a-89e93bf7bfcc /u02 xfs defaults,noatime,_netdev 0 2
    UUID="e958eed2-a136-4395-b8c0-e4718d46c571" /u03 xfs defaults,noatime,_netdev 0 2

     
    Start NFS Service on the primary server.

    To start an NFS server, use the following command:
    # systemctl start nfs
     
    To enable NFS to start at boot, use the following command:
    # systemctl enable nfs
     
    Add entry in the /etc/exports file of primary node for both the mount points.

    cat /etc/exports
    /u02 erpapp2(rw,sync,no_root_squash)
    /u03 erpapp2(rw,sync,no_root_squash)
     
    # exportfs -ra

     
    Node 2:


    # mkdir /u02
    # chown -R applprod:oinstall /u02
    # mkdir /u03
    # chown -R applprod:oinstall /u03

     
    Add entry in /etc/fstab file of secondary node for both the mount points.

    erpapp1:/u02 /u02 nfs rw,nointr,bg,hard,timeo=600,wsize=65536,rsize=65536,nfsvers=4,tcp 0 0
    erpapp1:/u03 /u03 nfs rw,nointr,bg,hard,timeo=600,wsize=65536,rsize=65536,nfsvers=4,tcp 0 0

     
    Mount the drives on both the servers.

    mount -a

    [root@erpapp1 ~]# df -h /u02 /u03/
    Filesystem Size Used Avail Use% Mounted on
    /dev/sdc 500G 131G 370G 27% /u02
    /dev/sdd 50G 33M 50G 1% /u03
     
    [root@erpapp2 ~]# df -h /u02 /u03/
    Filesystem Size Used Avail Use% Mounted on
    erpapp1:/u02 500G 131G 370G 27% /u02
    erpapp1:/u03 50G 33M 50G 1% /u03

  • Back to Top