Announcements

Oracle training based on real-time expertise as per industry standards. Upcoming batch details are here.

View batch schedule

Free Oracle mock interview. Register using the link.

Register

#DBAchallenge: submit your questions.

Ask questions
Swipe for more →
Browse by Topic
Latest Posts

    Tuesday, September 8, 2026

    LV-VG-PV Creating and mounting NFS mount point on Linux Vs Widows

    LV-VG-PV Creating and mounting NFS mount point on Linux Vs Widows

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Raw partition = fixed slice of one physical disk, filesystem sits directly on it.

    /data  →  /dev/sdb1  →  disk sdb

    The partition's start and end are literal sector numbers on that one disk. To grow it, the free sectors must sit immediately after it on the same disk. Nothing about a partition can reference a second disk.

    LVM inserts an abstraction layer between the disks and the filesystem:

    /data  →  lv_data      (Logical Volume  — what you mount/format)
                 ↑
              vg_data      (Volume Group    — a pool of space)
               ↑     ↑
             sdb1   sdc    (Physical Volumes — the actual disks)

    Three concepts:

    PV (physical volume) — a disk or partition handed over to LVM (pvcreate)
    VG (volume group) — one pool built from one or more PVs (vgcreate)
    LV (logical volume) — a virtual block device carved out of the pool (lvcreate), which is what you mkfs and mount


    1. Confirm the disk


    [root@jump_oel79 ~]# cd /dev/
    [root@jump_oel79 dev]# ll sd*
    brw-rw----. 1 root disk 8,  0 May 20 14:39 sda
    brw-rw----. 1 root disk 8,  1 May 20 14:39 sda1
    brw-rw----. 1 root disk 8,  2 May 20 14:39 sda2
    brw-rw----. 1 root disk 8, 16 Sep  3 21:31 sdb
    [root@jump_oel79 dev]# df -h
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             5.7G     0  5.7G   0% /dev
    tmpfs                5.8G     0  5.8G   0% /dev/shm
    tmpfs                5.8G  162M  5.6G   3% /run
    tmpfs                5.8G     0  5.8G   0% /sys/fs/cgroup
    /dev/mapper/ol-root   79G   68G   12G  86% /
    /dev/sda1           1014M  327M  688M  33% /boot
    tmpfs                1.2G   40K  1.2G   1% /run/user/0

    [root@jump_oel79 dev]# lsblk /dev/sdb
    NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sdb    8:16   0 1000G  0 disk
    [root@jump_oel79 dev]# fdisk -l /dev/sdb

    Disk /dev/sdb: 1073.7 GB, 1073741824000 bytes, 2097152000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    2. Partition (GPT)


    [root@jump_oel79 dev]# parted -s /dev/sdb mklabel gpt
    [root@jump_oel79 dev]# parted -s -a optimal /dev/sdb mkpart primary xfs 0% 100%
    [root@jump_oel79 dev]# partprobe /dev/sdb
    [root@jump_oel79 dev]# lsblk /dev/sdb
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sdb      8:16   0 1000G  0 disk
    └─sdb1   8:17   0 1000G  0 part
    [root@jump_oel79 dev]#

    3. Filesystem


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

    4. Mount point + mount


    [root@jump_oel79 dev]# mkdir -p /data
    [root@jump_oel79 dev]# mount /dev/sdb1 /data
    [root@jump_oel79 dev]# df -hT /data
    Filesystem     Type  Size  Used Avail Use% Mounted on
    /dev/sdb1      xfs  1000G   33M 1000G   1% /data
    [root@jump_oel79 dev]# blkid /dev/sdb1
    /dev/sdb1: UUID="b1da372b-579e-49e8-b38a-7da12157b067" TYPE="xfs" PARTLABEL="primary" PARTUUID="03f0b9c5-ec44-4b98-9554-102fdb5f36eb"
    [root@jump_oel79 dev]#

    5. Make it persistent


    [root@jump_oel79 dev]# echo 'UUID=b1da372b-579e-49e8-b38a-7da12157b067 /data xfs defaults 0 0' >> /etc/fstab
    [root@jump_oel79 dev]# mount -a
    [root@jump_oel79 dev]# df -h
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             5.7G     0  5.7G   0% /dev
    tmpfs                5.8G     0  5.8G   0% /dev/shm
    tmpfs                5.8G  162M  5.6G   3% /run
    tmpfs                5.8G     0  5.8G   0% /sys/fs/cgroup
    /dev/mapper/ol-root   79G   68G   12G  86% /
    /dev/sda1           1014M  327M  688M  33% /boot
    tmpfs                1.2G   40K  1.2G   1% /run/user/0
    /dev/sdb1           1000G   33M 1000G   1% /data
    [root@jump_oel79 dev]#


    If you'd rather use LVM (lets you grow /data later by adding disks):

    pvcreate /dev/sdb
    vgcreate vg_data /dev/sdb
    lvcreate -l 100%FREE -n lv_data vg_data
    mkfs.xfs /dev/vg_data/lv_data
    mkdir -p /data
    echo '/dev/vg_data/lv_data /data xfs defaults 0 0' >> /etc/fstab
    mount -a

    [root@jump_oel79 dev]# df -h
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             5.7G     0  5.7G   0% /dev
    tmpfs                5.8G     0  5.8G   0% /dev/shm
    tmpfs                5.8G  162M  5.6G   3% /run
    tmpfs                5.8G     0  5.8G   0% /sys/fs/cgroup
    /dev/mapper/ol-root   79G   68G   12G  86% /
    /dev/sda1           1014M  327M  688M  33% /boot
    tmpfs                1.2G   40K  1.2G   1% /run/user/0
    /dev/sdb1           1000G   33M 1000G   1% /data
    [root@jump_oel79 dev]#


    If you have already mounted the /dev/sdb disk format it with a filesystem, created a mount point and we need to mount with LVM
    then for that. If you haven't put data on /data mount point yet, switch now to LVM so that you can dynamically increase this /data mount point later

    umount /data
    sed -i '\|/data|d' /etc/fstab        # remove the line you just added
    wipefs -a /dev/sdb1

    pvcreate /dev/sdb1
    vgcreate vg_data /dev/sdb1
    lvcreate -l 100%FREE -n lv_data vg_data
    mkfs.xfs /dev/vg_data/lv_data
    echo '/dev/vg_data/lv_data /data xfs defaults 0 0' >> /etc/fstab
    mount -a
    df -hT /data


    [root@jump_oel79 dev]# umount /data
    [root@jump_oel79 dev]# sed -i '\|/data|d' /etc/fstab
    [root@jump_oel79 dev]# wipefs -a /dev/sdb1
    /dev/sdb1: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
    [root@jump_oel79 dev]#
    [root@jump_oel79 dev]# pvcreate /dev/sdb1
      Physical volume "/dev/sdb1" successfully created.
    [root@jump_oel79 dev]# vgcreate vg_data /dev/sdb1
      Volume group "vg_data" successfully created
    [root@jump_oel79 dev]# lvcreate -l 100%FREE -n lv_data vg_data
      Logical volume "lv_data" created.
    [root@jump_oel79 dev]# mkfs.xfs /dev/vg_data/lv_data
    meta-data=/dev/vg_data/lv_data   isize=256    agcount=4, agsize=65535744 blks
             =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=0        finobt=0, sparse=0, rmapbt=0
             =                       reflink=0
    data     =                       bsize=4096   blocks=262142976, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
    log      =internal log           bsize=4096   blocks=127999, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    [root@jump_oel79 dev]# echo '/dev/vg_data/lv_data /data xfs defaults 0 0' >> /etc/fstab
    [root@jump_oel79 dev]# mount -a
    [root@jump_oel79 dev]# df -hT /data
    Filesystem                  Type  Size  Used Avail Use% Mounted on
    /dev/mapper/vg_data-lv_data xfs  1000G   33M 1000G   1% /data
    [root@jump_oel79 dev]#


    Later, adding /dev/sdc (1000G) becomes:

    pvcreate /dev/sdc
    vgextend vg_data /dev/sdc
    lvextend -l +100%FREE /dev/vg_data/lv_data
    xfs_growfs /data                     # online, no unmount needed

    /data goes to ~2TB with no downtime.





    Your LVM mount /data is ready — you just need to export it.

    1. Install and enable NFS server


    yum install -y nfs-utils
    systemctl enable --now nfs-server rpcbind

    2. Add the export


    bash
    echo '/data 10.0.0.0/8(rw,sync,no_root_squash,no_subtree_check)' >> /etc/exports

    Replace 10.0.0.0/8 with your client subnet or a specific IP. Use * only in a trusted lab. Drop no_root_squash unless clients genuinely need root write access — it's a security hole.
    echo '/data *(rw,sync,no_subtree_check)' >> /etc/exports

    3. Apply and verify


    exportfs -rav
    exportfs -v
    showmount -e localhost

    4. Firewall (if firewalld is running)


    firewall-cmd --permanent --add-service={nfs,rpc-bind,mountd}
    firewall-cmd --reload

    5. SELinux (only if enforcing and clients need write)


    setsebool -P nfs_export_all_rw 1

    6. Mount from a client


    mkdir -p /mnt/data
    mount -t nfs jump_oel79:/data /mnt/data
    # persist:
    echo 'jump_oel79:/data /mnt/data nfs defaults,_netdev 0 0' >> /etc/fstab


    [root@jump_oel79 dev]# yum install -y nfs-utils
    Loaded plugins: langpacks, ulninfo
    Package 1:nfs-utils-1.3.0-0.68.0.1.el7.2.x86_64 already installed and latest version
    Nothing to do
    [root@jump_oel79 dev]# systemctl enable --now nfs-server rpcbind
    Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
    [root@jump_oel79 dev]#
    [root@jump_oel79 dev]# echo '/data *(rw,sync,no_subtree_check)' >> /etc/exports
    [root@jump_oel79 dev]#
    [root@jump_oel79 dev]# exportfs -rav
    exporting *:/data
    [root@jump_oel79 dev]# exportfs -v
    /data             <world>(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
    [root@jump_oel79 dev]# showmount -e localhost
    Export list for localhost:
    /data *
    [root@jump_oel79 dev]# firewall-cmd --permanent --add-service={nfs,rpc-bind,mountd}
    success
    [root@jump_oel79 dev]# firewall-cmd --reload
    success
    [root@jump_oel79 dev]# setsebool -P nfs_export_all_rw 1
    [root@jump_oel79 dev]# hostname
    jump_oel79.localdomain.com
    [root@jump_oel79 dev]#

    [root@jump_oel810 ~]# hostname
    jump_oel810.localdomain.com
    [root@jump_oel810 ~]#
    [root@jump_oel810 ~]# mkdir -p /mnt/data
    [root@jump_oel810 ~]# mount -t nfs 10.26.3.61:/data /mnt/data
    [root@jump_oel810 ~]# echo '10.26.3.61:/data /mnt/data nfs defaults,_netdev 0 0' >> /etc/fstab
    [root@jump_oel810 ~]# df -h
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             5.7G     0  5.7G   0% /dev
    tmpfs                5.7G     0  5.7G   0% /dev/shm
    tmpfs                5.7G  9.2M  5.7G   1% /run
    tmpfs                5.7G     0  5.7G   0% /sys/fs/cgroup
    /dev/mapper/ol-root   56G   11G   45G  19% /
    /dev/sda2           1014M  659M  356M  65% /boot
    /dev/sda1            599M  6.0M  593M   1% /boot/efi
    tmpfs                1.2G   12K  1.2G   1% /run/user/42
    tmpfs                1.2G     0  1.2G   0% /run/user/0
    10.26.3.61:/data    1000G   33M 1000G   1% /mnt/data
    [root@jump_oel810 ~]#


    🌟 Proud to be an Oracle ACE Pro! 🚀

    🌟 Proud to be an Oracle ACE Pro! 🚀 I’m excited to share my official Oracle ACE Profile with the Oracle community. 👨‍💻 Mallikarjun ...