| |
 |
|
| Linux Forum Index » Linux Setup » renaming of /tmp partition. Any adverse effect on OS... |
|
Page 1 of 1 |
|
| Author |
Message |
| bzaman... |
Posted: Mon Sep 14, 2009 9:22 pm |
|
|
|
Guest
|
Hi ,
We need to migrate one of the applications from FreeBSD to Linux .
But need some clarification before we go
ahead with the migration.
Under these FreeBSD hosts , the /tmp partition is created under /home
and a symbolic link is created to /tmp
-bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
But our existing Linux hosts are having the following layout for /
tmp .
df -lh /tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-tmp 3.9G 46M 3.7G 2% /tmp
df -lh /tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 2.2G 7.0G 25% /
Some of the linux hosts are having separate partition for /tmp and
some are under / .
Our applications are failing because of the different layout for /tmp
in Linux . One solution we have thought of moving the /tmp partition
to /home and then create a
symbolic link from /home/tmp to /tmp . The original /tmp which is a
separate partition will be renamed to some /temp.
grep tmp /etc/fstab
/dev/sys/tmp /tmp ext3 defaults 0 0
will be changed to something like this.
/dev/sys/temp /temp ext3 defaults 0 0
-bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Our worry is whether will there be any effect in the normal
functioning of the OS . Will there be any impact on the Linux
applications which are already running are using /tmp for some use.
Should not have any
effect as far as I understand as we are creating a symbolic link from /
home/tmp to /tmp. As it is Prod host , we want to be sure before going
ahead with the migration without having any impact on the host and
applications already running . Please give your views.
With Thanks in Advance
--Zaman |
|
|
| Back to top |
|
|
|
| Nico Kadel-Garcia... |
Posted: Tue Sep 15, 2009 1:49 am |
|
|
|
Guest
|
On Sep 15, 3:22 am, bzaman <bzaman.las... at (no spam) gmail.com> wrote:
Quote: Hi ,
We need to migrate one of the applications from FreeBSD to Linux .
But need some clarification before we go
ahead with the migration.
Under these FreeBSD hosts , the /tmp partition is created under /home
and a symbolic link is created to /tmp
-bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
This sort of "hide the diskspace" game is common. I do hope that your
backup system knows to ignore /home/tmp? And that looks broken:
shouldn't the link be to /home/tmp? Because under Linux, and every
UNIX I know, that link would *never* work.
Quote: But our existing Linux hosts are having the following layout for /
tmp .
df -lh /tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-tmp 3.9G 46M 3.7G 2% /tmp
df -lh /tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 2.2G 7.0G 25% /
Some of the linux hosts are having separate partition for /tmp and
some are under / .
Yeah, it's a matter of taste and preventing applications that write
to /tmp excessively from overwhelming your / partition.
Quote: Our applications are failing because of the different layout for /tmp
in Linux . One solution we have thought of moving the /tmp partition
to /home and then create a
symbolic link from /home/tmp to /tmp . The original /tmp which is a
separate partition will be renamed to some /temp.
grep tmp /etc/fstab
/dev/sys/tmp /tmp ext3 defaults 0 0
will be changed to something like this.
/dev/sys/temp /temp ext3 defaults 0 0
Just comment it out. It's not gaining you anything, and *do not
rename* objects inder /dev/sys/! /dev objects are usually created by
the kernel and its utilities at boot time, and should not be re-
arranged from userland this way, because it won't work.
Quote: -bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Our worry is whether will there be any effect in the normal
functioning of the OS . Will there be any impact on the Linux
applications which are already running are using /tmp for some use.
Yes, there will. X windows, especially, keeps some pipes and things
under /tmp/ when running, so a reboot is in order, or at least
switching to runlevel 3 to turn off the automatic X graphical manager
and stopping any active X sessions. ssh-agent session keys are also
kept in /tmp/.
Quote: Should not have any
effect as far as I understand as we are creating a symbolic link from /
home/tmp to /tmp. As it is Prod host , we want to be sure before going
ahead with the migration without having any impact on the host and
applications already running . Please give your views.
Oh, there will be impact. But I think I've covered most of it. Can you
schedule a reboot? And can you mention the particular Linux OS?
More fundamentally, *why* are things not working under Linux. If your
applications are expecting /tmp/ to actually be in /home/tmp/ and
doing 'ln -s ../username/bin/program .', well, you get what you
deserve. If /tmp/ is overflowing, you may want to think carefully
about what your program is doing and designate a /var/cache/
applicatoin space to be managed a bit differently than /tmp/. Having
too many random applications write to /tmp/, can cause fascinating
issues, as I just experienced at work whan an application expected to
reliably write to /tmp/appdir/subdir/ and /tmp/appdir evaporated when
no one was looking.
Quote:
With Thanks in Advance
--Zaman |
|
|
| Back to top |
|
|
|
| Nico Kadel-Garcia... |
Posted: Tue Sep 15, 2009 2:03 am |
|
|
|
Guest
|
On Sep 15, 7:50 am, Aragorn <arag... at (no spam) chatfactory.invalid> wrote:
Aragorn, did you notice this?
Quote: -bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
I had to look twice. That's got /tmp pointing to a relative directory,
not an absolute one. Now, *THAT* is a tactical mistake, to my mind. I
have to take back my comment about it not working at all: it's too
*early* here for me to trace relative links, dang it!. But it looks
dangerous.
But folks do this sort of thing when the / partition isn't big enough,
and there is enough space on the '/home/' or, ore commonly, the '/
var/' partition. The historical separations of /tmp/, /var/tmp/, and /
usr/tmp/ of various systems are fascinating, but have mostly
evaporated with modern larger disks and the inability to tell which
of /tmp/, /var/tmp/, and /usr/tmp/ will wind up with all the debris in
it. The important thing in re-arranging /tmp/ is to make sure that
cleanup scripts and backup scripts handle them correctly and don't
clutter your tapes with the bulky, dynamically changing, non-critical
and thus improper to backp debris under /tmp/. |
|
|
| Back to top |
|
|
|
| Nico Kadel-Garcia... |
Posted: Tue Sep 15, 2009 2:06 am |
|
|
|
Guest
|
On Sep 15, 7:49 am, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Quote: df -lh /tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-tmp 3.9G 46M 3.7G 2% /tmp
And an even better 'hmmm'. If it's a size issue, this filesystem is an
LVM one, just the sort of thing to allow manipulation as needed. It
should be expandable if you have any space left on that LVM volume
group, or additional disk to add to the LVM physical volume and then
to the volume group.
What does lvscan and fdisk -l say? |
|
|
| Back to top |
|
|
|
| Aragorn... |
Posted: Tue Sep 15, 2009 5:33 am |
|
|
|
Guest
|
On Tuesday 15 September 2009 09:22, someone identifying as *bzaman*
wrote in /comp.os.linux.setup:/
Quote: We need to migrate one of the applications from FreeBSD to Linux .
Okay... :-)
Quote: But need some clarification before we go ahead with the migration.
Under these FreeBSD hosts , the /tmp partition is created under /home
and a symbolic link is created to /tmp
That's peculiar, because that would be the entirely opposite approach of
the multi-user philosophy. Normally, */tmp* in the root directory -
note: I am not saying "in the root filesystem" but "in the root
directory" - would be the actual storage for temporary files such as
sockets and the likes, and the user's home directory would or could
then possibly contain a symlink to the /real/ */tmp.*
Quote: -bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Like I said, this is the wrong way to do it. Whoever set up the system
like that is probably an ex-Windows user, and thus accustomed to a
single-user set up.
Quote: But our existing Linux hosts are having the following layout for /
tmp .
df -lh /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-tmp 3.9G 46M 3.7G 2% /tmp
(Note: trailing slash removed in the quoted command for newsreader text
formatting reasons. Likewise for the following quoted command.)
Okay, so on this system */tmp* is on a logical volume. Not my preferred
choice, but good enough.
Quote: df -lh /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 2.2G 7.0G 25% /
Okay, this is already better than how it was done on the FreeBSD
machine, but not quite a professional approach either. The idea is to
keep the root filesystem as static as possible, so you should
definitely split off the contents of */tmp* - and for that matter,
*/var* and */home* - from the root filesystem, especially for a server.
According to the File Hierarchy Standard (FHS) version 2.3, nothing
residing in */tmp* should be required to survive a reboot, and
therefore my favored and recommended approach is to have the contents
of */tmp* reside on a /tmpfs/ of limited size.
Quote: Some of the linux hosts are having separate partition for /tmp and
some are under / .
Uhuh, but see the last of the two above paragraphs. ;-)
Quote: Our applications are failing because of the different layout for /tmp
in Linux .
That is most likely due to a permissions problem. The */tmp* directory
in the root directory must have 1777 permissions, i.e. read, write and
execute/traverse permission for everyone, and with the sticky bit set.
The permissions mask for */tmp* should be "trwxrwxrwx".
By making the */tmp* in the root directory a symlink to a user-owned
directory, you are effectively disabling the required permissions on
*/tmp* for stuff that is not explicitly started by root or by the user
in whose home directory the mountpoint to the actual temporary
filesystem resides. Presumably, the person who set it up that way has
messed around with SUID bits and/or the permissions on the pertainining
user account's home directory.
Quote: One solution we have thought of moving the /tmp partition to /home and
then create a symbolic link from /home/tmp to /tmp . The original /tmp
which is a separate partition will be renamed to some /temp.
That is the totally wrong approach. You would be duplicating the
FreeBSD set-up - of which I cannot imagine that FreeBSD itself would
actually force such a policy upon the user, since it is totally
perverse to the UNIX philosophy - but you would then only be treating
the symptoms, not the cause.
Quote: grep tmp /etc/fstab
/dev/sys/tmp /tmp ext3 defaults 0 0
will be changed to something like this.
/dev/sys/temp /temp ext3 defaults 0 0
No, definitely not the right approach.
Quote: -bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Absolutely the wrong way.
Quote: Our worry is whether will there be any effect in the normal
functioning of the OS .
Yes, because */home/tmp* - or */home/$LOGIN/tmp* for that matter - won't
be world-writeable or sticky.
Quote: Will there be any impact on the Linux applications which are already
running are using /tmp for some use.
I'm not sure /what/ the impact will be, considering that I have
insufficient information regarding what is being executed on the
machine and by whom - i.e. under which user accounts. But yes, most
likely messing around with things like that would screw up the
functioning of the system.
Quote: Should not have any effect as far as I understand as we are creating a
symbolic link from /home/tmp to /tmp.
Of course it will have effects, because */tmp* requires special
permissions - see higher up - and you cannot give it those under
*/home* without compromising system integrity and security.
Quote: As it is Prod host , we want to be sure before going ahead with the
migration without having any impact on the host and applications
already running . Please give your views.
If this is a production machine - i.e. a server - then the whole precept
of using a temporary filesystem (or mountpoint) under */home* is
definitely wrong to begin with.
Hope this helps...
--
*Aragorn*
(registered GNU/Linux user #223157) |
|
|
| Back to top |
|
|
|
| Aragorn... |
Posted: Tue Sep 15, 2009 5:50 am |
|
|
|
Guest
|
On Tuesday 15 September 2009 13:33, someone identifying as *Aragorn*
wrote in /comp.os.linux.setup:/
Quote: On Tuesday 15 September 2009 09:22, someone identifying as *bzaman*
wrote in /comp.os.linux.setup:/
-bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Like I said, this is the wrong way to do it. Whoever set up the
system like that is probably an ex-Windows user, and thus accustomed
to a single-user set up.
To summarize, if you want an ad hoc solution to your problem, then I
would suggest to either...
° modify the code of the program so that it doesn't rely on a
*/home/tmp* or */home/$USER/tmp* anymore but instead attempts
to write its temporary files to */tmp* directly; or
° make sure that if */tmp* is a symbolic link to */home/tmp,*
the latter is given /trwxrwxrwx/ permissions, by using /su/
to become root first if you are logged in as a regular user,
and then issuing the two following commands...:
chown root:root /home/tmp
chmod 1777 /home/tmp
Personally, I recommend using a /tmpfs* mounted on */tmp*, and if the
program you are having difficulties with cannot be modified to use
*/tmp* instead of */home/tmp* - e.g. because the source code is not
available and/or the license does not allow it - to make sure that
*/tmp* has /trwxrwxrwx/ permissions and that there is a symlink in
*/home* pointing to */tmp* in the root directory.
Hope this helps... ;-)
--
*Aragorn*
(registered GNU/Linux user #223157) |
|
|
| Back to top |
|
|
|
| Marcel Bruinsma... |
Posted: Tue Sep 15, 2009 6:05 am |
|
|
|
Guest
|
bzaman wrote:
Quote: Our applications are failing because of the different layout
for /tmp in Linux.
Applications should use the TMPDIR environment variable.
Try,
mount --bind /tmp /home/tmp
Or in /etc/fstab,
/tmp /home/tmp none bind 0 0
Under *BSD /tmp is commonly a tmpfs mount. The same can
be done under linux, just make sure swap space is sufficient.
--
printf -v email $(echo \ 155 141 162 143 145 154 142 162 165 151 \
156 163 155 141 100 171 141 150 157 157 056 143 157 155|tr \ \\\\)
# Live every life as if it were your last! # |
|
|
| Back to top |
|
|
|
| Marcel Bruinsma... |
Posted: Tue Sep 15, 2009 6:40 am |
|
|
|
Guest
|
Nico Kadel-Garcia wrote:
Quote: On Sep 15, 3:22Â am, bzaman <bzaman.las... at (no spam) gmail.com> wrote:
lrwxrwxrwx  1 root  root  8 Feb 24  2009 /tmp -> home/tmp
This sort of "hide the diskspace" game is common. I do hope that
your backup system knows to ignore /home/tmp? And that looks
broken: shouldn't the link be to /home/tmp?
Either will work, the relative path home/tmp on / is the absolute
path /home/tmp.
What won't work, is any program (boot script in particular) that
needs /tmp before /home is mounted. Therefore, the tmp entry
in / must be a directory (not a symlink).
What will work, is
/dev/FOO /home <et cætera>
/home/tmp /tmp none bind 0 0
in fstab. Perhaps, the normal boot scripts need some
adjustment to clear /home/tmp after mounting /home.
--
printf -v email $(echo \ 155 141 162 143 145 154 142 162 165 151 \
156 163 155 141 100 171 141 150 157 157 056 143 157 155|tr \ \\\\)
# Live every life as if it were your last! # |
|
|
| Back to top |
|
|
|
| Marcel Bruinsma... |
Posted: Tue Sep 15, 2009 7:41 am |
|
|
|
Guest
|
Aragorn wrote:
Quote: Well, I know of some people who have */tmp* being a symlink
to */var/tmp,* yes - in a way, it makes sense,
Unfortunately, when booting in single-user mode the /var fs
won't be mounted, hence /tmp will be non-existent. TMPDIR
must be set elsewhere, to prevent complete chaos, yet other
problems might be looming around the corner; IIRC the /tmp
directory is part of the FHS, the LFH and IEEE Std 1003.1.
Sloppy administration, at least (it is after all unnecessary).
--
printf -v email $(echo \ 155 141 162 143 145 154 142 162 165 151 \
156 163 155 141 100 171 141 150 157 157 056 143 157 155|tr \ \\\\)
# Live every life as if it were your last! # |
|
|
| Back to top |
|
|
|
| bzaman... |
Posted: Wed Sep 16, 2009 12:46 am |
|
|
|
Guest
|
On Sep 15, 4:33 pm, Aragorn <arag... at (no spam) chatfactory.invalid> wrote:
Quote: On Tuesday 15 September 2009 09:22, someone identifying as *bzaman*
wrote in /comp.os.linux.setup:/
We need to migrate one of the applications from FreeBSD to Linux .
Okay... :-)
But need some clarification before we go ahead with the migration.
Under these FreeBSD hosts , the /tmp partition is created under /home
and a symbolic link is created to /tmp
That's peculiar, because that would be the entirely opposite approach of
the multi-user philosophy. Normally, */tmp* in the root directory -
note: I am not saying "in the root filesystem" but "in the root
directory" - would be the actual storage for temporary files such as
sockets and the likes, and the user's home directory would or could
then possibly contain a symlink to the /real/ */tmp.*
-bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Like I said, this is the wrong way to do it. Whoever set up the system
like that is probably an ex-Windows user, and thus accustomed to a
single-user set up.
Thanks everybody for sharing your views.
The applications running under FreeBSD consider /home/app as the root
file system and we have a similiar layout like / under /home/app .
Directories like /tmp , /log , /bin , /etc are also
available under /home/app where these applications read and write . We
are not running any well known Internet services so we are not facing
any issues on the functioning of OS. These
FreeBSD hosts are being used for running our native applications.
Quote:
But our existing Linux hosts are having the following layout for /
tmp .
df -lh /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-tmp 3.9G 46M 3.7G 2% /tmp
(Note: trailing slash removed in the quoted command for newsreader text
formatting reasons. Likewise for the following quoted command.)
Okay, so on this system */tmp* is on a logical volume. Not my preferred
choice, but good enough.
df -lh /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.7G 2.2G 7.0G 25% /
Okay, this is already better than how it was done on the FreeBSD
machine, but not quite a professional approach either. The idea is to
keep the root filesystem as static as possible, so you should
definitely split off the contents of */tmp* - and for that matter,
*/var* and */home* - from the root filesystem, especially for a server.
According to the File Hierarchy Standard (FHS) version 2.3, nothing
residing in */tmp* should be required to survive a reboot, and
therefore my favored and recommended approach is to have the contents
of */tmp* reside on a /tmpfs/ of limited size.
Some of the linux hosts are having separate partition for /tmp and
some are under / .
Uhuh, but see the last of the two above paragraphs. ;-)
Our applications are failing because of the different layout for /tmp
in Linux .
That is most likely due to a permissions problem. The */tmp* directory
in the root directory must have 1777 permissions, i.e. read, write and
execute/traverse permission for everyone, and with the sticky bit set.
The permissions mask for */tmp* should be "trwxrwxrwx".
By making the */tmp* in the root directory a symlink to a user-owned
directory, you are effectively disabling the required permissions on
*/tmp* for stuff that is not explicitly started by root or by the user
in whose home directory the mountpoint to the actual temporary
filesystem resides. Presumably, the person who set it up that way has
messed around with SUID bits and/or the permissions on the pertainining
user account's home directory.
One solution we have thought of moving the /tmp partition to /home and
then create a symbolic link from /home/tmp to /tmp . The original /tmp
which is a separate partition will be renamed to some /temp.
That is the totally wrong approach. You would be duplicating the
FreeBSD set-up - of which I cannot imagine that FreeBSD itself would
actually force such a policy upon the user, since it is totally
perverse to the UNIX philosophy - but you would then only be treating
the symptoms, not the cause.
grep tmp /etc/fstab
/dev/sys/tmp /tmp ext3 defaults 0 0
will be changed to something like this.
/dev/sys/temp /temp ext3 defaults 0 0
No, definitely not the right approach.
-bash-3.2$ ls -ld /tmp
lrwxrwxrwx 1 root root 8 Feb 24 2009 /tmp -> home/tmp
Absolutely the wrong way.
Our worry is whether will there be any effect in the normal
functioning of the OS .
Yes, because */home/tmp* - or */home/$LOGIN/tmp* for that matter - won't
be world-writeable or sticky.
We can use rsync with archive mode option to copy the contents from /
tmp to /home/ so all file systems permissions,ownerships etc will be
preserved
Quote:
Will there be any impact on the Linux applications which are already
running are using /tmp for some use.
I'm not sure /what/ the impact will be, considering that I have
insufficient information regarding what is being executed on the
machine and by whom - i.e. under which user accounts. But yes, most
likely messing around with things like that would screw up the
functioning of the system.
Should not have any effect as far as I understand as we are creating a
symbolic link from /home/tmp to /tmp.
Of course it will have effects, because */tmp* requires special
permissions - see higher up - and you cannot give it those under
*/home* without compromising system integrity and security.
As it is Prod host , we want to be sure before going ahead with the
migration without having any impact on the host and applications
already running . Please give your views.
If this is a production machine - i.e. a server - then the whole precept
of using a temporary filesystem (or mountpoint) under */home* is
definitely wrong to begin with.
Hope this helps...
--
*Aragorn*
(registered GNU/Linux user #223157)
Finally , I did the changes for moving /tmp to /home/ in Linux
without having any effect on the normal functioning of OS .
Applications which are failing are also running fine after the
changes. I rebooted
one host to check whether everything is fine or not. Everything looks
fine as of now. One bad thing I did during this change is that I
rebooted one Linux host as I was not able to unmount the
/tmp file-sytem using the umount command . But next time for other
hosts , I tried a lazy unmount which helped me to unmount /tmp without
reboot.
The setup now looks as follows.
== df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/sys-home 440G 1012M 416G 1% /home
--
ls -ld /tmp
lrwxrwxrwx 1 root root 10 Sep 15 03:55 /tmp -> /home/tmp/
ls -ld /home/tmp
drwxrwxrwt 7 root root 4096 Sep 16 03:10 /home/tmp
==
Thank You to All
Zaman |
|
|
| Back to top |
|
|
|
|
|
All times are GMT - 5 Hours
The time now is Mon Nov 23, 2009 9:12 am
|
|