You are here

Extend root / File System online

Requirements:

- OnlineJFS is required to dynamically extend "/". Extending "/stand" does not require OnlineJFS because it can be unmounted at any run level. However, if there is unexpected activity within the file system, like someone manually building a new kernel, OnlineJFS will be required here as well.
- MirrorDisk-UX is required if the logical volumes are mirrored.
- A Fresh Ignite Backup

We need to extend 400Megs our root / Fs. Because it's a contigous/strict lvol we need to do the following procedure to extend /:

root@vmcluste:/> vgdisplay -v vg00
--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 7
Open LV 7
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 2709
VGDA 4
PE Size (Mbytes) 8
Total PE 5408
Alloc PE 5398
Free PE 10
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 346752m
VG Max Extents 43344

--- Logical volumes ---
LV Name /dev/vg00/lvol1
LV Status available/syncd
LV Size (Mbytes) 1792
Current LE 224
Allocated PE 448
Used PV 2

LV Name /dev/vg00/lvol2
LV Status available/syncd
LV Size (Mbytes) 1488
Current LE 186
Allocated PE 372
Used PV 2

LV Name /dev/vg00/lvol3
LV Status available/syncd
LV Size (Mbytes) 1024
Current LE 128
Allocated PE 256
Used PV 2

LV Name /dev/vg00/lvol4
LV Status available/syncd
LV Size (Mbytes) 512
Current LE 64
Allocated PE 128
Used PV 2

LV Name /dev/vg00/lvol5
LV Status available/syncd
LV Size (Mbytes) 7536
Current LE 942
Allocated PE 1884
Used PV 2

LV Name /dev/vg00/lvol6
LV Status available/syncd
LV Size (Mbytes) 5472
Current LE 684
Allocated PE 1368
Used PV 2

LV Name /dev/vg00/lvol_var
LV Status available/syncd
LV Size (Mbytes) 3768
Current LE 471
Allocated PE 942
Used PV 2

--- Physical volumes ---
PV Name /dev/disk/disk21_p2
PV Status available
Total PE 2699
Free PE 50
Autoswitch On
Proactive Polling On

PV Name /dev/disk/disk1_p2
PV Status available
Total PE 2699
Free PE 50
Autoswitch On
Proactive Polling On

We first break the mirror , removing disk1 from the lvols:

for i in $(pvdisplay -v /dev/disk/disk1_p2 | grep -E 'current.*0000 $' | awk ' { print $3 }')
> do
> lvreduce -m 0 $i /dev/disk/disk1_p2
> done
Logical volume "/dev/vg00/lvol1" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume "/dev/vg00/lvol2" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume "/dev/vg00/lvol3" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume "/dev/vg00/lvol4" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume "/dev/vg00/lvol5" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume "/dev/vg00/lvol6" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Logical volume "/dev/vg00/lvol_var" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Disk1 now has all the PE's free:

--- Physical volumes ---
PV Name /dev/disk/disk21_p2
PV Status available
Total PE 2699
Free PE 50
Autoswitch On
Proactive Polling On

PV Name /dev/disk/disk1_p2
PV Status available
Total PE 2699
Free PE 2699
Autoswitch On
Proactive Polling On

We now move lvols 1, 2 and 3 form disk21 to disk1

t@vmcluste:/> for i in 1 2 3
do
pvmove -n /dev/vg00/lvol$i /dev/disk/disk21_p2 /dev/disk/disk1_p2
done
Transferring logical extents of logical volume "/dev/vg00/lvol1"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Transferring logical extents of logical volume "/dev/vg00/lvol2"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Transferring logical extents of logical volume "/dev/vg00/lvol3"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Now we have lvols 1,2,3 in disk1 and the rest on disk21:

root@vmcluste:/> pvdisplay -v /dev/disk/disk1_p2 | grep -E 'current.*0000 $'
00000 current /dev/vg00/lvol1 00000
00224 current /dev/vg00/lvol2 00000
00410 current /dev/vg00/lvol3 00000
root@vmcluste:/> pvdisplay -v /dev/disk/disk21_p2 | grep -E 'current.*0000 $'
00538 current /dev/vg00/lvol4 00000
00602 current /dev/vg00/lvol5 00000
01544 current /dev/vg00/lvol6 00000
02228 current /dev/vg00/lvol_var 00000

