Operating System - HP-UX
1832348 Members
2372 Online
110041 Solutions
New Discussion

Re: How to reduce the temp directory

 
M.sureshkumar
Regular Advisor

How to reduce the temp directory

Hi All,
We have 2GB /tmp directory.I need 1 gb space from temp directory.How to reduce the temp dirctory.
Pls give the procedure to reduce the temp directory.

Regards,
Suresh,
13 REPLIES 13
Peter Godron
Honored Contributor

Re: How to reduce the temp directory

Suresh,
if you just want to clear some space delete some files. The command
"du -sk * | sort -krn" should help you identify what to delete.

If you want to shrink the /tmp lvol to free up space in the vg bring the machine to single user mode and do a lvreduce. This will destroy data!
Regards
Sunil Sharma_1
Honored Contributor

Re: How to reduce the temp directory

suresh,

1. reboot the machiine
2. stop at ISl and go to single user mode
ISL>hpus -is

make sure /tmp is not mounted.
bdf /tmp

#lvreduce -L 1000 /dev/vg00/lvol6 (in standard hpux installation /tmp is lvol6 but double check before running this command)

#newfs -F vxfs /dev/vg00/lvol6

#shutdown -r now

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
MarkSyder
Honored Contributor

Re: How to reduce the temp directory

You've been given good answers for reducing the size of the logical volume, so I'll concentrate on clearing out files (if that is what you want).

As this is a tmp directory, I'll assume no one is putting anything in there they want to keep. In this case, you can run:

find /tmp -mtime +7 -exec rm {} \;

which will delete files over a week old.

It's a good idea to have this running as a cron job.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Nguyen Anh Tien
Honored Contributor

Re: How to reduce the temp directory

If your /tmp directory contain temporary data, not importance you can reduce it by thus procedure:
Determine which lv mount to /tmp
[server1:/imap] bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 204800 174928 29672 85% /
/dev/vg00/lvol1 298928 74240 194792 28% /stand
/dev/vg00/lvol8 4710400 1945920 2743008 42% /var
/dev/vg00/lvol7 1245184 1170904 74280 94% /usr
/dev/vg00/lvol4 204800 153712 50960 75% /tmp
/dev/vg01/lvprd 3223552 2403015 769302 76% /prd
#lvextend -L 1024M /dev/vg00/lvol4
========note===========
lvol4 mount to /tmp
=======================
#fsadm -F vxfs -b 1024M /tmp
that all.
tienna
HP is simple
Nguyen Anh Tien
Honored Contributor

Re: How to reduce the temp directory

Sorry Sure. I misorder.
It must be (I just test on my system)
[server1:/tmp] fsadm -F vxfs -b 150M /tmp
vxfs fsadm: /dev/vg00/rlvol4 is currently 204800 sectors - size will be reduced
[server1:/tmp] lvreduce -L 150M /dev/vg00/lvol4
Warning: rounding up logical volume size to extent boundary at size "152" MB.
When a logical volume is reduced useful data might get lost;
do you really want the command to proceed (y/n) : y
Logical volume "/dev/vg00/lvol4" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf


Sorry for misorder.
tienna
HP is simple
M.sureshkumar
Regular Advisor

Re: How to reduce the temp directory

Hi All,

I need to reduce temp directory as well as i use that space to create new logical volume.Pls give me procedure.

Regards,
Suresh.
Robert-Jan Goossens
Honored Contributor

Re: How to reduce the temp directory

Hi,
--sunil's answer--
make sure /tmp is not mounted.
bdf /tmp

#lvreduce -L 1000 /dev/vg00/lvol6 (in standard hpux installation /tmp is lvol6 but double check before running this command)

#newfs -F vxfs /dev/vg00/lvol6

#shutdown -r now
---
After the shutdown create a new logical volume.
# bdf
/dev/vg00/lvol3 255253 148390 81337 65% /
/dev/vg00/lvol1 95701 35337 50793 41% /stand
/dev/vg00/lvol7 648643 448888 134890 77% /var
/dev/vg00/lvol6 700691 486743 143878 77% /usr
/dev/vg00/lvol5 255253 1770 227957 1% /tmp
/dev/vg00/lvol4 1001051 515983 384962 57% /opt

on my system the new logical volume would be 8

# lvcreate -L 1000 -n lvol8 /dev/vg00
# newfs -F vxfs /dev/vg00/rlvol8

Regards,
Robert-Jan
Robert-Jan Goossens
Honored Contributor

Re: How to reduce the temp directory

add on,

create a new mountpoint
# mkdir /new_mount_point
add the new logical volume to the /etc/fstab
/dev/vg00/lvol8 /new_mount_point vxfs 0 2
# mount -a
M.sureshkumar
Regular Advisor

Re: How to reduce the temp directory

hi Goossens,

I can't umount the temp directory.
I got the following error.
umount:can not umount temp dirctory :device busy
Umount:return error=1
I used umount commant in root login and i opend only one telnet session.

Regards,
Suresh.
Thierry Poels_1
Honored Contributor

Re: How to reduce the temp directory

hi,

/tmp is nearly always in used.
That's why shutdown to single user was advised to perform this operation.

regards,
Thierry
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Robert-Jan Goossens
Honored Contributor

Re: How to reduce the temp directory

Two options,

# shutdown -h -y now

boot into single user mode.

or you can try to kill the processes using /tmp

# fuser -k /tmp

# umount /tmp

Regards,
Robert-Jan
Sunil Sharma_1
Honored Contributor

Re: How to reduce the temp directory

Suresh,

alternatively if you have some free space in vg00 you can create one new 1Gb file system and then change fstab to moutn this new fs to /tmp and then reboot.

After boot up /tmp wll be 1 gb and now you can remove or reduce old /tmp filesystem

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
bhavin asokan
Honored Contributor

Re: How to reduce the temp directory

hi suresh,

your profile shows that you have assigned points only for 17 responses out of 150.

http://forums1.itrc.hp.com/service/forums/publicProfile.do?userId=CA999444&forumId=1

if you are assigning points then only the other members come to know their solutions were valuable and how much it helped to solve your problems.

see the link

http://forums1.itrc.hp.com/service/forums/helptips.do?#28

regds,