Solved

fdisk lvcreate vgcreate mount fstab exports nfs in Centos Linux

Posted on 2011-09-23
3
743 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
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reinstall 1 70
linux service nerwork restart throwing eth1 not dound? 5 75
Virtual Firewall to Filter DHCP Traffic? 23 76
Measure data download 2 92
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

910 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

16 Experts available now in Live!

Get 1:1 Help Now