Operating System - HP-UX
1851571 Members
3417 Online
104061 Solutions
New Discussion

Extendfs /var filesystem.

 
SOLVED
Go to solution
Richard Ace
Frequent Advisor

Extendfs /var filesystem.

Hi people, I need help/clarification on this one. I need to extend /var filesystem. A colegue has already done the lvextend I just need to do the "extendfs" on /var. I dont have the option of run-level 1 Single-User, Nor do I have the luxury of a Web-Console.
Just straight SSH F-Secure or Telnet.

My plan is:-

Vi /etc/inittab
Change init default to 2 from 4

Vi /etc/fstab
#hash out the mounting of /var

reboot without mounting /var ?
or
unmount /var before killing of the process accessing the /var FS ?

extendfs /dev/vg00/rlvol7

mount /var cos /var/tmp spcae for vi ing.

edit /etc/fstab

#unhash the entry for /var mounting

vi /etc/inittab

default run-level from 2 to 4.

Questions:

Is my plan ok and will it work?

Cheers
Rich

12 REPLIES 12
Rgomes
Valued Contributor
Solution

Re: Extendfs /var filesystem.

It won't work.

1) If you have OnlineJFS, then you can do it on the fly w/o unmounting the /var file system.
2) If you can reboot the server ( in your action plan), then why not going to single user mode and extend the file system?

regards,
Richard


Sanjay Kumar Suri
Honored Contributor

Re: Extendfs /var filesystem.

I have following observation:

1. You need to use following syntax
#extendfs -F vxfs (or hfs) /dev/vg00/rlvol7

2. Confirm with bdf that /var has been extended as desired.

The above is applicable if you don't have online JFS or in case of extending an HFS file system.

With online JFS product, you can extend a FS without unmounting as the following example shows:

#fsadm -F vxfs -b 32M /myfs2

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Victor Fridyev
Honored Contributor

Re: Extendfs /var filesystem.

Hi,

As far as I understand, you don't have online JFS on the server. In this case ( after make_recovery backup, naturally) you reboot the computer, stop normal start up and go to single user mode
hpux -is
In this mode you can extend the logical volume by
lvextend -L NEW_SIZE_MB /dev/vg00/lvol7
and extend the file system by:
extendfs -F vxfs /dev/vg00/rlvol7
and go to normal status by
init 4
Entities are not to be multiplied beyond necessity - RTFM
eran maor
Honored Contributor

Re: Extendfs /var filesystem.

Hi Rich

it shuold have work on single user mode ,
when you boot into single user mode only / file system is mount , a little advise , also do mount /usr to have all the command

that you will have the command vgdisplay and lvdisplay , just check to see current PE and Allocation PE , and if you have free PE just extendfs them , you can aslo use the command fs_wrapper that is the same as extendfs .

if you have an error reply it
love computers
KapilRaj
Honored Contributor

Re: Extendfs /var filesystem.

Nope .... it is not going to work.

1. You need to unmount /var to do this if you do not have Online JFS
2. To unmount /var , you will need to shutdown most of the subsystems and daemons which includes inetd, through which you are connected to the system (ssh/telnet)

Bring it to single user mod and do this.

Regds,

Kaps
Nothing is impossible
SS_6
Valued Contributor

Re: Extendfs /var filesystem.

You can also free up space in /var and you may not have to increase it.
Use cleanup command, do preview option first, Do man on cleanup for more options.
By providing solutions I am helping myself
Sanjay_6
Honored Contributor

Re: Extendfs /var filesystem.

Hi Rich,

You cannot boot the system to multiuser mode without /var. So you have to boot the system in single user mode and extend /var if you don't have online JFS.

If you gave online JFS you can do this without a reboot using the fsadm command. IF not then reboot the system in single user mode and extend /var and then reboot in multiuser mode. No point in messing with fstab and inittab. It won't help.

Hope this helps.

Regds
Bill Hassell
Honored Contributor

Re: Extendfs /var filesystem.

