Solved

fdisk lvcreate vgcreate mount fstab exports nfs in Centos Linux

Posted on 2011-09-23
3
773 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:sunhux
ID: 36585928
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
ID: 36589642
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
ID: 36938614
ok thanks
0

Featured Post

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

623 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