Logical Volume Manager and File system
How to mount ISO9660 CDs on HP-UX?
New HP-UX supports the normal mount command with -F cdfs option.
mount -F cdfs -o cdcase /dev/dsk/c2t5d0 /cdrom
Another way
HP-UX uses a mechanism called portable file system (PFS) on PA-RISC machines to mount Rock-Ridge and ISO 9660 CDs. This procedure describes how to use the PFS method.
01. Login as root
02. Determine the CDROM drive device file name by running ioscan command
# ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
disk 0 10/0/14/0.0.0 sdisk CLAIMED DEVICE TEAC CD-224E
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0
disk 1 10/0/15/1.5.0 sdisk CLAIMED DEVICE HP 36.4GST336706LC
/dev/dsk/c3t5d0 /dev/rdsk/c3t5d0
03. Start the pfsd daemon.PFS mounting is not active on HP-UX systems by default. The pfsd daemon must be running to mount a CD-ROM device. To start the daemon, run the following commands:
# /usr/sbin/pfs_mountd &
# /usr/sbin/pfsd &
04. Insert the CDROM and mount using pfs_mount command
# pfs_mount -o xlat=unix /dev/dsk/c0t0d0 /cdrom
To unmount the CDROM
# pfs_umount /cdrom
Step by step to create a New VG and and File system on a new disk
Create a directory for the volume group
# mkdir /dev/vggis
Create device file named "group"
# mknod /dev/vggis/group c 64 0x010000
Create a physical volume using pvcreate with the -B option.
# pvcreate /dev/rdsk/c9t0d0
Create a VG with PE size of 32MB and with 50000 extends
# vgcreate -s 32 -e 50000 /dev/vggis /dev/dsk/c9t0d0 Volume group "/dev/vggis" has been successfully created. Volume Group configuration for /dev/vggis has been saved in /etc/lvmconf/vggis.conf
Create LV with 10GB size
# lvcreate -n oracle -L 10240 vggis Warning: rounding up logical volume size to extent boundary at size "10016" MB. Logical volume "/dev/vggis/oracle" has been successfully created with character device "/dev/vggis/roracle". Logical volume "/dev/vggis/oracle" has been successfully extended. Volume Group configuration for /dev/vggis has been saved in /etc/lvmconf/vggis.conf
Create file system with largefiles enabled
#newfs -F vxfs -o largefiles /dev/vggis/rgis
Mirror the LV to another disk
# lvextend -m 1 /dev/vg00/gis /dev/dsk/c2t1d0 The newly allocated mirrors are now being synchronized. This operation will take some time. Please wait .... Logical volume "/dev/vg00/gis" has been successfully extended. Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
LVM Mirroring
To Mirror a Logical Volume
# lvextend -m <number_of_mirror_copies> <lv_name> <physical_disk_name> # lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c0t0d0
To break a mirror (remove mirror copies from /dev/dsk/c0t0d0 disk)
# lvreduce -m 0 /dev/vg00/lvol1 /dev/dsk/c0t0d0
Mirroring Root, Boot, Primary Swap Logical Volumes in HP-UX (PA-RISC)
01. Create a physical volume using pvcreate with the -B option.
# pvcreate -B /dev/rdsk/c0t3d0
02. Add the physical volume to your existing root volume group
# vgextend /dev/vg00 /dev/dsk/c0t3d0
03. Use mkboot to place boot utilities in the boot area
# mkboot /dev/rdsk/c0t3d0
04. Use mkboot -a to add an AUTO file in boot LIF area
# mkboot -a "hpux (;0)/stand/vmunix" /dev/rdsk/c0t3d0
05. Using lvextend command, mirror each LV in vg00
a. Get the list of logical volumes using pvdislay
# pvdisplay -v /dev/dsk/c3t6d0 | grep current | grep 00000
b. Extend each LV
# lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lv0l4 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c0t3d0 # lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c0t3d0
06. Update the root volume group information
# lvlnboot -R /dev/vg00
07. Display the BRDA.
# lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c3t2d0 (0/1/1/1.2.0) -- Boot Disk
/dev/dsk/c2t1d0 (0/1/1/0.1.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c3t2d0
/dev/dsk/c2t1d0
Root: lvol3 on: /dev/dsk/c3t2d0
/dev/dsk/c2t1d0
Swap: lvol2 on: /dev/dsk/c3t2d0
/dev/dsk/c2t1d0
Dump: lvol2 on: /dev/dsk/c3t2d0, 0
08. Specify the mirror disk as the alternate boot path
# setboot -a /dev/dsk/c0t3d0
09. Add a line to /stand/bootconf for the new boot disk
# vi /stand/bootconf l /dev/dsk/c0t3d0
Mirroring Root, Boot, Primary Swap Logical Volumes in HP-UX (Itanium)
01. Partition the disk using the idisk command and a partition description file
a. Create a partition description file. For example:
# vi /tmp/idf 3 EFI 500MB HPUX 100% HPSP 400MB
NOTE: The values in the example represent a boot disk with three partitions: an EFI partition, an HP-UX partition, and an HP Service partition.
Boot disks of earlier HP Integrity Servers may have an EFI partition of only 100MB and may not contain the HPSP partition.
b. Partition the disk using idisk and your partition description file:
# idisk -f /tmp/idf -w /dev/rdsk/c3t1d0
c. To verify you can run:
# idisk /dev/rdsk/c3t1d0
02. Use the insf command with the -e option to create the device files for all the partitions.
# insf -e -H 0/18/1/2/0.0.1.0 You should now have eight device files for this disk: /dev/[r]dsk/c?t?d? (This refers to the entire disk) /dev/[r]dsk/c?t?d?s1 (This refers to the EFI partition) /dev/[r]dsk/c?t?d?s2 (This will be the HP-UX partition) /dev/[r]dsk/c?t?d?s3 (This refers to the Service partition)
03. Use pvcreate to make the HP-UX partition of the disk an LVMmanaged disk
# pvcreate -B /dev/rdsk/c3t1d0s2
04. Add the disk to vg00:
# vgextend vg00 /dev/dsk/c3t1d0s2
05. Place the boot files on the disk using mkboot:
# mkboot -e -l /dev/rdsk/c3t1d0
06. Copy any autoboot file from the original boot disk to this one.
a. Use efi_cp to copy the AUTO file from the original boot disk’s EFI partition to the current directory. Make sure to use the device file with the s1 suffix, as it refers to the EFI partition
# efi_cp -d /dev/rdsk/cntndns1 -u /efi/hpux/auto ./AUTO
b. Copy the file from the current directory into the new disk’s EFI partition:
# efi_cp -d /dev/rdsk/c3t1d0s1 ./AUTO /efi/hpux/auto
07. Use the lvextend command to mirror each logical volume in the root volume group onto the desired physical volume. The logical volumes must be extended in the same order that they are configured on the
original boot disk. Use the pvdisplay command with the -v option to determine the list of logical volumes and their order. For example:
# pvdisplay -v /dev/dsk/c0t0d0s2 | grep ’current.*0000$’ 00000 current /dev/vg00/lvol1 00000 00038 current /dev/vg00/lvol2 00000 00550 current /dev/vg00/lvol3 00000 00583 current /dev/vg00/lvol4 00000 00608 current /dev/vg00/lvol5 00000 00611 current /dev/vg00/lvol6 00000 00923 current /dev/vg00/lvol7 00000 01252 current /dev/vg00/lvol8 00000
In this example, mirror the logical volumes as follows:
# lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lv0l4 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c3t1d0s2 # lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c3t1d0s2
08. Update the root volume group information:
lvlnboot -R /dev/vg00
09. Display the BDRA.
# lvlnboot –v
10. Specify the mirror disk as the alternate boot path in nonvolatile memory:
# setboot -a path_to_disk
11. Add a line to /stand/bootconf for the new boot disk using vi
vi /stand/bootconf l /dev/dsk/c3t1d0s2 where l denotes LVM.
LVM On Service Guard Clusters
To copy the mapping of the Volume group file
# vgexport -p -s -m <map_file_name> /dev/vg_name
To import the VG using the map data
# mkdir /dev/vg_name # mknod /dev/vg_name/group c 64 0xXX0000 # vgimport -s -m <map_file_name> /dev/vg_name
To manually activate a VG under Service Guard control
# vgchange -c n <vg_name> # vgchange -a y <vg_name>
To Bring back the VG under Service Guard control
# vgchange -a n <vgname> # vgchange -c y <vgname>
Other LVM tasks
To modify the Volume group properties such as max physical extends, max physical volumes and etc...
vgmodify
[-e MaxPhysicalExtents]
[-p MaxPhysicalVolumes]
[-l MaxLogicalVolumes]
[-v]
[-n]
[-r]
[-B bootable]
VolumeGroupName {[pv_path] [pv_path] ....}
Note: vgmodify may fail if the first extend of each disk in a VG is not free. To free up the first extend, use the pvmove command.
pvmove
To move physical extents from /dev/dsk/c1t0d0 to /dev/dsk/c2t0d0
# pvmove /dev/dsk/c1t0d0 /dev/dsk/c2t0d0
To move only the physical extents for logical volume /dev/vg01/lvol2
# pvmove -n /dev/vg01/lvol2 /dev/dsk/c1t0d0 /dev/dsk/c2t0d0
To Relocate PE number 0 from /dev/dsk/c1t0d0 to any free extent in the volume group
# pvmove /dev/dsk/c1t0d0:0
Extend the file system using Online JFS
To make the file system size to 1GB
fsadm -F vxfs -b $((1000*1024)) /gis
or
fsadm -F vxfs -b 15000000 /gis # maks fs to 15GB
Another Way
# lvextend -L 1024 /dev/byvg/lvol # bc 1024*1024 1048576
- fsadm -F vxfs b 1048576 /mymount
The easiest way
# lvextend -L 1024 /dev/byvg/lvol # fsadm -F vxfs -b 1024M /dev/byvg/lvol
To upgrade a mounted VxFS file system from disk layout 4 to disk layout 7
# vxupgrade -n 5 <mount_point> # vxupgrade -n 6 <mount_point> # vxupgrade -n 7 <mount_point>
To convert any non-VxFS file system on your system to a VxFS file system
# /opt/VRTS/bin/vxfsconvert <vol_name>
How to replace a failed mirrored boot disk in HP-UX on itanium systems?
01. Save the hardware path to the Disk
# ioscan -m lun /dev/disk/disk25
Class I Lun H/W Path Driver S/W State H/W Type Health Description
disk 25 64000/0xfa00/0x6 esdisk CLAIMED DEVICE online HP DH072ABAA6
0/4/1/0.0x5000c50005267f31.0x0
/dev/disk/disk25 /dev/disk/disk25_p2 /dev/rdisk/disk25 /dev/rdisk/disk25_p2
/dev/disk/disk25_p1 /dev/disk/disk25_p3 /dev/rdisk/disk25_p1 /dev/rdisk/disk25_p3
02. Halt LVM Access to the disk
# pvchange -a N /dev/disk/disk25_p2
Warning: Detaching a physical volume reduces the availability of data
within the logical volumes residing on that disk.
Prior to detaching a physical volume or the last available path to it,
verify that there are alternate copies of the data
available on other disks in the volume group.
If necessary, use pvchange(1M) to reverse this operation.
Physical volume "/dev/disk/disk25_p2" has been successfully changed.
03. Replace the disk. If it is hotswapbable, simply replace the disk now. Use the sasmgr command to identify the bay number
# sasmgr get_info -D /dev/sasd0 -q raid
Tue Apr 5 18:43:51 2011
---------- PHYSICAL DRIVES ----------
LUN dsf SAS Address Enclosure Bay Size(MB)
/dev/rdsk/c8t0d0 0x5000c50005267f31 1 5 70007
/dev/rdsk/c8t2d0 0x500000e11176be32 1 8 70007
04. Notify the mass storage subsystem that the disk has been replaced. If the system was not rebooted to replace the failed disk, then run scsimgr before using the
new disk as a replacement for the old disk.
# scsimgr replace_wwid -D /dev/rdisk/disk25
scsimgr:WARNING: Performing replace_wwid on the resource may have some impact on system operation.
Do you really want to replace? (y/[n])? y
scsimgr: Successfully validated binding of LUN paths with new LUN.
05. Create Partition
a. cat /tmp/idf
3
EFI 500MB
HPUX 100%
HPSP 400MB
b. idisk -f /tmp/idf -w /dev/rdisk/disk5
c. ioscan -fnNC disk
d. insf -e
06. Assign the old instance number to the replacement disk
# io_redirect_dsf -d /dev/disk/disk25 -n /dev/disk/disk5
07. Restore LVM configuration information to the new disk.
# vgcfgrestore -n /dev/vg00 /dev/rdisk/disk25_p2
Volume Group configuration has been restored to /dev/rdisk/disk25_p2
08. Restore LVM access to the disk.
# pvchange -a y /dev/disk/disk25_p2
Physical volume "/dev/disk/disk25_p2" has been successfully changed.
09. Place boot utilities in the boot area.
# mkboot -e -l /dev/rdisk/disk25
10. Add an autoboot file to the disk boot area
# mkboot -a "boot vmunix" /dev/rdisk/disk25
Other vxfs related commands
fsadm Resize or defragment a VxFS file system.
fscat Cats a VxFS file system.
fsck Checks and repairs a VxFS file system.
fsdb VxFS file system debugger.
fstyp Returns the type of file system on a specified disk partition.
getext Gets extent attributes for a VxFS file system.
mkfs Constructs a VxFS file system.
mount Mounts a VxFS file system.
newfs Creates a new VxFS file system.
setext Sets extent attributes on a file in a VxFS file system.
vxdump Incremental file system dump.
vxedquota Edits user quotas for a VxFS file system.
vxfsconvert Converts an unmounted file system to VxFS or upgrades a VxFS disk layout version.
vxfsstat Displays file system statistics.
vxlsino VxFS reverse path name lookup utility.
vxrestore Restores a file system incrementally.
vxtunefs Tunes a VxFS file system.
vxupgrade Upgrades the disk layout of a mounted VxFS file system.
vxumount Unmount a VxFS File System