Archive
LVM and file system basics in HP-UX & Linux
Now that my daily work is more focused on Linux I found myself performing the same basic administration tasks in Linux that I’m used to do in HP-UX. Because of that I thought that a post explaining how the same basic file system and volume management operations are done in both operative systems was necessary, hope you like it :-)
This is going to be a very basic post intended only as a reference for myself and any other Sysadmin coming from either Linux or HP-UX that wants to know how things are done in the other side. Of course this post is no substitute of the official documentation and the corresponding man pages.
I used Red Hat Enterprise Linux 5.5 as the Linux version and 11iv3 as the HP-UX version.
The follwing topics will covered:
- Volume group creation.
- Logical volume operations.
- File system operations.
Volume group creation
Physical volume and volume group creation are the most basic tasks in LVM, both in Linux and HP-UX, but although command syntax is quite similar in both operative systems the whole process differs in many ways.
- HP-UX:
The example used is valid to 11iv2 and 11iv3 HP-UX versions, with the exception of the persistent DSFs you will have to substitute them for the corresponding legacy devices used in 11iv2.
First create the physical volumes.
root@hp-ux:/# pvcreate -f /dev/rdisk/disk10 Physical volume "/dev/rdisk/disk10" has been successfully created. root@hp-ux:/# root@hp-ux:/# pvcreate -f /dev/rdisk/disk11 Physical volume "/dev/rdisk/disk11" has been successfully created. root@hp-ux:/#
In /dev create a directory named as the new volume group, change the ownership to root:root and the permissions ot 755.
root@hp-ux:/# mkdir -p /dev/vg_new root@hp-ux:/# chown root:root /dev/vg_new root@hp-ux:/# chmod 755 /dev/vg_new
Go into the VG subdirectory and create the group device special file. For the Linux guys, in HP-UX each volume group must have a group device special file under its subdirectory in /dev. This group DSF is created with the mknod command, like any other DSFs the group file must have a major and a minor number.
For LVM 1.0 volume groups the major number must be 64 and for the LVM 2.0 one must be 128. Regarding the minor number, the first two digits will uniquely identify the volume group and the remaining digits must be 0000. In the below example we’re creating a 1.0 volume group.
root@hp-ux:/dev/vg_new# mknod group c 64 0x010000
Change the ownership to root:sys and the permissions to 640.
root@hp-ux:/dev/vg_new# chown root:sys group root@hp-ux:/dev/vg_new# chmod 640 group
And create the volume group with the vgcreate command, the arguments passed are the two physical volumes previously created and the size in megabytes of the physical extent. The last one is optional and if is not provided the default of 4MB will be automatically set.
root@hp-ux:/# vgcreate -s 16 vg_new /dev/disk/disk10 /dev/disk/disk11 Volume group "/dev/vg_new" has been successfully created. Volume Group configuration for /dev/vg_new has been saved in /etc/lvmconf/vg_new.conf root@hp-ux:/# root@hp-ux:/# vgdisplay -v vg_new --- Volume groups --- VG Name /dev/vg_new VG Write Access read/write VG Status available Max LV 255 Cur LV 0 Open LV 0 Max PV 16 Cur PV 2 Act PV 2 Max PE per PV 6000 VGDA 2 PE Size (Mbytes) 16 Total PE 26 Alloc PE 0 Free PE 26 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 --- Physical volumes --- PV Name /dev/disk/disk10 PV Status available Total PE 13 Free PE 13 Autoswitch On PV Name /dev/disk/disk11 PV Status available Total PE 13 Free PE 13 Autoswitch On root@hp-ux:/#
- Linux:
Create the physical volumes. Here it is where the first difference appears. In HP-UX a physical volume is composed by a whole disk, with the exception of boot disks in Itanium systems, but in Linux a physical volume can be a whole disk or a partition.
For the whole disk the process is pretty much the same as in HP-UX.
[root@rhel /]# pvcreate -f /dev/sdb Physical volume "/dev/sdb" successfully created [root@rhel /]# pvdisplay /dev/sdb "/dev/sdb" is a new physical volume of "204.00 MB" --- NEW Physical volume --- PV Name /dev/sdb VG Name PV Size 204.00 MB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID Ngyz7I-Z2hL-8R3b-hzA3-qIVc-tZuY-DbCBYn [root@rhel /]#
If you decide to use partitions for the PVs the first, and obvious, thing to do is partition the disk. To setup the disk we’ll use the fdisk tool, following is an example session:
[root@rhel /]# fdisk /dev/sdc Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-204, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-204, default 204): Using default value 204 Command (m for help): t Selected partition 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): p Disk /dev/sdc: 213 MB, 213909504 bytes 64 heads, 32 sectors/track, 204 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdc1 1 204 208880 8e Linux LVM Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@rhel /]#
To explain the session first a new partition is created with the command n and the size of the partition is set (in this particular case we are using the whole disk); then we must change the partition type, which by default is set to Linux, to Linux LVM and to do that we use the command t and issue 8e as the corresponding hexadecimal code, the available values for the partition types can be shown by typing L.
Command (m for help): t Selected partition 1 Hex code (type L to list codes): L 0 Empty 1e Hidden W95 FAT1 80 Old Minix bf Solaris 1 FAT12 24 NEC DOS 81 Minix / old Lin c1 DRDOS/sec (FAT- 2 XENIX root 39 Plan 9 82 Linux swap / So c4 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 83 Linux c6 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c7 Syrinx 5 Extended 41 PPC PReP Boot 85 Linux extended da Non-FS data 6 FAT16 42 SFS 86 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set de Dell Utility 8 AIX 4e QNX4.x 2nd part 88 Linux plaintext df BootIt 9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e3 DOS R/O b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT f W95 Ext'd (LBA) 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b 11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f1 SpeedStor 12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f4 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f2 DOS secondary 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot fb VMware VMFS 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT Hex code (type L to list codes):
The changes are written with w.
Once the partitions are correctly created, setup the physical volumes.
[root@rhel /]# pvcreate -f /dev/sdc1 Physical volume "/dev/sdc1" successfully created [root@rhel /]# pvcreate -f /dev/sdd1 Physical volume "/dev/sdd1" successfully created [root@rhel /]# [root@rhel /]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 sysvg lvm2 a- 19.88G 0 /dev/sdb lvm2 -- 204.00M 204.00M /dev/sdc1 lvm2 -- 203.98M 203.98M /dev/sdd1 lvm2 -- 203.98M 203.98M [root@rhel /]#
Now that the PVs are created we can proceed with the volume group creation.
[root@rhel /]# vgcreate vg_new /dev/sdc1 /dev/sdd1 Volume group "vg_new" successfully created [root@rhel /]# vgdisplay -v vg_new Using volume group(s) on command line Finding volume group "vg_new" /dev/hdc: open failed: No medium found --- Volume group --- VG Name vg_new System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size 400.00 MB PE Size 4.00 MB Total PE 100 Alloc PE / Size 0 / 0 Free PE / Size 100 / 400.00 MB VG UUID lvrrnt-sHbo-eC8j-kC53-Mm5Z-IDDR-RJJtDr --- Physical volumes --- PV Name /dev/sdc1 PV UUID kD0jhk-ws8A-ke3L-a7nd-QucS-SAbH-BrmH28 PV Status allocatable Total PE / Free PE 50 / 50 PV Name /dev/sdd1 PV UUID ZP2bLy-FxR3-gYn9-3Dy1-Llgk-6mFI-1iJvTm PV Status allocatable Total PE / Free PE 50 / 50 [root@rhel /]#
As you could see the process in Linux is slightly simple than in HP-UX.
Logical volume operations
In this part we will see how to create a logical volume, extend this LV and then remove it from the system.
- HP-UX:
The logical volume creation can be done with the lvcreate command. With the -L option we can specify the size in MB of the new lvol, if -l is used instead the size must be provided in logical extents.
root@hp-ux:/# lvcreate -n lvol_test -L 256 vg_new Logical volume "/dev/vg_new/lvol_test_S2" has been successfully created with character device "/dev/vg_new/rlvol_test_S2". Logical volume "/dev/vg_new/lvol_test_S2" has been successfully extended. Volume Group configuration for /dev/vg_new has been saved in /etc/lvmconf/vg_new.conf root@hp-ux:~# lvdisplay /dev/vg_new/lvol_test --- Logical volumes --- LV Name /dev/vg_new/lvol_test VG Name /dev/vg_new LV Permission read/write LV Status available/syncd Mirror copies 0 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 256 Current LE 16 Allocated PE 16 Stripes 0 Stripe Size (Kbytes) 0 Bad block on Allocation strict IO Timeout (Seconds) default root@hp-ux:/#
Extend a volume. Of course the first prerequisite to extend a volume is to have enough free physical extends in the volume group.
root@hp-ux:~# lvextend -L 384 /dev/vg_new/lvol_test Logical volume "/dev/vg_new/lvol_test" has been successfully extended. Volume Group configuration for /dev/vg_new has been saved in /etc/lvmconf/vg_new.conf root@hp-ux:~# root@hp-ux:~# lvdisplay /dev/vg_new/lvol_test --- Logical volumes --- LV Name /dev/vg_new/lvol_test VG Name /dev/vg_new LV Permission read/write LV Status available/syncd Mirror copies 0 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 384 Current LE 24 Allocated PE 24 Stripes 0 Stripe Size (Kbytes) 0 Bad block on Allocation strict IO Timeout (Seconds) default root@hp-ux:/#
The final step of this part is to remove the logical volume.
root@hp-ux:/# lvremove /dev/vg_new/lvol_test The logical volume "/dev/vg_new/lvol_test" is not empty; do you really want to delete the logical volume (y/n) : y Logical volume "/dev/vg_new/lvol_test" has been successfully removed. Volume Group configuration for /dev/vg_new has been saved in /etc/lvmconf/vg_new.conf root@hp-ux:/#
- Linux:
Create the logical volume with the lvcreate command, the most basic options (-L, -l, -n) are the same as in HP-UX.
[root@rhel /]# lvcreate -n lv_test -L 256 vg_new Logical volume "lv_test" created [root@rhel /]# lvdisplay /dev/vg_new/lv_test --- Logical volume --- LV Name /dev/vg_new/lv_test VG Name vg_new LV UUID m5G2vT-dsE1-CycS-BMYR-3MYZ-4y8O-Mx04B8 LV Write Access read/write LV Status available # open 0 LV Size 256.00 MB Current LE 16 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:6 [root@rhel /]#
Now extend the logical volume to 384 megabytes as we did in HP-UX.
[root@rhel /]# lvextend -L 384 /dev/vg_new/lv_test Extending logical volume lv_test to 384.00 MB Logical volume lv_test successfully resized [root@rhel /]# [root@rhel /]# lvdisplay /dev/vg_new/lv_test --- Logical volume --- LV Name /dev/vg_new/lv_test VG Name vg_new LV UUID m5G2vT-dsE1-CycS-BMYR-3MYZ-4y8O-Mx04B8 LV Write Access read/write LV Status available # open 0 LV Size 384.00 MB Current LE 24 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:6 [root@rhel /]#
Remove a volume from the system, like creation and extension is a very straight forward process that can be done with one command.
[root@rhel /]# lvremove /dev/vg_new/lv_test Do you really want to remove active logical volume lv_test? [y/n]: y Logical volume "lv_test" successfully removed [root@rhel /]#
Unlike the volume group section, the basic logical operations are performed in almost the same way in both operative systems. Of course if you want to perform mirroring the differences are bigger, but I will leave that for a future post.
File system operations
The final section of the post is about the basic file system operation, we are going to create a file system on the logical volume of the previous section and later to extend it, including this time the volume group extension.
- HP-UX:
Creating the file system with the newfs command.
root@hp-ux:/# newfs -F vxfs -o largefiles /dev/vg_new/rlvol_test version 7 layout 393216 sectors, 393216 blocks of size 1024, log size 1024 blocks largefiles supported root@hp-ux:/#
Create the mount point and mount the filesystem
root@hp-ux:/# mkdir /data root@hp-ux:/# mount /dev/vg_new/lvol_test /data
Filesystem extension, in the current section we are going to suppose that the volume group has not enough physical extension to accommodate the new size of the /data file system.
After we create a new physical volume in the disk12 we are going to extend the vg_new VG.
root@hp-ux:/# vgextend vg_new /dev/disk/disk12 Volume group "vg_new" has been successfully extended. Volume Group configuration for /dev/vg_new has been saved in /etc/lvmconf/vg_new.conf root@hp-ux:/# root@hp-ux:/# vgdisplay -v vg_new --- Volume groups --- VG Name /dev/vg_new VG Write Access read/write VG Status available Max LV 255 Cur LV 0 Open LV 0 Max PV 16 Cur PV 2 Act PV 2 Max PE per PV 6000 VGDA 2 PE Size (Mbytes) 16 Total PE 39 Alloc PE 24 Free PE 15 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 --- Logical volumes --- LV Name /dev/vg_mir/lv_sql LV Status available/syncd LV Size (Mbytes) 384 Current LE 24 Allocated PE 24 Used PV 2 --- Physical volumes --- PV Name /dev/disk/disk10 PV Status available Total PE 13 Free PE 13 Autoswitch On PV Name /dev/disk/disk11 PV Status available Total PE 13 Free PE 13 Autoswitch On PV Name /dev/disk/disk12 PV Status available Total PE 13 Free PE 13 Autoswitch On root@hp-ux:/#
The next part is to extend the logical volume just as we did in the logical volume operations section.
root@hp-ux:/# lvextend -L 512 /dev/vg_new/lvol_test Logical volume "/dev/vg_new/lvol_test" has been successfully extended. Volume Group configuration for /dev/vg_new has been saved in /etc/lvmconf/vg_new.conf root@hp-ux:~#
And finally the most creepy part of the part of the process, extending the file system. To be capable of extending a mounted filesystem in HP-UX the OnlineJFS bundle must be installed.
Use the command fsadm and with the -b option issue the new size in KB as the argument, in the example we want to extend to 512MB, in KB is 524288.
root@hp-ux:/# fsadm -F vxfs -b 524288 /data
vxfs fsadm: V-3-23585: /dev/vg00/rlvol5 is currently 7731200 sectors - size will be increased
root#hp-ux:/#
root@hp-ux:/# bdf /data
Filesystem kbytes used avail %used Mounted on
/dev/vg_new/lvol_test
524288 5243 524288 1% /data
root@hp-ux:/#
- Linux:
Here in the filesystem part is where the commands are completely different to HP-UX. In Linux the most common file system types are ext2 and ext3, although others like ext4 or reiserfs are supported.
To create an ext3 file system issue the command mkfs.ext3 using the logical volume to create the file system on as the argument.
[root@rhel ~]# mkfs.ext3 /dev/vg_new/lv_test
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
98304 inodes, 393216 blocks
19660 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
48 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rhel ~]#
As in HP-UX create the mount point and mount the file system.
[root@rhel ~]# mkdir /data
[root@rhel ~]# mount /dev/vg_new/lv_test /data
[root@rhel ~]# df -h /data
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_new-lv_test
372M 11M 343M 3% /data
[root@rhel ~]#
The final part of the section is the file system extension, as we did in the HP-UX part the first task is to extend the volume group.
[root@rhel ~]# vgextend vg_new /dev/sde1
Volume group "vg_new" successfully extended
[root@rhel ~]# vgdisplay -v vg_new
Using volume group(s) on command line
Finding volume group "vg_new"
--- Volume group ---
VG Name vg_new
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 3
Act PV 3
VG Size 576.00 MB
PE Size 16.00 MB
Total PE 36
Alloc PE / Size 24 / 384.00 MB
Free PE / Size 12 / 192.00 MB
VG UUID u32c0h-BPGN-HixT-IzsX-cNnC-EspO-xfweaI
--- Logical volume ---
LV Name /dev/vg_new/lv_test
VG Name vg_new
LV UUID ZtArMo-Pyyl-BDHX-9CZQ-uEAK-VDqG-t60xy4
LV Write Access read/write
LV Status available
# open 1
LV Size 384.00 MB
Current LE 24
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:6
--- Physical volumes ---
PV Name /dev/sdc1
PV UUID kD0jhk-ws8A-ke3L-a7nd-QucS-SAbH-BrmH28
PV Status allocatable
Total PE / Free PE 12 / 0
PV Name /dev/sdd1
PV UUID ZP2bLy-FxR3-gYn9-3Dy1-Llgk-6mFI-1iJvTm
PV Status allocatable
Total PE / Free PE 12 / 0
PV Name /dev/sde1
PV UUID wbiNu5-csig-uwY7-y14y-3C8Q-oeN0-hAT49g
PV Status allocatable
Total PE / Free PE 12 / 12
[root@rhel ~]#
Extend the logical volume with lvextend.
[root@rhel ~]# lvextend -L 512 /dev/vg_new/lv_test Extending logical volume lv_test to 512.00 MB Logical volume lv_test successfully resized [root@rhel ~]# lvs LV VG Attr LSize Origin Snap% Move Log Copy% Convert lv_home sysvg -wi-ao 256.00M lv_root sysvg -wi-ao 5.84G lv_swap sysvg -wi-ao 1.00G lv_tmp sysvg -wi-ao 1.00G lv_usr sysvg -wi-ao 9.75G lv_var sysvg -wi-ao 2.03G lv_test vg_new -wi-ao 512.00M [root@rhel ~]#
Finally resize the file system, to do that use the resize2fs tool. Unlike in HP-UX with fsadm, that needs the new size as an argument in order to extend the file system, if you simply issue the logical volume as the argument the resize2fs utility will extend the file system to the maximum size available in the LV.
[root@rhel ~]# resize2fs /dev/vg_new/lv_test resize2fs 1.39 (29-May-2006) Filesystem at /dev/vg_new/lv_test is mounted on /data; on-line resizing required Performing an on-line resize of /dev/vg_new/lv_test to 524288 (1k) blocks. The filesystem on /dev/vg_new/lv_test is now 524288 blocks long. [root@rhel ~]#
And at this point we are done. Any comments are welcome as always :-)
Juanma.
Howto set-up a VxVM boot disk from a LVM boot disk
Creating a Veritas Volume Manager boot disk using the LVM boot disks as its source probably looks to many as a very complicated process, nothing so far from the reality. In fact the whole conversion can be done with one command, vxcp_lvmroot. In this post I will try to clarify the process and explain some of the underlying mechanisms.
I’m going to take for granted that all of you understand the basic structure of boot disks on Itanium servers. If you have read my post about boot disk structure on Integrity servers you will remember that the disks are composed by three partitions:
- EFI
- OS Partition.
- HPSP – HP Service Partition.
For the purpose of this post the only relevant partition is the OS Partition, also named as HPUX in HP-UX hosts.
Unlike LVM, where the volumes are named with numbers (lvol1, lvol2…), in VxVM the volumes follow a specific naming convention that reflects the usage of each one of them:
- standvol
- swapvol
- rootvol
- usrvol
- varvol
- tmpvol
- optvol
Veritas volumes support also a usetype field used to provide additional information about the volume to VxVM itself. The three most common usetypes on HP-UX are:
- fsgen – File systems and general purpose volumes
- swap – Swap volumes
- root – Used for the volume that contains the root file system
The following restrictions must be taken into account for any VxVM boot disk:
- As in LVM the volumes involved in the boot process (standvol, swapvol and rootvol) must be contiguous.
- The above volumes can have only one subdisk and can’t span to additional disks.
- The volumes within the root disk can not use dirty region logging (DRL).
- The private region size is 1MB rather than the default value of 32MB.
- The /stand file system can only be configured with VxFS data layout version 5 or the system will not boot.
- In PA-RISC systems the /stand file system must be HFS, this is necessary because the PA-RISC HP-UX kernel loader is not VxFS-aware.
Following is an example to illustrate the process.
First, with diskinfo, verify the size of the current boot disk and the new disk to check that they are the same.
root@robin:/# diskinfo /dev/rdsk/c0t0d0
SCSI describe of /dev/rdsk/c0t0d0:
vendor: HP
product id: Virtual LvDisk
type: direct access
size: 40960000 Kbytes
bytes per sector: 512
root@robin:/#
root@robin:/# diskinfo /dev/rdsk/c0t8d0
SCSI describe of /dev/rdsk/c0t8d0:
vendor: HP
product id: Virtual LvDisk
type: direct access
size: 40960000 Kbytes
bytes per sector: 512
root@robin:/#
After that scrub the new disk, this will prevent possible problems during the creation process because if vxcp_lvmroot encounter LVM structures on the disk it will fail.
root@robin:~# dd if=/dev/zero of=/dev/rdsk/c0t8d0 bs=1048576 count=1024 1024+0 records in 1024+0 records out root@robin:~#
Finally launch the vxcp_lvmroot command. Before commencing the copy, vxcp_lvmroot will determine how many disks are required and will ensure that enough disks have been specified.
Each one of the given disks for the conversion will be checked to make sure that aren’t in use as LVM, VxVM or raw disks. Once the appropriate checks have been issued the disks will be given VxVM media names, the disk or disks containing the root will be given rootdisk## names and the other disks that are part of the rootdg will be given rootaux## names, ## is a number starting on 01.
root@robin:~# /etc/vx/bin/vxcp_lvmroot -v -b c0t8d0 VxVM vxcp_lvmroot INFO V-5-2-4668 10:42: Bootdisk is configured with new-style DSF VxVM vxcp_lvmroot INFO V-5-2-2499 10:42: Gathering information on LVM root volume group vg00 VxVM vxcp_lvmroot INFO V-5-2-2441 10:42: Checking specified disk(s) for usability VxVM vxcp_lvmroot INFO V-5-2-4679 10:42: Using legacy-style DSF names VxVM vxcp_lvmroot INFO V-5-2-2566 10:42: Preparing disk c0t8d0 as a VxVM root disk VxVM vxcp_lvmroot INFO V-5-2-3767 10:42: Disk c0t8d0 is now EFI partitioned disk c0t8d0s2 VxVM vxcp_lvmroot INFO V-5-2-2537 10:42: Initializing DG rootdg with disk c0t8d0s2 as DM rootdisk01 VxVM vxcp_lvmroot INFO V-5-2-1606 10:42: Copying /dev/vg00/lvol1 (vxfs) to /dev/vx/dsk/rootdg/standvol VxVM vxcp_lvmroot INFO V-5-2-1604 10:42: Cloning /dev/vg00/lvol2 (swap) to /dev/vx/dsk/rootdg/swapvol VxVM vxcp_lvmroot INFO V-5-2-1606 10:42: Copying /dev/vg00/lvol3 (vxfs) to /dev/vx/dsk/rootdg/rootvol VxVM vxcp_lvmroot INFO V-5-2-1606 10:43: Copying /dev/vg00/lvol4 (vxfs) to /dev/vx/dsk/rootdg/homevol VxVM vxcp_lvmroot INFO V-5-2-1606 10:43: Copying /dev/vg00/lvol5 (vxfs) to /dev/vx/dsk/rootdg/optvol VxVM vxcp_lvmroot INFO V-5-2-1606 10:50: Copying /dev/vg00/lvol6 (vxfs) to /dev/vx/dsk/rootdg/tmpvol VxVM vxcp_lvmroot INFO V-5-2-1606 10:50: Copying /dev/vg00/lvol7 (vxfs) to /dev/vx/dsk/rootdg/usrvol VxVM vxcp_lvmroot INFO V-5-2-1606 10:55: Copying /dev/vg00/lvol8 (vxfs) to /dev/vx/dsk/rootdg/varvol VxVM vxcp_lvmroot INFO V-5-2-1606 10:58: Copying /dev/vg00/lv_crash (vxfs) to /dev/vx/dsk/rootdg/crashvol VxVM vxcp_lvmroot INFO V-5-2-4678 10:58: Setting up disk c0t8d0s2 as a boot disk VxVM vxcp_lvmroot INFO V-5-2-1638 10:59: Installing fstab and fixing dev nodes on new root FS VxVM vxcp_lvmroot INFO V-5-2-2538 10:59: Installing bootconf & rootconf files in new stand FS VxVM vxcp_lvmroot INFO V-5-2-2462 10:59: Current setboot values: VxVM vxcp_lvmroot INFO V-5-2-2569 10:59: Primary: 0/0/0/0.0x0.0x0 /dev/rdisk/disk4 VxVM vxcp_lvmroot INFO V-5-2-2416 10:59: Alternate: VxVM vxcp_lvmroot INFO V-5-2-4676 10:59: Making disk /dev/rdisk/disk20_p2 the primary boot disk VxVM vxcp_lvmroot INFO V-5-2-4663 10:59: Making disk /dev/rdisk/disk4_p2 the alternate boot disk VxVM vxcp_lvmroot INFO V-5-2-4671 10:59: Disk c0t8d0s2 is now a VxVM rootable boot disk root@robin:~#
Now to verify the new VxVM boot disk, first check the newly created rootdg diskgroup.
root@robin:~# vxprint -htg rootdg DG NAME NCONFIG NLOG MINORS GROUP-ID ST NAME STATE DM_CNT SPARE_CNT APPVOL_CNT DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE RV NAME RLINK_CNT KSTATE STATE PRIMARY DATAVOLS SRL RL NAME RVG KSTATE STATE REM_HOST REM_DG REM_RLNK CO NAME CACHEVOL KSTATE STATE VT NAME RVG KSTATE STATE NVOLUME V NAME RVG/VSET/CO KSTATE STATE LENGTH READPOL PREFPLEX UTYPE PL NAME VOLUME KSTATE STATE LENGTH LAYOUT NCOL/WID MODE SD NAME PLEX DISK DISKOFFS LENGTH [COL/]OFF DEVICE MODE SV NAME PLEX VOLNAME NVOLLAYR LENGTH [COL/]OFF AM/NM MODE SC NAME PLEX CACHE DISKOFFS LENGTH [COL/]OFF DEVICE MODE DC NAME PARENTVOL LOGVOL SP NAME SNAPVOL DCO EX NAME ASSOC VC PERMS MODE STATE SR NAME KSTATE dg rootdg default default 4466000 1276076559.38.robin dm rootdisk01 c0t8d0s2 auto 1024 40035232 - v crashvol - ENABLED ACTIVE 4194304 SELECT - fsgen pl crashvol-01 crashvol ENABLED ACTIVE 4194304 CONCAT - RW sd rootdisk01-09 crashvol-01 rootdisk01 28778496 4194304 0 c0t8d0s2 ENA v homevol - ENABLED ACTIVE 155648 SELECT - fsgen pl homevol-01 homevol ENABLED ACTIVE 155648 CONCAT - RW sd rootdisk01-04 homevol-01 rootdisk01 7077888 155648 0 c0t8d0s2 ENA v optvol - ENABLED ACTIVE 9560064 SELECT - fsgen pl optvol-01 optvol ENABLED ACTIVE 9560064 CONCAT - RW sd rootdisk01-05 optvol-01 rootdisk01 7233536 9560064 0 c0t8d0s2 ENA v rootvol - ENABLED ACTIVE 1048576 SELECT - root pl rootvol-01 rootvol ENABLED ACTIVE 1048576 CONCAT - RW sd rootdisk01-03 rootvol-01 rootdisk01 6029312 1048576 0 c0t8d0s2 ENA v standvol - ENABLED ACTIVE 1835008 SELECT - fsgen pl standvol-01 standvol ENABLED ACTIVE 1835008 CONCAT - RW sd rootdisk01-01 standvol-01 rootdisk01 0 1835008 0 c0t8d0s2 ENA v swapvol - ENABLED ACTIVE 4194304 SELECT - swap pl swapvol-01 swapvol ENABLED ACTIVE 4194304 CONCAT - RW sd rootdisk01-02 swapvol-01 rootdisk01 1835008 4194304 0 c0t8d0s2 ENA v tmpvol - ENABLED ACTIVE 524288 SELECT - fsgen pl tmpvol-01 tmpvol ENABLED ACTIVE 524288 CONCAT - RW sd rootdisk01-06 tmpvol-01 rootdisk01 16793600 524288 0 c0t8d0s2 ENA v usrvol - ENABLED ACTIVE 6217728 SELECT - fsgen pl usrvol-01 usrvol ENABLED ACTIVE 6217728 CONCAT - RW sd rootdisk01-07 usrvol-01 rootdisk01 17317888 6217728 0 c0t8d0s2 ENA v varvol - ENABLED ACTIVE 5242880 SELECT - fsgen pl varvol-01 varvol ENABLED ACTIVE 5242880 CONCAT - RW sd rootdisk01-08 varvol-01 rootdisk01 23535616 5242880 0 c0t8d0s2 ENA root@robin:~#
Verify the contents of the LABEL file.
root@robin:~# vxvmboot -v /dev/rdsk/c0t8d0s2 LIF Label File @ (1k) block # 834 on VxVM Disk /dev/rdsk/c0t8d0s2: Label Entry: 0, Boot Volume start: 3168; length: 1792 MB Label Entry: 1, Root Volume start: 6032480; length: 1024 MB Label Entry: 2, Swap Volume start: 1838176; length: 4096 MB Label Entry: 3, Dump Volume start: 1838176; length: 4096 MB root@robin:~#
Check the new boot paths and if everything is OK reboot the server.
root@robin:~# setboot -v Primary bootpath : 0/0/0/0.0x8.0x0 (/dev/rdisk/disk20) HA Alternate bootpath : Alternate bootpath : 0/0/0/0.0x0.0x0 (/dev/rdisk/disk4) Autoboot is ON (enabled) setboot: error accessing firmware - Function is not available The firmware of your system does not support querying or changing the SpeedyBoot settings. root@robin:~# root@robin:~# shutdown -ry 0 SHUTDOWN PROGRAM 06/09/10 11:11:37 WETDST Broadcast Message from root (console) Wed Jun 9 11:11:37... SYSTEM BEING BROUGHT DOWN NOW ! ! ! ...
If everything went as expected the server will boot from the new disk and the migration process wil be finished.
Juanma.
Patching a server using Dynamic Root Disk
Dynamic Root Diks, or DRD for short, is a nice and handy tool that IMHO every HP-UX Sysadmin must know. In an HPVM related post I showed how to use DRD to clone a virtual machine but today I will explain the purpose DRD was intended when it was first introduced… patching a server. I’m going to suppose you have an spare disk for the task and of course have DRD installed in the server.
1.- Clone the root disk.
root@sheldon:/ # drd clone -x overwrite=true -v -t /dev/disk/disk2 ======= 04/21/10 09:05:53 EDT BEGIN Clone System Image (user=root) (jobid=sheldon-01) * Reading Current System Information * Selecting System Image To Clone * Selecting Target Disk * Selecting Volume Manager For New System Image * Analyzing For System Image Cloning * Creating New File Systems * Copying File Systems To New System Image * Making New System Image Bootable * Unmounting New System Image Clone * System image: "sysimage_001" on disk "/dev/disk/disk2" ======= 04/21/10 09:38:48 EDT END Clone System Image succeeded. (user=root) (jobid=sheldon-01) root@sheldon:/ #
2.- Mount the image.
root@sheldon:/ # drd mount ======= 04/21/10 09:41:20 EDT BEGIN Mount Inactive System Image (user=root) (jobid=sheldon) * Checking for Valid Inactive System Image * Locating Inactive System Image * Mounting Inactive System Image ======= 04/21/10 09:41:31 EDT END Mount Inactive System Image succeeded. (user=root) (jobid=sheldon) root@sheldon:/ #
Check the mount by displaying the drd00 volume group.
root@sheldon:/ # vgdisplay drd00 VG Name /dev/drd00 VG Write Access read/write VG Status available Max LV 255 Cur LV 8 Open LV 8 Max PV 16 Cur PV 1 Act PV 1 Max PE per PV 4356 VGDA 2 PE Size (Mbytes) 32 Total PE 4346 Alloc PE 2062 Free PE 2284 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 root@sheldon:/ #
3.- Apply the patches on the mounted clone.
root@sheldon:/ # drd runcmd swinstall -s /tmp/patches_01.depot ======= 04/21/10 09:42:55 EDT BEGIN Executing Command On Inactive System Image (user=root) (jobid=sheldon) * Checking for Valid Inactive System Image * Analyzing Command To Be Run On Inactive System Image * Locating Inactive System Image * Accessing Inactive System Image for Command Execution * Setting Up Environment For Command Execution * Executing Command On Inactive System Image * Using unsafe patch list version 20061206 * Starting swagentd for drd runcmd * Executing command: "/usr/sbin/swinstall -s /tmp/patches_01.depot" ======= 04/21/10 09:42:59 EDT BEGIN swinstall SESSION (non-interactive) (jobid=sheldon-0006) (drd session) * Session started for user "root@sheldon". * Beginning Selection ... ... ... ======= 04/21/10 09:44:37 EDT END swinstall SESSION (non-interactive) (jobid=sheldon-0006) (drd session) * Command "/usr/sbin/swinstall -s /tmp/patches_01.depot" completed with the return code "0". * Stopping swagentd for drd runcmd * Cleaning Up After Command Execution On Inactive System Image ======= 04/21/10 09:44:38 EDT END Executing Command On Inactive System Image succeeded. (user=root) (jobid=sheldon) root@sheldon:/ #
4.- Check the installed patches on the DRD image.
root@sheldon:/ # drd runcmd swlist patches_01 ======= 04/21/10 09:45:29 EDT BEGIN Executing Command On Inactive System Image (user=root) (jobid=sheldon) * Checking for Valid Inactive System Image * Analyzing Command To Be Run On Inactive System Image * Locating Inactive System Image * Accessing Inactive System Image for Command Execution * Setting Up Environment For Command Execution * Executing Command On Inactive System Image * Executing command: "/usr/sbin/swlist patches_01" # Initializing... # Contacting target "sheldon"... # # Target: sheldon:/ # # patches_01 1.0 ACME Patching depot patches_01.acme-RUN * Command "/usr/sbin/swlist patches_01" completed with the return code "0". * Cleaning Up After Command Execution On Inactive System Image ======= 04/21/10 09:45:32 EDT END Executing Command On Inactive System Image succeeded. (user=root) (jobid=sheldon) root@sheldon:/ #
5.- Activate the image and reboot the server.
At this point you only have to activate the patched image with the drd activate command and schedule a reboot of the server.
If you want to activate and reboot at the same time use the -x reboot=true option as in the example below.
root@sheldon:/ # drd activate -x reboot=true ======= 04/21/10 09:52:26 EDT BEGIN Activate Inactive System Image (user=root) (jobid=sheldon) * Checking for Valid Inactive System Image * Reading Current System Information * Locating Inactive System Image * Determining Bootpath Status * Primary bootpath : 0/1/1/0.0.0 [/dev/disk/disk1] before activate. * Primary bootpath : 0/1/1/0.1.0 [/dev/disk/disk2] after activate. * Alternate bootpath : 0 [unknown] before activate. * Alternate bootpath : 0 [unknown] after activate. * HA Alternate bootpath : <none> [] before activate. * HA Alternate bootpath : <none> [] after activate. * Activating Inactive System Image * Rebooting System
If everything goes well after the reboot give the patched server some time, I leave this to your own criteria, before restoring the mirror.
Juanma.
Mirror operations with VxVM and LVM
In today post I will show how to create and brake a mirrored volume in Veritas Volume Manager and Logical Volume Manager.
## LVM ##
Creating a mirror of a volume and later split it in LVM is quite easy an can be done with a few commands. I’m going to suppose that the original volume is already created.
- Extend the Volume Group that contain the lvol.
It has to be done with the same number of disks and of the same size that the ones within the VG.
[root@sheldon] / # vgextend vg_oracle /dev/disk/disk26 Volume group "vg_oracle" has been successfully extended. Volume Group configuration for /dev/vg_oracle has been saved in /etc/lvmconf/vg_oracle.conf [root@sheldon] / #
- Create the mirror.
[root@sheldon] / # lvextend -m 1 /dev/vg_oracle/lv_oracle /dev/disk/disk26 The newly allocated mirrors are now being synchronized. This operation will take some time. Please wait .... Logical volume "/dev/vg_oracle/lv_oracle" has been successfully extended. Volume Group configuration for /dev/vg_oracle has been saved in /etc/lvmconf/vg_oracle.conf [root@sheldon] / #
- Check the configuration.
[root@sheldon] / # lvdisplay /dev/vg_oracle/lv_oracle --- Logical volumes --- LV Name /dev/vg_oracle/lv_oracle VG Name /dev/vg_oracle LV Permission read/write LV Status available/syncd Mirror copies 1 Consistency Recovery MWC Schedule parallel LV Size (Mbytes) 208 Current LE 13 Allocated PE 26 Stripes 0 Stripe Size (Kbytes) 0 Bad block NONE Allocation strict IO Timeout (Seconds) default Number of Snapshots 0 [root@sheldon] / #
- Perform the split.
[root@sheldon] / # lvsplit -s copy /dev/vg_oracle/lv_oracle Logical volume "/dev/vg_oracle/lv_oraclecopy" has been successfully created with character device "/dev/vg_oracle/rlv_oraclecopy". Logical volume "/dev/vg_oracle/lv_oracle" has been successfully split. Volume Group configuration for /dev/vg_oracle has been saved in /etc/lvmconf/vg_oracle.conf [root@sheldon] / #
- Reestablish the mirror.
If the VG are 1.0 or 2.0 version the merge can not be performed if teh group is in shared mode, for the 2.1 volume groups the lvmerge can be done in any mode.
The order to do the merge is the copy FIRST and the master SECOND. This is very important if don’t want to sync the mirror in wrong direction.
[root@sheldon] / # lvmerge /dev/vg_oracle/lv_oraclecopy /dev/vg_oracle/lv_oracle Logical volume "/dev/vg_oracle/lv_oraclecopy" has been successfully merged with logical volume "/dev/vg_oracle/lv_oracle". Logical volume "/dev/vg_oracle/lv_oraclecopy" has been successfully removed. Volume Group configuration for /dev/vg_oracle has been saved in /etc/lvmconf/vg_oracle.conf [root@sheldon] / #
## VXVM ##
The process in VxVM is in many ways similar to the LVM one.
- Add a new disk/disks to the diskgroup
Launch the vxdiskadm tool and select Add or initialize one or more disks.
[root@sheldon] / # vxdiskadm Volume Manager Support Operations Menu: VolumeManager/Disk 1 Add or initialize one or more disks 2 Remove a disk 3 Remove a disk for replacement 4 Replace a failed or removed disk 5 Mirror volumes on a disk 6 Move volumes from a disk 7 Enable access to (import) a disk group 8 Remove access to (deport) a disk group 9 Enable (online) a disk device 10 Disable (offline) a disk device 11 Mark a disk as a spare for a disk group 12 Turn off the spare flag on a disk 13 Remove (deport) and destroy a disk group 14 Unrelocate subdisks back to a disk 15 Exclude a disk from hot-relocation use 16 Make a disk available for hot-relocation use 17 Prevent multipathing/Suppress devices from VxVM's view 18 Allow multipathing/Unsuppress devices from VxVM's view 19 List currently suppressed/non-multipathed devices 20 Change the disk naming scheme 21 Change/Display the default disk layouts 22 Mark a disk as allocator-reserved for a disk group 23 Turn off the allocator-reserved flag on a disk list List disk information ? Display help about menu ?? Display help about the menuing system q Exit from menus Select an operation to perform: 1
Enter the disk and answer the questions according to your configuration and exit the tool when the process is done.
Add or initialize disks Menu: VolumeManager/Disk/AddDisks Use this operation to add one or more disks to a disk group. You can add the selected disks to an existing disk group or to a new disk group that will be created as a part of the operation. The selected disks may also be added to a disk group as spares. Or they may be added as nohotuses to be excluded from hot-relocation use. The selected disks may also be initialized without adding them to a disk group leaving the disks available for use as replacement disks. More than one disk or pattern may be entered at the prompt. Here are some disk selection examples: all: all disks c3 c4t2: all disks on both controller 3 and controller 4, target 2 c3t4d2: a single disk (in the c#t#d# naming scheme) xyz_0: a single disk (in the enclosure based naming scheme) xyz_: all disks on the enclosure whose name is xyz disk#: a single disk (in the new naming scheme) Select disk devices to add: [<pattern-list>,all,list,q,?] disk28 Here is the disk selected. Output format: [Device_Name] disk28 Continue operation? [y,n,q,?] (default: y) You can choose to add this disk to an existing disk group, a new disk group, or leave the disk available for use by future add or replacement operations. To create a new disk group, select a disk group name that does not yet exist. To leave the disk available for future use, specify a disk group name of "none". Which disk group [<group>,none,list,q,?] (default: none) dg_sap Use a default disk name for the disk? [y,n,q,?] (default: y) n Add disk as a spare disk for dg_sap? [y,n,q,?] (default: n) Exclude disk from hot-relocation use? [y,n,q,?] (default: n) Add site tag to disk? [y,n,q,?] (default: n) The selected disks will be added to the disk group dg_sap with disk names that you will specify interactively. disk28 Continue with operation? [y,n,q,?] (default: y) Initializing device disk28. Enter desired private region length [<privlen>,q,?] (default: 32768) Enter disk name for disk28 [<name>,q,?] (default: dg_sap02) VxVM NOTICE V-5-2-88 Adding disk device disk28 to disk group dg_sap with disk name dg_sap02. Add or initialize other disks? [y,n,q,?] (default: n)
- Check the configuration.
[root@sheldon] / # vxprint -g dg_sap TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 dg dg_sap dg_sap - - - - - - dm dg_sap01 disk27 - 228224 - - - - dm dg_sap02 disk28 - 228224 - - - - v sapvol fsgen ENABLED 204800 - ACTIVE - - pl sapvol-01 sapvol ENABLED 204800 - ACTIVE - - sd dg_sap01-01 sapvol-01 ENABLED 204800 0 - - - [root@sheldon] / #
- Create the mirror.
[root@sheldon] / # vxassist -g dg_sap mirror sapvol dg_sap02 [root@sheldon] / # [root@sheldon] / # vxprint -g dg_sap TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 dg dg_sap dg_sap - - - - - - dm dg_sap01 disk27 - 228224 - - - - dm dg_sap02 disk28 - 228224 - - - - v sapvol fsgen ENABLED 204800 - ACTIVE - - pl sapvol-01 sapvol ENABLED 204800 - ACTIVE - - sd dg_sap01-01 sapvol-01 ENABLED 204800 0 - - - pl sapvol-02 sapvol ENABLED 204800 - ACTIVE - - sd dg_sap02-01 sapvol-02 ENABLED 204800 0 - - - [root@sheldon] / #
- Break the mirror.
To do this just disassociate the corresponding plex from the volume.
[root@sheldon] / # vxplex -g dg_sap dis sapvol-02 [root@sheldon] / # vxprint -g dg_sap TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 dg dg_sap dg_sap - - - - - - dm dg_sap01 disk27 - 228224 - - - - dm dg_sap02 disk28 - 228224 - - - - pl sapvol-02 - DISABLED 204800 - - - - sd dg_sap02-01 sapvol-02 ENABLED 204800 0 - - - v sapvol fsgen ENABLED 204800 - ACTIVE - - pl sapvol-01 sapvol ENABLED 204800 - ACTIVE - - sd dg_sap01-01 sapvol-01 ENABLED 204800 0 - - - [root@sheldon] / #
- Reattach the plex to the volume and reestablish the mirror.
[root@sheldon] / # vxplex -g dg_sap att sapvol sapvol-02 [root@sheldon] / #
And we are done for now, more VxVM stuff in a future post :-)
Juanma.
Fixing my own stupidity and a bunch of DRD errors
I was playing this afternoon with DRD in an 11.23 machine and just after launching the clone process I decided to stop it with Ctrl-C since I wasn’t logging the session and I wanted to do it. The process stopped with an error and I was sent back to the shell.
* Copying File Systems To New System Image
ERROR: Exiting due to keyboard interrupt.
* Unmounting New System Image Clone
* System image: "sysimage_001" on disk "/dev/dsk/c2t1d0"
ERROR: Caught signal SIGINT. This process is running critical code, this signal will be handled shortly.
ERROR: Caught signal SIGINT. This process is running critical code, this signal will be handled shortly.
ERROR: Caught signal SIGINT. This process is running critical code, this signal will be handled shortly.
ERROR: Caught signal SIGINT. This process is running critical code, this signal will be handled shortly.
ERROR: Unmounting the file system fails.
- Unmounting the clone image fails.
- The "umount" command returned "13". The "sync" command returned "0". The error messages produced are the following: ""
* Unmounting New System Image Clone failed with 5 errors.
* Copying File Systems To New System Image failed with 6 errors.
======= 04/21/10 08:20:19 EDT END Clone System Image failed with 6 errors. (user=root) (jobid=ivm-v2)
I know it is a very bad idea but it’s not production server, just a virtual machine I use to perform tests. In fact my stupid behavior gave me the opportunity to discover and play with a funny and pretty bunch of errors. Here it is how I manage to resolve it.
I launched again the clone process in preview mode, just in case, and DRD fails with the following error.
[ivm-v2]/ # drd clone -p -v -t /dev/dsk/c2t1d0
======= 04/21/10 08:22:01 EDT BEGIN Clone System Image Preview (user=root) (jobid=ivm-v2)
* Reading Current System Information
* Selecting System Image To Clone
* Selecting Target Disk
ERROR: Selection of the target disk fails.
- Selecting the target disk fails.
- Validation of the disk "/dev/dsk/c2t1d0" fails with the following error(s):
- Target volume group device entry "/dev/drd00" exists. Run "drd umount" before proceeding.
* Selecting Target Disk failed with 1 error.
======= 04/21/10 08:22:10 EDT END Clone System Image Preview failed with 1 error. (user=root) (jobid=ivm-v2)
It seems that the original process just leaved the image mounted but after trying with drd umount just like the DRD output said it didn’t worked. The image was only partially created, yeah I created a beautiful mess ;-)
At that point, and in another “clever” movement, instead of simply removing the drd00 volume group I just deleted /dev/drd00… who’s da man!! or like we use to say in Spain ¡Con dos cojones!
DRD, of course, failed with a new error.
ERROR: Selection of the target disk fails.
- Selecting the target disk fails.
- Validation of the disk "/dev/dsk/c2t1d0" fails with the following error(s):
- Target volume group "/dev/drd00" found in logical volume table. "/etc/lvmtab" is corrupt and must be fixed before proceeding.
* Selecting Target Disk failed with 1 error.
Well it wasn’t so bad. I recreated /etc/lvmtab and yes… I fired up my friend Dynamic Root Disk in preview mode.
[ivm-v2]/ # rm -f /etc/lvmtab
[ivm-v2]/ # vgscan -v
Creating "/etc/lvmtab".
vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg00".
Invalid argument
Physical Volume "/dev/dsk/c3t2d0" contains no LVM information
/dev/vg00
/dev/dsk/c2t0d0s2
Following Physical Volumes belong to one Volume Group.
Unable to match these Physical Volumes to a Volume Group.
Use the vgimport command to complete the process.
/dev/dsk/c2t1d0s2
Scan of Physical Volumes Complete.
*** LVMTAB has been created successfully.
*** Do the following to resync the information on the disk.
*** #1. vgchange -a y
*** #2. lvlnboot -R
[ivm-v2]/ # lvlnboot -R
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[ivm-v2]/ #
[ivm-v2]/ # drd clone -p -v -t /dev/dsk/c2t1d0
======= 04/21/10 08:26:06 EDT BEGIN Clone System Image Preview (user=root) (jobid=ivm-v2)
* Reading Current System Information
* Selecting System Image To Clone
* Selecting Target Disk
ERROR: Selection of the target disk fails.
- Selecting the target disk fails.
- Validation of the disk "/dev/dsk/c2t1d0" fails with the following error(s):
- The disk "/dev/dsk/c2t1d0" contains data. To overwrite this disk use the option "-x overwrite=true".
* Selecting Target Disk failed with 1 error.
======= 04/21/10 08:26:13 EDT END Clone System Image Preview failed with 1 error. (user=root) (jobid=ivm-v2)
I couldn’t believe that. Another error? Why in the hell I got involved with DRD? But I am an Sysadmin, and a stubborn one. Looked at the disk and discovered that it had been partitioned by the first failed DRD cloning process. I just wiped out the whole disk with idisk and just in case I used the overwrite option.
[ivm-v2]/ # idisk -p /dev/rdsk/c2t1d0 idisk version: 1.31 EFI Primary Header: Signature = EFI PART Revision = 0x10000 HeaderSize = 0x5c HeaderCRC32 = 0xe19d8a07 MyLbaLo = 0x1 AlternateLbaLo = 0x1117732f FirstUsableLbaLo = 0x22 LastUsableLbaLo = 0x1117730c Disk GUID = d79b52fa-4d43-11df-8001-d6217b60e588 PartitionEntryLbaLo = 0x2 NumberOfPartitionEntries = 0xc SizeOfPartitionEntry = 0x80 PartitionEntryArrayCRC32 = 0xca7e53ce Primary Partition Table (in 512 byte blocks): Partition 1 (EFI): Partition Type GUID = c12a7328-f81f-11d2-ba4b-00a0c93ec93b Unique Partition GUID = d79b550c-4d43-11df-8002-d6217b60e588 Starting Lba = 0x22 Ending Lba = 0xfa021 Partition 2 (HP-UX): Partition Type GUID = 75894c1e-3aeb-11d3-b7c1-7b03a0000000 Unique Partition GUID = d79b5534-4d43-11df-8003-d6217b60e588 Starting Lba = 0xfa022 Ending Lba = 0x110af021 Partition 3 (HPSP): Partition Type GUID = e2a1e728-32e3-11d6-a682-7b03a0000000 Unique Partition GUID = d79b5552-4d43-11df-8004-d6217b60e588 Starting Lba = 0x110af022 Ending Lba = 0x11177021 [ivm-v2]/ # [ivm-v2]/ # idisk -R /dev/rdsk/c2t1d0 idisk version: 1.31 ********************** WARNING *********************** If you continue you will destroy all partition data on this disk. Do you wish to continue(yes/no)? yes
Don’t know why but I was pretty sure that DRD was going to fail again… and it did.
======= 04/21/10 08:27:02 EDT BEGIN Clone System Image Preview (user=root) (jobid=ivm-v2) * Reading Current System Information * Selecting System Image To Clone * Selecting Target Disk * The disk "/dev/dsk/c2t1d0" contains data which will be overwritten. * Selecting Volume Manager For New System Image * Analyzing For System Image Cloning ERROR: Analysis of file system creation fails. - Analysis of target fails. - The analysis step for creation of an inactive system image failed. - The default DRD mount point "/var/opt/drd/mnts/sysimage_001/" cannot be used due to the following error(s): - The mount point /var/opt/drd/mnts/sysimage_001/ is not an empty directory as required. * Analyzing For System Image Cloning failed with 1 error. ======= 04/21/10 08:27:09 EDT END Clone System Image Preview failed with 1 error. (user=root) (jobid=ivm-v2)
After a quick check I found that the original image was mounted.
[ivm-v2]/ # mount / on /dev/vg00/lvol3 ioerror=mwdisable,delaylog,dev=40000003 on Wed Apr 21 07:29:37 2010 /stand on /dev/vg00/lvol1 ioerror=mwdisable,log,tranflush,dev=40000001 on Wed Apr 21 07:29:38 2010 /var on /dev/vg00/lvol8 ioerror=mwdisable,delaylog,dev=40000008 on Wed Apr 21 07:29:50 2010 /usr on /dev/vg00/lvol7 ioerror=mwdisable,delaylog,dev=40000007 on Wed Apr 21 07:29:50 2010 /tmp on /dev/vg00/lvol4 ioerror=mwdisable,delaylog,dev=40000004 on Wed Apr 21 07:29:50 2010 /opt on /dev/vg00/lvol6 ioerror=mwdisable,delaylog,dev=40000006 on Wed Apr 21 07:29:50 2010 /home on /dev/vg00/lvol5 ioerror=mwdisable,delaylog,dev=40000005 on Wed Apr 21 07:29:50 2010 /net on -hosts ignore,indirect,nosuid,soft,nobrowse,dev=1 on Wed Apr 21 07:30:26 2010 /var/opt/drd/mnts/sysimage_001 on /dev/drd00/lvol3 ioerror=nodisable,delaylog,dev=40010003 on Wed Apr 21 08:19:46 2010 /var/opt/drd/mnts/sysimage_001/stand on /dev/drd00/lvol1 ioerror=nodisable,delaylog,dev=40010001 on Wed Apr 21 08:19:46 2010 /var/opt/drd/mnts/sysimage_001/tmp on /dev/drd00/lvol4 ioerror=nodisable,delaylog,dev=40010004 on Wed Apr 21 08:19:46 2010 /var/opt/drd/mnts/sysimage_001/home on /dev/drd00/lvol5 ioerror=nodisable,delaylog,dev=40010005 on Wed Apr 21 08:19:46 2010 /var/opt/drd/mnts/sysimage_001/opt on /dev/drd00/lvol6 ioerror=nodisable,delaylog,dev=40010006 on Wed Apr 21 08:19:46 2010 /var/opt/drd/mnts/sysimage_001/usr on /dev/drd00/lvol7 ioerror=nodisable,delaylog,dev=40010007 on Wed Apr 21 08:19:46 2010 /var/opt/drd/mnts/sysimage_001/var on /dev/drd00/lvol8 ioerror=nodisable,delaylog,dev=40010008 on Wed Apr 21 08:19:47 2010 [ivm-v2]/ #
Had to unmount the filesystems of the image one by one and after almost committing suicide with a a rack rail I launched the clone again and without the preview, if I were going to play a stupid role at least it was going to the most stupid one in the world x-)
[ivm-v2]/ # drd clone -x overwrite=true -v -t /dev/dsk/c2t1d0 ======= 04/21/10 08:38:22 EDT BEGIN Clone System Image (user=root) (jobid=rx260-02) * Reading Current System Information * Selecting System Image To Clone * Selecting Target Disk * The disk "/dev/dsk/c2t1d0" contains data which will be overwritten. * Selecting Volume Manager For New System Image * Analyzing For System Image Cloning * Creating New File Systems ERROR: Clone file system creation fails. - Creating the target file systems fails. - Command "/opt/drd/lbin/drdconfigure" fails with the return code 255. The entire output from the command is given below: - Start of output from /opt/drd/lbin/drdconfigure: - * Creating LVM physical volume "/dev/rdsk/c2t1d0s2" (0/1/1/0.1.0). * Creating volume group "drd00". ERROR: Command "/sbin/vgcreate -A n -e 4356 -l 255 -p 16 -s 32 /dev/drd00 /dev/dsk/c2t1d0s2" failed. - End of output from /opt/drd/lbin/drdconfigure * Creating New File Systems failed with 1 error. * Unmounting New System Image Clone * System image: "sysimage_001" on disk "/dev/dsk/c2t1d0" ======= 04/21/10 08:38:46 EDT END Clone System Image failed with 1 error. (user=root) (jobid=rx260-02) [ivm-v2]/ #
I thought that every possible error was fixed but there it was DRD saying that it failed with a bogus “return code 255″, oh yes very insightful because it’s not a 254 or a 256 it is a 255 code and everybody know what it means… Shit! I don’t know what it means. Yes it was true, I didn’t know what “return code 255″ stood for. After doing a small search on ITRC there was only one entry about a similar case, only one. I manage to create a beautiful error, don’t you think?
The question is that there was a mismatch between the minor numbers the kernel believed were in use and those really visible in the device files. DRD will always try to use the next free based on the device files and since in my case there was only one in use but the kernel thought there were two in use, one from vg00 and another one from the failed clone, it failed.
The solution is to cheat the kernel creating a fake group device using the minor number the kernel thinks is in use.
[ivm-v2]/dev # mkdir fake [ivm-v2]/dev # cd fake [ivm-v2]/dev/fake # mknod group c 64 0x010000 [ivm-v2]/dev/fake #
After that I launched DRD and everything went smoothly.
Fortunately everything happened in a test virtual machine and at any step of my frustrating trip through self-generated DRD error I could reset the VM and start over again with a clean system but since the purpose of Dynamic Root Disk is to minimize the downtime of production systems the reboot was not an option, at least no the first in the list.
The credit for the solution goes to Judit Wathen from the Dynamic Root Disk Team at HP, continue with your great work :-D
Juanma.
[ivm-v2]/ # idisk -p /dev/rdsl k/c2t1d0
idisk version: 1.31
EFI Primary Header:
Signature = EFI PART
Revision = 0×10000
HeaderSize = 0x5c
HeaderCRC32 = 0xe19d8a07
MyLbaLo = 0×1
AlternateLbaLo = 0x1117732f
FirstUsableLbaLo = 0×22
LastUsableLbaLo = 0x1117730c
Disk GUID = d79b52fa-4d43-11df-8001-d6217b60e588
PartitionEntryLbaLo = 0×2
NumberOfPartitionEntries = 0xc
SizeOfPartitionEntry = 0×80
PartitionEntryArrayCRC32 = 0xca7e53ce
Primary Partition Table (in 512 byte blocks):
Partition 1 (EFI):
Partition Type GUID = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Unique Partition GUID = d79b550c-4d43-11df-8002-d6217b60e588
Starting Lba = 0×22
Ending Lba = 0xfa021
Partition 2 (HP-UX):
Partition Type GUID = 75894c1e-3aeb-11d3-b7c1-7b03a0000000
Unique Partition GUID = d79b5534-4d43-11df-8003-d6217b60e588
Starting Lba = 0xfa022
Ending Lba = 0x110af021
Partition 3 (HPSP):
Partition Type GUID = e2a1e728-32e3-11d6-a682-7b03a0000000
Unique Partition GUID = d79b5552-4d43-11df-8004-d6217b60e588
Starting Lba = 0x110af022
Ending Lba = 0×11177021
[ivm-v2]/ #
[ivm-v2]/ # idisk -R /dev/rdsk/c2t1d0
idisk version: 1.31
********************** WARNING ***********************
If you continue you will destroy all partition data on this disk.
Do you wish to continue(yes/no)? yes
New HP-UX release, new HPVM, new features… same odd naming convention
Last month HP released the last update of HP-UX 11iv3, the Update 6 or the March 2010 Update or 11.36… I decided some time ago to do not try to understand why we have a so stupid naming scheme for HP-UX.
Anyway, putting aside the philosophical rambling, HP-UX 11iv3 update 6 is here and it came full of new features. The following ones stand out, at least for me.
- Improved system boot time thanks to RCEnhancement, Oliver wrote about it several weeks ago, until this release it was available in the Software Depot and now is included in the install media.
- New DRD version capable of synchronize the clone with the running system.
- LVM updated to version 2.2. With this version we have logical volume snapshots, can’t wait to try this :-D, logical volume migration within the same VG through the new lvmove command and boot support for LVM 2.2 volume groups, this is very cool because until this release the vg00 was stuck in LVM 1.0. Ignite-UX have also been updated to take advantage of this feature and we’ll be asked to choose between LVM 1.0 and LVM 2.2 bootable volume groups.
This release comes bundled with the new HPVM version, the 4.2, which also adds a bunch of new features. To name a few.
- Automatic memory reallocation.
- Capacity of suspend and resume a guest.
- Support for CVM/CFS backing stores for HPVM Serviceguard cluster packages.
- Encryption of the data during Online VM migration.
- AVIO support for Veritas Volume Manager based backing stores.
In short, there are a lot of new interesting features, a lot issues have also been fixed and as I said at the beginning we still have to live with an odd naming scheme but in the end I’m quite happy with this new release at least in theory because I didn’t have the opportunity to try it yet but I will do very soon since I’m planning to deploy HPVM 4.2 in the near future. In fact my HPVM 3.5 to 4.1 migration project has become a 3.5 to 4.2 migration, how cool is that eh! ;-)
Juanma.
HPVM clones first boot tasks
Welcome again to “HPVM World!” my dear readers :-D
Have to say that even with the initial disappointment about hpvmclone, cloning IVMs was a very funny task but I believe that the after cloning tasks weren’t very clear, at least for me, so I decided to write this follow up post to clarify that part.
Let’s assume we already have a cloned virtual machine, in this particular case I used dd to clone the virtual disk and later I created the IVM and added the storage device and the other resources but it also applied to the other method with minor changes.
[root@hpvmhost] ~ # hpvmstatus -P vmnode2 -d [Virtual Machine Devices] [Storage Interface Details] disk:scsi:0,0,0:lv:/dev/vg_vmtest/rvmnode2disk dvd:scsi:0,0,1:disk:/dev/rdsk/c1t4d0 [Network Interface Details] network:lan:0,1,0xB20EBA14E76C:vswitch:localnet network:lan:0,2,0x3E9492C9F615:vswitch:vlan02 [Misc Interface Details] serial:com1::tty:console [root@hpvmhost] ~ #
We start the virtual machine an access its console.Now we are going to follow some of the final steps of the third method described in my previous post. From the main EFI Boot Manager select the Boot option maintenance menu option.
EFI Boot Manager ver 1.10 [14.62] [Build: Mon Oct 1 09:27:26 2007]
Please select a boot option
EFI Shell [Built-in]
Boot option maintenance menu
Use ^ and v to change option(s). Use Enter to select an option
Select Boot from a file and the select the first partition:
EFI Boot Maintenance Manager ver 1.10 [14.62]
Boot From a File. Select a Volume
IA64_EFI [Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun0,Lun0)/HD(Part1,Sig
IA64_EFI [Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun0,Lun0)/HD(Part3,Sig7
Removable Media Boot [Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun1,Lun0)]
Load File [Acpi(PNP0A03,0)/Pci(1|0)/Mac(B20EBA14E76C)]
Load File [Acpi(PNP0A03,0)/Pci(2|0)/Mac(3E9492C9F615)]
Load File [EFI Shell [Built-in]]
Legacy Boot
Exit
Enter the EFI directory then the HPUX directory and finally select hpux.file. Like I said before this part is very similar to the final steps of Method 3.
EFI Boot Maintenance Manager ver 1.10 [14.62]
Select file or change to new directory:
03/09/10 03:45p <DIR> 4,096 .
03/09/10 03:45p <DIR> 4,096 ..
03/10/10 04:21p 657,609 hpux.efi
03/09/10 03:45p 24,576 nbp.efi
Exit
After this the machine will boot.
Filename: \EFI\HPUX\hpux.efi DevicePath: [Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun0,Lun0)/HD(Part1,Sig71252358-2BCD-11DF-8000-D6217B60E588)/\EFI\HPUX\hpux.efi] IA-64 EFI Application 03/10/10 04:21p 657,609 bytes (C) Copyright 1999-2008 Hewlett-Packard Development Company, L.P. All rights reserved HP-UX Boot Loader for IPF -- Revision 2.036 Press Any Key to interrupt Autoboot \EFI\HPUX\AUTO ==> boot vmunix Seconds left till autoboot - 0 AUTOBOOTING...> System Memory = 2042 MB loading section 0 ..................................................................................... (complete) loading section 1 ............... (complete) loading symbol table loading System Directory (boot.sys) to MFS ..... loading MFSFILES directory (bootfs) to MFS .................. Launching /stand/vmunix SIZE: Text:43425K + Data:7551K + BSS:22118K = Total:73096K ...
When the VM is up login as root. The first tasks as always are to change hostname and network configuration to avoid conflicts.
Next we are going recreate lvmtab since the current one contains the LVM configuration of the source virtual machine. Performing a simple vgdisplay will show it.
root@vmnode2:/# vgdisplay vgdisplay: Warning: couldn't query physical volume "/dev/disk/disk15_p2": The specified path does not correspond to physical volume attached to this volume group vgdisplay: Warning: couldn't query all of the physical volumes. --- Volume groups --- VG Name /dev/vg00 VG Write Access read/write VG Status available Max LV 255 Cur LV 8 Open LV 8 Max PV 16 Cur PV 1 Act PV 0 Max PE per PV 3085 VGDA 0 PE Size (Mbytes) 8 Total PE 0 Alloc PE 0 Free PE 0 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 root@vmnode2:/#
To correct this remove the /etc/lvmtab file and launch a vgscan.
root@vmnode2:/# rm /etc/lvmtab /etc/lvmtab: ? (y/n) y root@vmnode2:/var/tmp/software# vgscan Creating "/etc/lvmtab". vgscan: Couldn't access the list of physical volumes for volume group "/dev/vg00". Physical Volume "/dev/dsk/c1t1d0" contains no LVM information *** LVMTAB has been created successfully. *** Do the following to resync the information on the disk. *** #1. vgchange -a y *** #2. lvlnboot -R root@vmnode2:/#
Follow the recommended steps in vgscan output, the first step only applies if there are any other VGs in the system, if there is only vg00 it is already active so this step is not necesary.
Running lvnlboot -R is mandatory since we need to recover and update the links to the lvols in the Boot Data Reserved Area of the booting disk.
root@vmnode2:/# lvlnboot -R Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf root@vmnode2:/#
Now the LVM configuration is fixed, try again the vgdisplay command.
root@vmnode2:/# vgdisplay --- Volume groups --- VG Name /dev/vg00 VG Write Access read/write VG Status available Max LV 255 Cur LV 8 Open LV 8 Max PV 16 Cur PV 1 Act PV 1 Max PE per PV 3085 VGDA 2 PE Size (Mbytes) 8 Total PE 3075 Alloc PE 2866 Free PE 209 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 root@vmnode2:/#
With the LVM configuration fixed the next step is to indicate the booting disk to the system.
root@vmnode2:/# setboot -p /dev/disk/disk21_p2 Primary boot path set to 0/0/0/0.0x0.0x0 (/dev/disk/disk21_p2) root@vmnode2:/# root@vmnode2:/# setboot Primary bootpath : 0/0/0/0.0x0.0x0 (/dev/rdisk/disk21) HA Alternate bootpath : Alternate bootpath : Autoboot is ON (enabled) root@vmnode2:/#
Finally reboot the virtual machine and if we did everything correctly a new boot option will be available in the EFI Boot Manager.
EFI Boot Manager ver 1.10 [14.62] [Build: Mon Oct 1 09:27:26 2007]
Please select a boot option
HP-UX Primary Boot: 0/0/0/0.0x0.0x0
EFI Shell [Built-in]
Boot option maintenance menu
Use ^ and v to change option(s). Use Enter to select an option
Let the system boot by itself through the new default option (HP-UX Primary Boot) and we are done.
Any feedback would be welcome.
Juanma.
Coming back to the IVM world
Yes I have to admit it, it’s been a while since the last time I created an Integrity Virtual Machine. In my last job didn’t have HPVM and here the VMs were already running when I arrived. So a few weeks ago I decided to cut my teeth again with HPVM, specially since I am pushing forward very hard for an OS and HPVM version upgrade of the IVM cluster which is currently running HP-UX 11.23 with HPVM 3.5.
First logical step in order to get proficient again with IVM is to create a new virtual machine. I asked Javi, our storage guy, for a new LUN and after add it to my lab server I started the whole process.
Some of the steps are obvious for any HP-UX Sysadmin, like VGs and LVs creation, but I decided to show the commands in order to maintain some consistency across this how-to/checklist/what-ever-you-like-to-call-it.
- Create a volume group for the IVM virtual disks.
[root@hpvmhost] ~ # vgcreate -s 16 -e 6000 vg_vmtest /dev/dsk/c15t7d1 Volume group "/dev/vg_vmtest" has been successfully created. Volume Group configuration for /dev/vg_vmtest has been saved in /etc/lvmconf/vg_vmtest.conf [root@hpvmhost] ~ # [root@hpvmhost] ~ # vgextend vg_vmtest /dev/dsk/c5t7d1 /dev/dsk/c7t7d1 /dev/dsk/c13t7d1 Volume group "vg_vmtest" has been successfully extended. Volume Group configuration for /dev/vg_vmtest has been saved in /etc/lvmconf/vg_vmtest.conf [root@hpvmhost] ~ # vgdisplay -v vg_vmtest --- Volume groups --- VG Name /dev/vg_vmtest VG Write Access read/write VG Status available Max LV 255 Cur LV 0 Open LV 0 Max PV 16 Cur PV 1 Act PV 1 Max PE per PV 6000 VGDA 2 PE Size (Mbytes) 16 Total PE 3199 Alloc PE 0 Free PE 3199 Total PVG 0 Total Spare PVs 0 Total Spare PVs in use 0 --- Physical volumes --- PV Name /dev/dsk/c15t7d1 PV Name /dev/dsk/c5t7d1 Alternate Link PV Name /dev/dsk/c7t7d1 Alternate Link PV Name /dev/dsk/c13t7d1 Alternate Link PV Status available Total PE 3199 Free PE 3199 Autoswitch On Proactive Polling On [root@hpvmhost] ~ #
- Create one lvol for each disk you want to add to your virtual machine, of course these lvols must belong to the volume group previously created.
[root@hpvmhost] ~ # lvcreate -L 12000 -n ivm1d1 vg_vmtest Logical volume "/dev/vg_vmtest/ivm1d1" has been successfully created with character device "/dev/vg_vmtest/rivm1d1". Logical volume "/dev/vg_vmtest/ivm1d1" has been successfully extended. Volume Group configuration for /dev/vg_vmtest has been saved in /etc/lvmconf/vg_vmtest.conf [root@hpvmhost] ~ # [root@hpvmhost] ~ # lvcreate -L 12000 -n ivm1d2 vg_vmtest Logical volume "/dev/vg_vmtest/ivm1d2" has been successfully created with character device "/dev/vg_vmtest/rivm1d2". Logical volume "/dev/vg_vmtest/ivm1d2" has been successfully extended. Volume Group configuration for /dev/vg_vmtest has been saved in /etc/lvmconf/vg_vmtest.conf [root@hpvmhost] ~ #
- Now we’re going to do some real stuff. Create the IVM with the hpvmcreate command and use the hpvmstatus to check that everything went well :
[root@hpvmhost] ~ # hpvmcreate -P ivm1 -O hpux [root@hpvmhost] ~ # hpvmstatus -P ivm1 [Virtual Machine Details] Virtual Machine Name VM # OS Type State ==================== ===== ======= ======== ivm1 8 HPUX Off [Authorized Administrators] Oper Groups: Admin Groups: Oper Users: Admin Users: [Virtual CPU Details] #vCPUs Entitlement Maximum ====== =========== ======= 1 10.0% 100.0% [Memory Details] Total Reserved Memory Memory ======= ======== 2 GB 64 MB [Storage Interface Details] Guest Physical Device Adaptor Bus Dev Ftn Tgt Lun Storage Device ======= ========== === === === === === ========= ========================= [Network Interface Details] Interface Adaptor Name/Num PortNum Bus Dev Ftn Mac Address ========= ========== ========== ======= === === === ================= [Misc Interface Details] Guest Physical Device Adaptor Bus Dev Ftn Tgt Lun Storage Device ======= ========== === === === === === ========= ========================= serial com1 tty console [root@hpvmhost] ~ #
We have a new virtual machine created but with no resources at all.
If you have read the HPVM documentation, and you should, probably know that every resource can be assigned at this step but I like to add them later one by one.
Since now we’re going to use the hpvmstatus to verify every change made. This command can be invoked without options to show a general summary or can query a single virtual machine, a verbose option is also available with -V. Take a look of its man page to check more options.
- Add more CPU and RAM. The default values are 1 vCPU and 2GB of RAM, more can be assigned with hpvmmodify:
[root@hpvmhost] ~ # hpvmmodify -P ivm1 -c 2 [root@hpvmhost] ~ # hpvmmodify -P ivm1 -r 4G [root@hpvmhost] ~ # hpvmstatus [Virtual Machines] Virtual Machine Name VM # OS Type State #VCPUs #Devs #Nets Memory Runsysid ==================== ===== ======= ========= ====== ===== ===== ======= ======== oratest01 1 HPUX On (OS) 4 10 3 16 GB 0 oratest02 2 HPUX On (OS) 4 8 3 16 GB 0 sapvm01 3 HPUX Off 3 8 3 8 GB 0 sapvm02 4 HPUX Off 3 7 3 8 GB 0 sles01 5 LINUX On (OS) 1 4 3 4 GB 0 rhel01 6 LINUX Off 1 4 3 4 GB 0 hp-vxvm 7 HPUX On (OS) 2 17 3 6 GB 0 ivm1 8 HPUX Off 2 0 0 4 GB 0 [root@hpvmhost] ~ #
- With the CPUs and RAM finished it’s time to add the storage devices, as always we’re going to use hpvmmodify:
[root@hpvmhost] ~ # hpvmmodify -P ivm1 -a disk:scsi::lv:/dev/vg_vmtest/rivm1d1 [root@hpvmhost] ~ # hpvmmodify -P ivm1 -a disk:scsi::lv:/dev/vg_vmtest/rivm1d2 [root@hpvmhost] ~ # hpvmmodify -P ivm1 -a dvd:scsi::disk:/dev/rdsk/c1t4d0 [root@hpvmhost] ~ # hpvmstatus -P ivm1 [Virtual Machine Details] Virtual Machine Name VM # OS Type State ==================== ===== ======= ======== ivm1 8 HPUX Off [Authorized Administrators] Oper Groups: Admin Groups: Oper Users: Admin Users: [Virtual CPU Details] #vCPUs Entitlement Maximum ====== =========== ======= 2 10.0% 100.0% [Memory Details] Total Reserved Memory Memory ======= ======== 4 GB 64 MB [Storage Interface Details] Guest Physical Device Adaptor Bus Dev Ftn Tgt Lun Storage Device ======= ========== === === === === === ========= ========================= disk scsi 0 2 0 0 0 lv /dev/vg_vmtest/rivm1d1 disk scsi 0 2 0 1 0 lv /dev/vg_vmtest/rivm1d2 dvd scsi 0 2 0 2 0 disk /dev/rdsk/c1t4d0 [Network Interface Details] Interface Adaptor Name/Num PortNum Bus Dev Ftn Mac Address ========= ========== ========== ======= === === === ================= [Misc Interface Details] Guest Physical Device Adaptor Bus Dev Ftn Tgt Lun Storage Device ======= ========== === === === === === ========= ========================= serial com1 tty console [root@hpvmhost] ~ #
An important tip about the storage devices, remember that you have to use the character device file of the LV. If a block device is used you will get the following error:
[root@hpvmhost] ~ # hpvmmodify -P ivm1 -a disk:scsi::lv:/dev/vg_vmtest/ivm1d1 hpvmmodify: WARNING (ivm1): Expecting a character device file for disk backing file, but '/dev/vg_vmtest/ivm1d1' appears to be a block device. hpvmmodify: ERROR (ivm1): Illegal blk device '/dev/vg_vmtest/ivm1d1' as backing device. hpvmmodify: ERROR (ivm1): Unable to add device '/dev/vg_vmtest/ivm1d1'. hpvmmodify: Unable to create device disk:scsi::lv:/dev/vg_vmtest/ivm1d1. hpvmmodify: Unable to modify the guest. [root@hpvmhost] ~ #
- Virtual networking 1: First check the available virtual switches with hpvmnet:
[root@hpvmhost] / # hpvmnet Name Number State Mode NamePPA MAC Address IP Address ======== ====== ======= ========= ======== ============== =============== localnet 1 Up Shared N/A N/A vlan02 2 Up Shared lan3 0x000000000000 192.168.1.12 vlan03 3 Up Shared lan4 0x001111111111 10.10.3.4 [root@hpvmhost] / #
- Virtual Networking 2: Add a couple of vnics to the virtual machine.
[root@hpvmhost] / # hpvmmodify -P ivm1 -a network:lan:vswitch:vlan02 [root@hpvmhost] / # hpvmmodify -P ivm1 -a network:lan:vswitch:localnet [root@hpvmhost] / # [root@hpvmhost] / # hpvmstatus -P ivm1 [Virtual Machine Details] Virtual Machine Name VM # OS Type State ==================== ===== ======= ======== ivm1 8 HPUX Off [Authorized Administrators] Oper Groups: Admin Groups: Oper Users: Admin Users: [Virtual CPU Details] #vCPUs Entitlement Maximum ====== =========== ======= 2 10.0% 100.0% [Memory Details] Total Reserved Memory Memory ======= ======== 4 GB 64 MB [Storage Interface Details] Guest Physical Device Adaptor Bus Dev Ftn Tgt Lun Storage Device ======= ========== === === === === === ========= ========================= disk scsi 0 2 0 0 0 lv /dev/vg_vmtest/rivm1d1 disk scsi 0 2 0 1 0 lv /dev/vg_vmtest/rivm1d2 dvd scsi 0 2 0 2 0 disk /dev/rdsk/c1t4d0 [Network Interface Details] Interface Adaptor Name/Num PortNum Bus Dev Ftn Mac Address ========= ========== ========== ======= === === === ================= vswitch lan vlan02 8 0 0 0 56-e9-e3-09-6a-22 vswitch lan localnet 8 0 1 0 ae-d6-f7-fa-4e-3e [Misc Interface Details] Guest Physical Device Adaptor Bus Dev Ftn Tgt Lun Storage Device ======= ========== === === === === === ========= ========================= serial com1 tty console [root@hpvmhost] / #
- And we have an IVM ready to be used. To start it use the hpvmstart command and access its console with hpvmconsole, the interface is almost equal to GSP/MP.
[root@hpvmhost] ~ # hpvmstart -P ivm1
(C) Copyright 2000 - 2008 Hewlett-Packard Development Company, L.P.
Opening minor device and creating guest machine container
Creation of VM, minor device 3
Allocating guest memory: 4096MB
allocating low RAM (0-80000000, 2048MB)
/opt/hpvm/lbin/hpvmapp (/var/opt/hpvm/uuids/2b3b1198-2062-11df-9e06-001a4b07f002/vmm_config.current): Allocated 2147483648 bytes at 0x6000000100000000
allocating high RAM (100000000-180000000, 2048MB)
/opt/hpvm/lbin/hpvmapp (/var/opt/hpvm/uuids/2b3b1198-2062-11df-9e06-001a4b07f002/vmm_config.current): Allocated 2147483648 bytes at 0x6000000200000000
locking memory: 100000000-180000000
allocating datalogger memory: FF800000-FF840000 (256KB for 155KB)
/opt/hpvm/lbin/hpvmapp (/var/opt/hpvm/uuids/2b3b1198-2062-11df-9e06-001a4b07f002/vmm_config.current): Allocated 262144 bytes at 0x6000000300000000
locking datalogger memory
allocating firmware RAM (fff00000-fff20000, 128KB)
/opt/hpvm/lbin/hpvmapp (/var/opt/hpvm/uuids/2b3b1198-2062-11df-9e06-001a4b07f002/vmm_config.current): Allocated 131072 bytes at 0x6000000300080000
locked SAL RAM: 00000000fff00000 (8KB)
locked ESI RAM: 00000000fff02000 (8KB)
locked PAL RAM: 00000000fff04000 (8KB)
locked Min Save State: 00000000fff06000 (8KB)
locked datalogger: 00000000ff800000 (256KB)
Loading boot image
Image initial IP=102000 GP=67E000
Initialize guest memory mapping tables
Starting event polling thread
Starting thread initialization
Daemonizing....
hpvmstart: Successful start initiation of guest 'ivm1'
[root@hpvmhost] ~ #
[root@hpvmhost] ~ # hpvmconsole -P ivm1
vMP MAIN MENU
CO: Console
CM: Command Menu
CL: Console Log
SL: Show Event Logs
VM: Virtual Machine Menu
HE: Main Help Menu
X: Exit Connection
[ivm1] vMP> co
(Use Ctrl-B to return to vMP main menu.)
- - - - - - - - - - Prior Console Output - - - - - - - - - -
And we are finished. I’m not going through the installation process since it’s not the objective of this post and it is very well documented in the HP-UX documentation.
I really enjoyed this post, it has been very useful exercise in order to re-learn the roots of HPVM and a very good starting point for the HP-UX/HPVM upgrade I’m going to undertake during next weeks.
Juanma.
Linux LVM commands in HP-UX
Some of the features I always liked about the Linux LVM2 implementation are the lvs, vgs and pvs command. with this simple commands a short list of the LVs, VGs and PVs active on the system can be obtained.
www04:~ # vgs VG #PV #LV #SN Attr VSize VFree vgwww01 1 6 0 wz--n- 39.75G 6.25G vgbbdd 3 3 0 wz--n- 94.25G 0 vgsys 1 6 0 wz--n- 34.74G 1.25G www04:~ #
In HP-UX there is nothing similar available, well since HP-UX 11.31 and LVM2 a “-F” option has been added to produce a formated, more script friendly list but is not very “human readable”.
[root@nfscl02] ~ # vgdisplay -vF vg00 vg_name=/dev/vg00:vg_write_access=read,write:vg_status=available:max_lv=255:cur_lv=9:open_lv=9:max_pv=16:cur_pv=1:act_pv=1:max_pe_per_pv=4353:vgda=2:pe_size=32:total_pe=4322:alloc_pe=1539:free_pe=2783:total_pvg=0:total_spare_pvs=0:total_spare_pvs_in_use=0:vg_version=1.0:vg_max_size=2228736m:vg_max_extents=69648 lv_name=/dev/vg00/lvol1:lv_status=available,syncd:lv_size=1856:current_le=58:allocated_pe=58:used_pv=1 lv_name=/dev/vg00/lvol2:lv_status=available,syncd:lv_size=8192:current_le=256:allocated_pe=256:used_pv=1 lv_name=/dev/vg00/lvol3:lv_status=available,syncd:lv_size=1504:current_le=47:allocated_pe=47:used_pv=1 lv_name=/dev/vg00/lvol4:lv_status=available,syncd:lv_size=512:current_le=16:allocated_pe=16:used_pv=1 lv_name=/dev/vg00/lvol5:lv_status=available,syncd:lv_size=8192:current_le=256:allocated_pe=256:used_pv=1 lv_name=/dev/vg00/lvol6:lv_status=available,syncd:lv_size=5024:current_le=157:allocated_pe=157:used_pv=1 lv_name=/dev/vg00/lvol7:lv_status=available,syncd:lv_size=5024:current_le=157:allocated_pe=157:used_pv=1 lv_name=/dev/vg00/lvol8:lv_status=available,syncd:lv_size=8704:current_le=272:allocated_pe=272:used_pv=1 lv_name=/dev/vg00/lv_crash:lv_status=available,syncd:lv_size=10240:current_le=320:allocated_pe=320:used_pv=1 pv_name=/dev/disk/disk1_p2:pv_status=available:total_pe=4322:free_pe=2783:autoswitch=On:proactive_polling=On [root@nfscl02] ~ #
Because of this I decided to write three scripts to emulate the behavior of vgs, lvs and pvs on my HP-UX servers. This scripts take advantage of the mentioned LVM2 “-F” switch so they will not work on HP-UX 11.23 or any other previous versions. If anyones recognize the “scripting” style is because I grab some parts of the code from Olivier’s ioscan_fc2.sh and adapted them to my needs so credit goes to him also :-)
- VGS: List the volume group on the /etc/lvmtab file, if the server is part of a cluster the volume groups active on other nodes will be showed as deactivated. With the “-v” switch single VGs can be queried.
root@cldpp01:~# ./vgs.sh VG PVs LVs Status Version VGSize Free vg00 1 9 available 1.0 135G 77G vgdpp 1 1 available,exclusive 1.0 49G 0G vgidbbck deactivated root@cldpp01:~# ./vgs.sh -v vgdpp VG PVs LVs Status Version VGSize Free vgdpp 1 1 available,exclusive 1.0 49G 0G root@cldpp01:~#
The code:
#!/sbin/sh
#
# vgs.sh - script to emulate the Linux LVM command vgs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
version="v0.1 2010/02/15"
function usage
{
echo
echo "VGS for HP-UX ${version}"
echo
echo "Usage: vgs [-v vg_name]"
echo
exit 1
}
if [ ! "$(uname -r)" = "B.11.31" ]
then
echo "VGS for HP-UX only works on HP-UX 11iv3"
exit 1
fi
if [ "$1" ]
then
case "$1" in
-v) shift; [ "$1" = "" ] && usage || vg_name=${1};;
*) usage;;
esac
fi
vg_display="vgdisplay -F"
[ ! "${vg_name}" = "" ] && vg_display="vgdisplay -F ${vg_name}"
printf "%-10s %-5s %-5s %-20s %-8s %-6s %-5s\n" VG PVs LVs Status Version VGSize Free
eval ${vg_display} | while IFS=":" read vgdisplay
do
echo ${vgdisplay} | cut -d ":" -f 2 | cut -d "=" -f 2 | read status
if [ "${status}" = "deactivated" ]
then
status=deactivated
vg_size=""
vg_free=""
else
echo ${vgdisplay} | cut -d ":" -f 3 | cut -d "=" -f 2 | read status
echo ${vgdisplay} | cut -d ":" -f 13 | cut -d "=" -f 2 | read total_pe
echo ${vgdisplay} | cut -d ":" -f 12 | cut -d "=" -f 2 | read pe_size
echo ${vgdisplay} | cut -d ":" -f 15 | cut -d "=" -f 2 | read free_pe
vg_size="`/usr/bin/expr $total_pe \* $pe_size / 1024`G"
vg_free="`/usr/bin/expr $free_pe \* $pe_size / 1024`G"
fi
echo ${vgdisplay} | cut -d ":" -f 1 | cut -d "=" -f 2 | cut -d "/" -f 3 | read vg_name
echo ${vgdisplay} | cut -d ":" -f 8 | cut -d "=" -f 2 | read pvs
echo ${vgdisplay} | cut -d ":" -f 5 | cut -d "=" -f 2 | read lvs
echo ${vgdisplay} | cut -d ":" -f 19 | cut -d "=" -f 2 | read version
printf "%-10s %-5s %-5s %-20s %-8s %-6s %-5s\n" "${vg_name}" "${pvs}" "${lvs}" "${status}" "${version}" "${vg_size}" "${vg_free}"
done
- LVS: Like its Linux counterpart shows a list with every active logical volume. As in vgs with the -v switch you can ask the list of a specific volume group.
root@asoka:/# ./lvs.sh -v vg00 LV VG Status LVSize Permissions Mirrors Stripes Allocation lvol1 vg00 available,syncd 1G read,write 0 0 strict,contiguous lvol2 vg00 available,syncd 8G read,write 0 0 strict,contiguous lvol3 vg00 available,syncd 1G read,write 0 0 strict,contiguous lvol4 vg00 available,syncd 0G read,write 0 0 strict lvol5 vg00 available,syncd 20G read,write 0 0 strict lvol6 vg00 available,syncd 1G read,write 0 0 strict lvol7 vg00 available,syncd 5G read,write 0 0 strict lvol8 vg00 available,syncd 20G read,write 0 0 strict lv_crash vg00 available,syncd 9G read,write 0 0 strict root@asoka:/#
The code:
#!/sbin/sh
#
# lvs.sh - script to emulate the Linux LVM command lvs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
version="v0.1 2010/02/15"
function usage
{
echo
echo "LVS for HP-UX ${version}"
echo
echo "Usage: lvs [-v vg_name]"
echo
exit 1
}
if [ ! "$(uname -r)" = "B.11.31" ]
then
echo "LVS for HP-UX only works on HP-UX 11iv3"
exit 1
fi
if [ "$1" ]
then
case "$1" in
-v) shift; [ "$1" = "" ] && usage || vg_name=${1};;
*) usage;;
esac
fi
lv_list="vgdisplay -vF | grep lv_name"
[ ! "${vg_name}" = "" ] && lv_list="vgdisplay -vF ${vg_name} | grep lv_name"
printf "%-30s %-12s %-17s %-6s %-10s %-7s %-8s %-8s %-7s\n" LV VG Status LVSize Permissions Mirrors Stripes Allocation
eval ${lv_list} | while IFS=":" read lvlist
do
echo ${lvlist} | cut -d ":" -f 1 | cut -d "/" -f 4 | read lv_name
echo ${lvlist} | cut -d ":" -f 1 | cut -d "=" -f 2 | read lv_long_name
lvdisplay -F ${lv_long_name} | cut -d ":" -f 2 | cut -d "/" -f 3 | read vg_name
lvdisplay -F ${lv_long_name} | cut -d ":" -f 4 | cut -d "=" -f 2 | read lv_status
lvdisplay -F ${lv_long_name} | cut -d ":" -f 3 | cut -d "=" -f 2 | read lv_perm
lvdisplay -F ${lv_long_name} | cut -d ":" -f 5 | cut -d "=" -f 2 | read lv_mirrors
lvdisplay -F ${lv_long_name} | cut -d ":" -f 11 | cut -d "=" -f 2 | read lv_stripes
lvdisplay -F ${lv_long_name} | cut -d ":" -f 14 | cut -d "=" -f 2 | read lv_allocation
lvdisplay -F ${lv_long_name} | cut -d ":" -f 8 | cut -d "=" -f 2 | read size_megs
lv_size="`/usr/bin/expr $size_megs / 1024`G"
printf "%-30s %-12s %-17s %-6s %-17s %-7s %-2s %-5s\n" "${lv_name}" "${vg_name}" "${lv_status}" "${lv_size}" "${lv_perm}" "${lv_mirrors}" "${lv_stripes}" "${lv_allocation}"
done
- PVS: And now the last one. List the activated physical volumes, if a VGs is not active on the current node its PVs wouldn’t be shown. Like in pvs and vgs there is a “-v” switch.
root@oracle:~# ./pvs.sh PV VG Status PVSize Free /dev/disk/disk1_p2 vg00 available 135G 48G /dev/disk/disk28 vgora available 1G 0G /dev/disk/disk29 vgora available 5G 0G /dev/disk/disk30 vgora available 3G 0G /dev/disk/disk31 vgora available 51G 1G /dev/disk/disk32 vgora available 1G 0G /dev/disk/disk37 vgora available 3G 0G /dev/disk/disk38 vgora available 6G 0G /dev/disk/disk43 vgoracli available 3G 0G /dev/disk/disk119 vgoracli available 2G 0G root@oracle:~#
And the code:
#!/sbin/sh
#
# pvs.sh - script to emulate the Linux LVM command pvs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
version="v0.1 2010/02/15"
function usage
{
echo
echo "PVS for HP-UX ${version}"
echo
echo "Usage: pvs [-v vg_name]"
echo
exit 1
}
if [ ! "$(uname -r)" = "B.11.31" ]
then
echo "PVS for HP-UX only works on HP-UX 11iv3"
exit 1
fi
if [ "$1" ]
then
case "$1" in
-v) shift; [ "$1" = "" ] && usage || vg_name=${1};;
*) usage;;
esac
fi
pv_list="vgdisplay -vF | grep disk"
[ ! "${vg_name}" = "" ] && pv_list="vgdisplay -vF ${vg_name} | grep disk"
printf "%-20s %-10s %-20s %-6s %-5s\n" PV VG Status PVSize Free
eval ${pv_list} | while IFS=":" read pvlist
do
echo ${pvlist} | cut -d ":" -f 1 | cut -d "=" -f 2 | read pv_name
pvdisplay -F ${pv_name} | cut -d ":" -f 2 | cut -d "=" -f 2 | cut -d "/" -f 3 | read vg_name
pvdisplay -F ${pv_name} | cut -d ":" -f 3 | cut -d "=" -f 2 | read status
pvdisplay -F ${pv_name} | cut -d ":" -f 8 | cut -d "=" -f 2 | read total_pe
pvdisplay -F ${pv_name} | cut -d ":" -f 7 | cut -d "=" -f 2 | read pe_size
pvdisplay -F ${pv_name} | cut -d ":" -f 9 | cut -d "=" -f 2 | read free_pe
pv_size="`/usr/bin/expr $total_pe \* $pe_size / 1024`G"
pv_free="`/usr/bin/expr $free_pe \* $pe_size / 1024`G"
printf "%-20s %-10s %-20s %-6s %-5s\n" "${pv_name}" "${vg_name}" "${status}" "${pv_size}" "${pv_free}"
done
As always any comments, corrections and/or suggestions are welcome.
Juanma.
vg00 mirroring
This is a small cookbook about mirroring the vg00 I’ve compiled throughout the years, well it’s really more like a list with the commands but I believe it can be of usefulness for some of the newbies out there. It covers HP-UX 11.23 for PA-RISC and 11.23 and 11.31 for IA64.
- PA-RISC 11.23:
First initialize the disk.
root@ayane:/# pvcreate -f -B /dev/rdsk/c0t6d0
Now make the disk bootable writing the LIF header.
root@ayane:/# mkboot -l /dev/dsk/c0t6d0
And the LIF files, I’m using the unenforced quorum option because in my example the vg00 has only two PVs.
root@ayane:/# mkboot -a 'hpux -lq' /dev/dsk/c0t6d0
Add the new PV to vg00.
root@ayane:/# vgextend vg00 /dev/dsk/c0t6d0
Create the mirrors of the logical volumes within vg00 in the new PV.
root@ayane:/# for i in $(vgdisplay -v vg00 | grep "LV Name" | awk '{ print $3 };')
> do
> lvextend -m 1 $i /dev/dsk/c0t6d0
> done
When the mirror is finished.
root@ayane:/# lvlnboot -r /dev/vg00/lvol3 /dev/vg00 root@ayane:/# lvlnboot -b /dev/vg00/lvol1 /dev/vg00 root@ayane:/# lvlnboot -s /dev/vg00/lvol2 /dev/vg00 root@ayane:/# lvlnboot -d /dev/vg00/lvol2 /dev/vg00
Specify the new disk as alternate boot path and add it to /stand/bootconf.
root@ayane:/# setboot -a 0/0/0/3/0.6.0 root@ayane:/# cat /stand/bootconf l /dev/dsk/c0t5d0 l /dev/dsk/c0t6d0 root@ayane:/#
And it’s done. To check that everything correct.
root@ayane:/# vgdisplay -v vg00
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 10
Open LV 10
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 4384
VGDA 4
PE Size (Mbytes) 32
Total PE 8748
Alloc PE 4076
Free PE 4672
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
--- Logical volumes ---
.
.
.
--- Physical volumes ---
PV Name /dev/dsk/c0t5d0
PV Status available
Total PE 4374
Free PE 2336
Autoswitch On
Proactive Polling On
PV Name /dev/dsk/c0t6d0
PV Status available
Total PE 4374
Free PE 2336
Autoswitch On
Proactive Polling On
root@ayane:/#
root@ayane:/# lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c0t5d0 (0/0/0/3/0.5.0) -- Boot Disk
/dev/dsk/c0t6d0 (0/0/0/3/0.6.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c0t5d0
/dev/dsk/c0t6d0
Root: lvol3 on: /dev/dsk/c0t5d0
/dev/dsk/c0t6d0
Swap: lvol2 on: /dev/dsk/c0t5d0
/dev/dsk/c0t6d0
Dump: lvol2 on: /dev/dsk/c0t5d0, 0
root@ayane:/#
root@ayane:/# setboot
Primary bootpath : 0/0/0/3/0.6.0
HA Alternate bootpath : 0/0/0/0/0.0.0
Alternate bootpath : 0/0/0/3/0.5.0
Autoboot is ON (enabled)
Autosearch is ON (enabled)
root@ayane:/#
root@ayane:/# lifls -l /dev/dsk/c0t6d0
volume ISL10 data size 7984 directory size 8 05/09/22 09:37:09
filename type start size implement created
===============================================================
HPUX -12928 584 1024 0 06/10/27 14:23:07
ISL -12800 1608 242 0 05/09/22 09:37:09
AUTO -12289 1856 1 0 05/09/22 09:37:09
PAD -12290 1864 1468 0 05/09/22 09:37:09
LABEL BIN 3336 8 0 07/07/17 19:42:29
root@ayane:/#
- Itanium 11.23:
The procedure of mirroring the vg00 in an Itanium HP-UX 11.23, although shares some part with the PA-RISC differs in some critical area. The main difference is the partitioning of the disk, the boot disks in an Integrity server must have an specific layout with three paritions:
- EFI
- HPUX
- HPSP (HP Service Partition)
Preparation of the disk:
root@asoka:/# touch /tmp/partitionfile root@asoka:/# cat <<EOF >> /tmp/partitionfile > 3 > EFI 500MB > HPUX 100% > HPSP 400MB > EOF root@asoka:/# cat partitionfile 3 EFI 500MB HPUX 100% HPSP 400MB root@asoka:/# root@asoka:/# idisk -wqf /tmp/partitionfile /dev/rdsk/c1t1d0
Make it bootable and copy the AUTO file. As it can be viewed in the example below an s<number_of_partition> has been added to the device in order to identify the partition in which the operation will be executed.
root@asoka:/# insf -eCdisk root@asoka:/# mkboot -e -l /dev/rdsk/c1t1d0 root@asoka:/# echo "boot vmunix -lq" >> /tmp/AUTO.lq root@asoka:/# efi_cp -d /dev/rdsk/c1t1d0s1 /tmp/AUTO.lq /EFI/HPUX/AUTO
Create the HPSP partition.
root@asoka:/# dd if=/dev/rdsk/c0t1d0s3 of=/dev/rdsk/c1t1d0s3 bs=1024k
Like in PA-RISC initialize the PV and add it to the VG.
root@asoka:/# pvreate -f -B /dev/rdsk/c1t1d0s2 root@asoka:/# vgextend vg00 /dev/dsk/c1t1d0s2
Mirror the Logical Volumes.
root@asoka:/# for i in $(vgdisplay -v vg00 | grep "LV Name" | awk '{ print $3 };')
> do
> lvextend -m 1 $i /dev/dsk/c1t1d0s2
> done
Set the content of the LABEL file, edit the /stand/bootconf like in the PA-RISC procedure and add the new disk as alternate HA bootpath.
root@asoka:/# setboot -h <HW_PATH>
To check that everything is properly configured you can use the same commands as in PA-RISC and the command idisk to check the correct partitioning of the disk.
root@asoka:/# idisk -p /dev/rdsk/c1t1d0 idisk version: 1.32 EFI Primary Header: Signature = EFI PART Revision = 0x10000 HeaderSize = 0x5c HeaderCRC32 = 0xa498de56 MyLbaLo = 0x1 MyLbaHi = 0x0 AlternateLbaLo = 0x88aacbf AlternateLbaHi = 0x0 FirstUsableLbaLo = 0x22 FirstUsableLbaHi = 0x0 LastUsableLbaLo = 0x88aac9c LastUsableLbaHi = 0x0 Disk GUID = 24e8312a-20cf-11dd-8001-d6217b60e588 PartitionEntryLbaLo = 0x2 PartitionEntryLbaHi = 0x0 NumberOfPartitionEntries = 0xc SizeOfPartitionEntry = 0x80 PartitionEntryArrayCRC32 = 0xae99dcc3 Primary Partition Table (in 512 byte blocks): Partition 1 (EFI): Partition Type GUID = c12a7328-f81f-11d2-ba4b-00a0c93ec93b Unique Partition GUID = 24e83378-20cf-11dd-8002-d6217b60e588 Starting Lba Lo = 0x22 Starting Lba Hi = 0x0 Ending Lba Lo = 0xfa021 Ending Lba Hi = 0x0 Partition 2 (HP-UX): Partition Type GUID = 75894c1e-3aeb-11d3-b7c1-7b03a0000000 Unique Partition GUID = 24e83396-20cf-11dd-8003-d6217b60e588 Starting Lba Lo = 0xfa022 Starting Lba Hi = 0x0 Ending Lba Lo = 0x87e2821 Ending Lba Hi = 0x0 Partition 3 (HPSP): Partition Type GUID = e2a1e728-32e3-11d6-a682-7b03a0000000 Unique Partition GUID = 24e833b4-20cf-11dd-8004-d6217b60e588 Starting Lba Lo = 0x87e2822 Starting Lba Hi = 0x0 Ending Lba Lo = 0x88aa821 Ending Lba Hi = 0x0 root@asoka:/#
- Itanium 11.31:
The 11.31 section will be short since the procedure is almost equal to the 11.23 one. You have to take into account that if you have migrated to the new agile view (and you should have ;-D ) a few things will change. The new agile view use _p1,_p2 and _p3 to identify the partitions of the disk instead of the classic s1, s2 & s3 and the paths will change from dsk/rdsk to disk/rdisk, the names of the devices as well.
A few of examples will show it.
root@piroko:/# efi_cp -d /dev/rdisk/disk4_p1 /tmp/AUTO.lq /EFI/HPUX/AUTO
root@piroko:/# pvcreate -fB /dev/rdisk/disk4_p2
root@piroko:/# vgextend rootvg /dev/disk/disk_p2
root@piroko:/# for i in $(vgdisplay -v vg00| grep "LV Name" | awk '{ print $3 };')
> do
> lvextend -m 1 $i /dev/disk/disk4_p2
> done
And we are done. As always every comment or correction will be welcome.
See you next time.
Juanma.
idisk version: 1.32EFI Primary Header:
Signature = EFI PART
Revision = 0×10000
HeaderSize = 0x5c
HeaderCRC32 = 0xa498de56
MyLbaLo = 0×1
MyLbaHi = 0×0
AlternateLbaLo = 0x88aacbf
AlternateLbaHi = 0×0
FirstUsableLbaLo = 0×22
FirstUsableLbaHi = 0×0
LastUsableLbaLo = 0x88aac9c
LastUsableLbaHi = 0×0
Disk GUID = 24e8312a-20cf-11dd-8001-d6217b60e588
PartitionEntryLbaLo = 0×2
PartitionEntryLbaHi = 0×0
NumberOfPartitionEntries = 0xc
SizeOfPartitionEntry = 0×80
PartitionEntryArrayCRC32 = 0xae99dcc3
Primary Partition Table (in 512 byte blocks):
Partition 1 (EFI):
Partition Type GUID = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Unique Partition GUID = 24e83378-20cf-11dd-8002-d6217b60e588
Starting Lba Lo = 0×22
Starting Lba Hi = 0×0
Ending Lba Lo = 0xfa021
Ending Lba Hi = 0×0
Partition 2 (HP-UX):
Partition Type GUID = 75894c1e-3aeb-11d3-b7c1-7b03a0000000
Unique Partition GUID = 24e83396-20cf-11dd-8003-d6217b60e588
Starting Lba Lo = 0xfa022
Starting Lba Hi = 0×0
Ending Lba Lo = 0x87e2821
Ending Lba Hi = 0×0
Partition 3 (HPSP):
Partition Type GUID = e2a1e728-32e3-11d6-a682-7b03a0000000
Unique Partition GUID = 24e833b4-20cf-11dd-8004-d6217b60e588
Starting Lba Lo = 0x87e2822
Starting Lba Hi = 0×0
Ending Lba Lo = 0x88aa821
Ending Lba Hi = 0×0

