Solved

fdisk lvcreate vgcreate mount fstab exports nfs in Centos Linux

Posted on 2011-09-23
3
741 Views
Last Modified: 2012-05-12

I have the following Centos Linux server & would like to use it to act as NFS server
to server ext3 filesystem to a HP-Ux DB server (to host Oracle db).

lvm> lvdisplay
  --- Logical volume ---
  LV Name                /dev/VolGroup01/nfs1
  VG Name                VolGroup01
  LV UUID                59NMoq-pxE3-IIu0-jWAv-8aAM-0RL5-nedWty
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                273.45 GB
  Current LE             70003
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol00
  VG Name                VolGroup00
  LV UUID                dXoGq7-azl1-EQYH-2Htn-YrzY-Wljs-3KDGFq
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                30.00 GB
  Current LE             960
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                sSIq0I-35D0-lBkq-KzSf-T8aG-ZqlU-8ZD2dU
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                2.00 GB
  Current LE             64
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

lvm>

# fdisk -l

Disk /dev/cciss/c0d0: 293.6 GB, 293617820160 bytes
255 heads, 63 sectors/track, 35697 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          13      104391   83  Linux
/dev/cciss/c0d0p2              14       35697   286631730   8e  Linux LVM

Disk /dev/cciss/c0d1: 293.6 GB, 293617820160 bytes
255 heads, 63 sectors/track, 35697 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d1p1               1       35697   286736121   8e  Linux LVM


# vgdisplay
  --- Volume group ---
  VG Name               VolGroup01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               273.45 GB
  PE Size               4.00 MB
  Total PE              70003
  Alloc PE / Size       70003 / 273.45 GB
  Free  PE / Size       0 / 0
  VG UUID               zJqZAn-fxMf-G6F0-9ird-1b1z-1tcn-ee8fMf

  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               273.34 GB
  PE Size               32.00 MB
  Total PE              8747
  Alloc PE / Size       1024 / 32.00 GB
  Free  PE / Size       7723 / 241.34 GB
  VG UUID               QCeebm-BhWL-ENfK-Jvd8-pZwS-yB7w-ms6w9j


Q1:
Pls provide step by step instruction to use fdisk, lvcreate, vgcreate etc
to create/merge whatever unused space (shown above) & updating
of fstab / exports so that whenever I reboot, the partition is mounted
(as ext3 fs).  Currently they're created as RAID5 by HP RAID config
utitlity : would like one big contiguous space where possible.

Q2::
NFS to be started & shared out
To start up nfs & shared out those partition
0
Comment
Question by:sunhux
  • 2
3 Comments
 

Author Comment

by:sunhux
Comment Utility
I would like the Volume group & the logical volume names
to be VolGroup01, nfsX as follows :

# mkfs.ext3 /dev/VolGroup01/nfs2
# mkfs.ext3 /dev/VolGroup01/nfs3
   . . . . .
0
 
LVL 7

Accepted Solution

by:
jackiechen858 earned 500 total points
Comment Utility
I guess you want to merge all the unused space 241G+273G together to create a 500G shared partition?

VolGroup00 is on your /dev/cciss/c0d0p2  pv;
VolGroup01 is on your /dev/cciss/c0d1p1  pv.

You need to have a big vg to include all the free space for the two pv.


If there is nothing import in   /dev/VolGroup01/nfs1 , you can delete it,

umount   /dev/VolGroup01/nfs1 # unmount it first
lvremove   /dev/VolGroup01/nfs1 ## remove lv
vgremove VolGroup01

pvdisplay  /dev/cciss/c0d1p1  ## it should show this pv is free now.
vgextent VolGroup00  /dev/cciss/c0d1p1 ### add second pv to VolGroup00  

lvcreate -n nfs1 -l 100%FREE VolGroup00  

Now you have a big  /dev/VolGroup00/nfs1.

mkfs.ext3  /dev/VolGroup01/nfs1 # make the file system.

mkdir /nfs1 # create mount point
mount  /dev/VolGroup01/nfs1 /nfs1 # mount it

Edit /etc/fstab, add :

/dev/VolGroup00/nfs1 /nfs1             ext3    defaults        1 3

So next time when you reboot the machine, this partition will be mounted in /nfs1

edit /etc/exports :
/nfs1 hp.server.ip. (rw,insecure,no_root_squash)

/etc/init.d/nfs start  # start nfs server
chkconfig nfs on # turn on the nfs service, so next time reboot it will start automatically

netstat -nap | grep LIST | grep rpc  ## find out which port is used by rpc, plus port 2049

modify /etc/sysconfig/iptables, add those ports, and restart iptables service.


Then you can test it from the HP-UX machine.



























0
 

Author Closing Comment

by:sunhux
Comment Utility
ok thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now