and while executing this, we are getting the following error:
sort: A write error occurred while merging.
While reading about this I come to know this is because of insufficient size in TMP directory, but as I am not a unix guy, I don't know which TMP directory "sort" is using and what is the maximum size allocated to that directory. :wall:
It will be /var/tmp by default unless you have $TMPDIR set.
See man sort and the "-T" parameter regarding how to change it. You could need three times the size of the original file for work space.
Use the bdf command to find out where you have some free space.
I am still not able to find, why sort command is failing. I have set TMPDIR to /tmpdump (as shown above) which is of 8GB and same error. While sort command was running, I have executed df -k to see if size of directory is used or not. I noticed that
/tmpdump (/dev/vg02/lvol2 ) : 8323520 total allocated Kb
8306200 free allocated Kb
17320 used allocated Kb
0 % allocation used
and it remains the same. Please let me know how to solve this problem.
Thank you.
---------- Post updated at 01:32 PM ---------- Previous update was at 12:57 PM ----------
I saw that
TMPDIR=/tmpdump
export TMPDIR
is setting the TMPDIR to the current session only, while script is used in some other session. I want to make this change persist along all the unix sessions. How to do that?
Environment variables are not "global variables". There's no one place you can change it that will simultaneously change it for everyone.
Obvious way to do it: Run the export in the right session, not the wrong one.
More complicated way: Put it in the login scripts, perhaps /etc/profile, so the session you want will read it on login. You'll have to log out and log back in, or re-read the /etc/profile with . /etc/profile in the correct sesssion.
If your session is a cron job or something and doesn't even read those you'll have to set it manually because environment variables aren't globals and have to be read somehow.
Put this in the script containing the "sort" command.
Do not put it in /etc/profile or root's .profile because it refers to a filesystem which may not be mounted in every run state.
The "largefiles" option for fileystems is described in "man fsadm_vxfs", "man newfs_vxfs" and "man mkfs_vxfs". It allows you to create individual files larger than 2Gb. No really relevant to this thread.
Just for interest: To find out if you have any filesystems with "largefiles":