So we can extend root lvol/fs without problems, because now it has contiguos free space on disk1:

root@vmcluste:/> lvextend -L 1400 /dev/vg00/lvol3
Logical volume "/dev/vg00/lvol3" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
root@vmcluste:/> fsadm -F vxfs -b 1400M /
UX:vxfs fsadm: INFO: V-3-25942: /dev/vg00/rlvol3 size increased from 1048576 sectors to 1433600 sectors
root@vmcluste:/> bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1433600 437944 987976 31% /

Once we have extended the lvol with the space we need, we can pvmove the rest of the lvols from disk21 to disk1:

root@vmcluste:/> for i in $(pvdisplay -v /dev/disk/disk21_p2 | grep -E 'current.*0000 $' | awk ' { print $3 }')
> do
> pvmove -n $i /dev/disk/disk21_p2 /dev/disk/disk1_p2
> done
Transferring logical extents of logical volume "/dev/vg00/lvol4"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Transferring logical extents of logical volume "/dev/vg00/lvol5"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Transferring logical extents of logical volume "/dev/vg00/lvol6"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Transferring logical extents of logical volume "/dev/vg00/lvol_var"...
Physical volume "/dev/disk/disk21_p2" has been successfully moved.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

Now we should have disk21 with all the PE's free:
--- Physical volumes ---
PV Name /dev/disk/disk21_p2
PV Status available
Total PE 2699
Free PE 2699
Autoswitch On
Proactive Polling On

PV Name /dev/disk/disk1_p2
PV Status available
Total PE 2699
Free PE 0
Autoswitch On
Proactive Polling On

Just for the sake of clarity we can reduce/extend disk21 so it's listed in second place(not really needed):

root@vmcluste:/var/adm/sw> vgreduce /dev/vg00 /dev/disk/disk21_p2
Volume group "/dev/vg00" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
root@vmcluste:/var/adm/sw> vgextend /dev/vg00 /dev/disk/disk21_p2
Volume group "/dev/vg00" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

We are going to rebuild the mirror:
root@vmcluste:/var/adm/sw> for i in $(pvdisplay -v /dev/disk/disk1_p2 | grep -E 'current.*0000 $' | awk ' { print $3 }')
> do
> lvextend -m 1 $i /dev/disk/disk21_p2
> done
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol2" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol3" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol4" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol5" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol6" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
The newly allocated mirrors are now being synchronized. This operation will
take some time. Please wait ....
Logical volume "/dev/vg00/lvol_var" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

We recreate the LABELS in the disks:

root@vmcluste:/var/adm/sw> lvlnboot -R /dev/vg00
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
root@vmcluste:/var/adm/sw> lvlnboot -v /dev/vg00
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/disk/disk1_p2 -- Boot Disk
/dev/disk/disk21_p2 -- Boot Disk
Boot: lvol1 on: /dev/disk/disk1_p2
/dev/disk/disk21_p2
Root: lvol3 on: /dev/disk/disk1_p2
/dev/disk/disk21_p2
Swap: lvol2 on: /dev/disk/disk1_p2
/dev/disk/disk21_p2
Dump: lvol2 on: /dev/disk/disk1_p2, 0

We have finished, you can now reboot from both disks, to check all is working OK.

Unix Systems: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.
Error | HP-UX Tips & Tricks Site

Error

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /homepages/37/d228974590/htdocs/includes/common.inc:2567) in drupal_send_headers() (line 1207 of /homepages/37/d228974590/htdocs/includes/bootstrap.inc).
  • PDOException: SQLSTATE[42000]: Syntax error or access violation: 1142 INSERT command denied to user 'dbo229817041'@'217.160.155.192' for table 'watchdog': INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => cron [:db_insert_placeholder_2] => Attempting to re-run cron while it is already running. [:db_insert_placeholder_3] => a:0:{} [:db_insert_placeholder_4] => 4 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.hpuxtips.es/?q=content/extend-root-file-system-online [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 54.90.207.75 [:db_insert_placeholder_9] => 1512950743 ) in dblog_watchdog() (line 157 of /homepages/37/d228974590/htdocs/modules/dblog/dblog.module).
The website encountered an unexpected error. Please try again later.