/var is used by everything including the opsystem (for example, syslog) so it is not possible to unmount /var except in single user mode. Don't use any knowledge you have about getting to single user mode on other flavors of Unix--they won't work. Even the HP-UX man pages are not completely accurate (init s will not work, and shutdown 0 gemerally doesn't work). You need to shutdown -r 0, then interrupt the boot process and enter the ISL command: hpux -is. You'll know you are in true single user mode when there are no filesystems mounted except / and /stand. Then you can lvextend and extendfs any of the unmounted filesystems. (/stand and / cannot be extended due to the contiguous requirement for these filesystems)


Bill Hassell, sysadmin
Richard Ace
Frequent Advisor

Re: Extendfs /var filesystem.

Thanks all for your help. I was remotely dialed. So I had no Web-Console, no Online JFS. An no access to the Console itself otherwise I would have just gone in single user mode, with no problem. On the understanding that I would lose Inetd and I was on remote dial I would have been stuffed.

Might create a Filesysem with an extra 500mb's more than /var. Directly copy the data from /var to over to the new filesystem.
Change the FSTAB to reflect the new lv/fs and reboot picking up the new lv/fs

I pressume that would work

Cheers

Rich

p.s.

Thanks for your help plus I will assign you all top marks.

Suresh Patoria
Super Advisor

Re: Extendfs /var filesystem.

Hi,

start the system in single user mode and unmount
the /var.

If u unable to unmount the /var file system then use the command
#exec umount /var

then extend the logical volume
#lvextend -L <> /dev/vgXX/lvolx

#extendfs /dev/vgXX/rlvolX

All the best
Thanx
Bill Hassell
Honored Contributor

Re: Extendfs /var filesystem.

Actually, it can be done by splitting /var into additional mountpoints. Start by seeing where most of your space is located:

du -kx /var | sort -rn | head

Usually, /var/adm/crash will pop to the top (if you had a system crash) so the contents can be removed. The other (relatively quiet) directory is /var/adm/sw and can be safely moved as long as you aren't running swinstall. Create another lvol, perhaps 500 to 1000 megs (can be on any VG but for consistency and use with Ignite/UX, try to use VG00), newfs the lvol and mount it to a temporary directory, as in:

lvcreate -L 1000 vg01
newfs /dev/vg00/lvol-whatever
mkdir /mnt1
mount /dev/vg00/lvol-whatever /mnt1
cd /var/adm/sw
find . | cpio -pudlmv /mnt1

Now you have a copy of /var/adm/sw. Just to make sure all has been copied, count the directories and files:

find /var/adm/sw -type f | wc -l
find /mnt1 -type f | wc -l

find /var/adm/sw -type d | wc -l
find /mnt1 -type d | wc -l

NOTE: There will be one more directory on the /mnt1 lvol (lost+found because it is a separate filesystem) which is normal. The counts are just to check that everything was copied. Note also that du will likely report a different total size for the two filesystems. This is due to sparse files and reduced directories (see http://www.interex.org/pubcontent/enterprise/jan99/10qa/10qa.html)

Now that you have a copy of /var/adm/sw, you can umount /mnt1. Since we need to remove the directory contents on /var/adm/sw, now is a good time to run an Ignite/UX backup

Then carefully type: cd /tmp ; rm -r /var/adm/sw/* (be very careful not to insert any spaces, especially before the *) Now you'll have an empty /var/adm/sw which is your new mountpoint. Edit /etc/fstab and create a new entry:

/dev/vg00/lvol-whatever /var/adm/sw vxfs nosuid,largefiles,rw,delaylog 0 4

then test that it works correctly with:

mount /var/adm/sw

I use this method (edit fstab, then mount with only 1 parameter) so fstab can be verified. You will now have some 200-400 megs of free space in /var and lost of room to grow in /var/adm/sw, all online with no reboot.

BTW: you can see the difficulty in remotely managing systems without true console access. You may want to look at a secure console server. If there are several machines (including network routers, firewalls, etc) at the remote site, take a look at Cyclades which can have from 1 to 48 serial port consoles all accessible through SSH protocol.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: Extendfs /var filesystem.

I just noticed that there is a trailing ) in the web reference above. It should read: http://www.interex.org/pubcontent/enterprise/jan99/10qa/10qa.html


Bill Hassell, sysadmin