LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can /tmp/SBo content safely be deleted (https://www.linuxquestions.org/questions/linux-newbie-8/can-tmp-sbo-content-safely-be-deleted-850082/)

Isix 12-14-2010 01:21 AM

can /tmp/SBo content safely be deleted
 
Hi all,

After installing numerous stuff on my Slackware system, I notice I am running out of hard-drive space. I see that /tmp/SBo has about 1G of staff that I recently installed --- may I safely delete this staff?

Cheers,
IDD

rfernandez 12-14-2010 01:44 AM

Sure you can. Maybe you'd like to save the .tgz packages for the future, but the /tmp/SBo folder you can remove - it's where the sources are unpacked and programs compiled and installed with DESTDIR. Take a look at some SlackBuild script and you'll see what are those.

AwesomeMachine 12-14-2010 01:44 AM

Yes you may! You can delete everything in /tmp if you really want to. Whatever the operating system actually requires the kernel will make again.

Isix 12-14-2010 01:55 AM

Thanks for the guide --- now I have got that 1G space back.

catkin 12-14-2010 02:17 AM

Opinions vary about the best way to clean /tmp and none of them are guaranteed to cause no breakage. I remove everything in /tmp as soon as the file system containing it is mounted; this by modifying the boot script which mounts it; works for me; YMMV.

Isix 12-14-2010 02:48 AM

Hi catkin,

you say, "by modifying the boot script which mounts" /tmp. Which is the boot script you are referring to (is it /boot/config ?), and how did you modify it?

Tinkster 12-14-2010 03:37 AM

Quote:

Originally Posted by AwesomeMachine (Post 4190678)
Yes you may! You can delete everything in /tmp if you really want to. Whatever the operating system actually requires the kernel will make again.

Ummm ... no, you can't, you shouldn't. Many apps, including X11,
have temporary files in /tmp for users CURRENT sessions. Deleting
those can make "bad things" happen. It's safe to delete OLD stuff
from /tmp, things that aren't currently being accessed.



Cheers,
Tink

catkin 12-14-2010 03:37 AM

On Slackware it's /etc/rc.d/rc.S. When /tmp is on the / file system, the relevant part is just after comment "# Remount the root file system in read-write mode" which is mostly an if-fi to deal with it failing. I use this line after the closing fi: ( cd /tmp && rm -rf -- * .* 2>/dev/null )

sycamorex 12-14-2010 03:42 AM

I delete everything in /tmp when the system shuts down by adding the following to /etc/rc.d/rc.local_shutdown:
Code:

/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -rf

catkin 12-14-2010 03:42 AM

Quote:

Originally Posted by Tinkster (Post 4190761)
It's safe to delete OLD stuff
from /tmp, things that aren't currently being accessed.

+1 to all of Tinkster's post. Regards the quote above, the potential gotcha is that even old files and directories may be in use. This is a topic that has been much debated and, as I posted earlier, there are no guaranteed safe solutions. Prior discussions on LQ listed here.

catkin 12-14-2010 03:52 AM

Quote:

Originally Posted by sycamorex (Post 4190765)
I delete everything in /tmp when the system shuts down by adding the following to /etc/rc.d/rc.local_shutdown:
Code:

/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -rf

I decided against that solution in favour of doing it during boot because rc.[06] runs rc.local_shutdown early so before shutting down many other things which _might_ depend on files+directories in /tmp including MySQL, Apache, Samba, NFS server, ssh (which does use /tmp), SASL, LDAP, D-bus, networked file systems, networking, process accounting, ACPI, quotas (which does use /tmp?) ...

sycamorex 12-14-2010 03:56 AM

Quote:

Originally Posted by catkin (Post 4190773)
I decided against that solution in favour of doing it during boot because rc.[06] runs rc.local_shutdown early so before shutting down many other things which _might_ depend on files+directories in /tmp including MySQL, Apache, Samba, NFS server, ssh (which does use /tmp), SASL, LDAP, D-bus, networked file systems, networking, process accounting, ACPI, quotas (which does use /tmp?) ...

Thanks. Never thought of that.

Isix 12-14-2010 04:42 AM

After adding
Code:

cd /tmp && rm -rf -- * .* 2>/dev/null
in /etc/rc.d/rc.S after the line
Code:

# Remount the root file system in read-write mode
and then rebooting, I now have 4G of space. Wow, I needed space like cracy --- thanks!

pwc101 12-14-2010 04:57 AM

Quote:

Originally Posted by catkin (Post 4190762)
( cd /tmp && rm -rf -- * .* 2>/dev/null )[/B]

I shy away from the .* wildcard because I've always though it'd expand to '..'. I tend to use .??* which forces the wildcard to expand to at least three characters (thereby omitting '..'). It still catches most dot-files: only those whose file name is fewer than three characters long don't get deleted. I have yet to come across such a file.

catkin 12-14-2010 05:32 AM

Quote:

Originally Posted by Isix (Post 4190802)
After adding
Code:

cd /tmp && rm -rf -- * .* 2>/dev/null
in /etc/rc.d/rc.S after the line
Code:

# Remount the root file system in read-write mode
and then rebooting, I now have 4G of space. Wow, I needed space like cracy --- thanks!

Safer to use
Code:

( cd /tmp && rm -rf -- * .* 2>/dev/null )
in case rc.S needs to have a specific current working directory (AFAIK it doesn't but best to play safe).

And it should go after the fi after
Code:

# Remount the root file system in read-write mode
not directly after it (because the / file system has been mounted read-write then -- surprising that it worked for you!).


All times are GMT -5. The time now is 01:14 AM.