Author Topic: [SOLVED] move /tmp to another partition  (Read 2087 times)

Offline mikkl

  • Hero Member
  • *****
  • Posts: 869
[SOLVED] move /tmp to another partition
« on: February 26, 2011, 06:11:25 PM »
My eeepc is running out of space on the root drive.  The /tmp directory has 385MB of information taking up space I need.

I would like to replace /tmp with a symlink to /home/tmp, which is on another partition, so that I don't have this problem in the future.

Any recommendations on how to accomplish this?  It looks like the system is protecting /tmp and will not let me change it.

Do I need to boot a live image and make the change that way?

From a console mode boot, as root, I tried "ln -s /home/tmp tmp"  but that did not seem to work.

TIA,

mikkl
« Last Edit: March 12, 2011, 06:43:33 AM by mikkl »

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6470
  • I'm going South
Re: move /tmp to another partition
« Reply #1 on: February 26, 2011, 06:32:28 PM »
My eeepc is running out of space on the root drive.  The /tmp directory has 385MB of information taking up space I need.

I would like to replace /tmp with a symlink to /home/tmp, which is on another partition, so that I don't have this problem in the future.

Any recommendations on how to accomplish this?  It looks like the system is protecting /tmp and will not let me change it.

Do I need to boot a live image and make the change that way?

From a console mode boot, as root, I tried "ln -s /home/tmp tmp"  but that did not seem to work.

TIA,

mikkl

Do you really have a /home/tmp?

Normally all of your users would have a tmp folder in their home directories: i.e. a /home/<username>/tmp (or ~/tmp) but I've never seen a /home/tmp.

And this ~/tmp is often a symlink to your global /tmp. If it is, you naturally can't also make the global /tmp a symlink to ~/tmp. (That would mean taking recursion a bit too far.)

But if it isn't, then "ln -s ~/tmp /tmp" should work -- after you've removed your old /tmp.

But note that you have to change the permissions of ~/tmp afterwards. (The permissions of /tmp or whatever /tmp is pointing to should be 1777, or drwxrwxrwt -- and the folder should be owned by root.)

Edited for clarity.
« Last Edit: February 26, 2011, 07:18:58 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline AS

  • Hero Member
  • *****
  • Posts: 4098
  • Have a nice ... night!
Re: move /tmp to another partition
« Reply #2 on: February 26, 2011, 06:37:04 PM »
My eeepc is running out of space on the root drive.  The /tmp directory has 385MB of information taking up space I need.


Hi mikki,

as first thing you should note that you can safely remove every file in /tmp: close all running applications, then remove every file in /tmp.
as second thing you should run bleachbit (Kmenu -> File Tools -> BleachBit) that can clean up a lot of things, include browser cache, googleearth cache, ... and of course tmp files.

about replacing /tmp with a symlink, you need to remove the directory before to create the link, and right now I'm not sure if's possible to remove /tmp even in single.user mode
... I' will leave this answer to other friends  :)

AS

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6266
Re: move /tmp to another partition
« Reply #3 on: February 26, 2011, 06:41:00 PM »
Can you check the folder and see what takes so much space? Do you or any program that created those files need them?

/tmp folder contains temporary files some programs need at runtime and most of them if not all get recreated next time their respective programs starts and cant find them. As far as i know, you can delete all contents of the folder and no harm will be done, check the folder first and move out all files you need.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6470
  • I'm going South
Re: move /tmp to another partition
« Reply #4 on: February 26, 2011, 06:58:24 PM »
muungwana's reply is of course the sensible one. You won't need a 385MB /tmp except very rarely, and if your /tmp isnt in RAM, and if you don't run a script that clears it regularly, you should empty it yourself now and then.
« Last Edit: February 26, 2011, 06:59:56 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Village Idiot

  • Hero Member
  • *****
  • Posts: 2345
  • Have A Nice Day.
Re: move /tmp to another partition
« Reply #5 on: February 26, 2011, 07:59:36 PM »
just in case the is nothing in tmp that is needed for some reason, I'd boot up a live-cd and move the contents of the /tmp directory to some location on the home partition. (moving files to the home directory whilst running the live-cd will is not what you want to do because that information will be lost since the live-cd system runs in memory and files not put on an actual physical medium is lost on shutdown.)

Restart the system normally and check none of your programs are affected. If nothings wrong, then you can delete the files that you moved.


 :)
$ fortune
No Microsoft products were used in any way for the creation of this message.
If you are using a Microsoft product to view it, BEWARE! - I'm not
responsible for any harm you might encounter as a result.

Offline Dragynn

  • Hero Member
  • *****
  • Posts: 1436
  • Abide.
Re: move /tmp to another partition
« Reply #6 on: February 27, 2011, 03:07:03 PM »
You can also simply instruct the system to clean /tmp at each boot. Open PCC and select  boot>setup boot system>advanced, when the pop-up screen with advanced options appears, put a check mark on the selection " clean /tmp at each boot". Finish and close. PCLOS also offers this option during bootloader setup when you are first installing it.
This aggression will not stand man.

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6470
  • I'm going South
Re: move /tmp to another partition
« Reply #7 on: February 27, 2011, 03:25:09 PM »
You can also simply instruct the system to clean /tmp at each boot. Open PCC and select  boot>setup boot system>advanced, when the pop-up screen with advanced options appears, put a check mark on the selection " clean /tmp at each boot". Finish and close. PCLOS also offers this option during bootloader setup when you are first installing it.

As has been pointed out tens of times ticking "clean /tmp at each boot" won't really do that. It will actually move /tmp into RAM by adding the line "none /tmp tmpfs defaults 0 0" to /etc/fstab.

Usually this makes sense because then /tmp will indeed be empty the next time you boot, and reading and writing to and from /tmp will also be a lot faster. But if you don't have enough RAM it's not a good idea.

Normally there won't be anything in /tmp that has to survive a reboot. (At least not unless you yourself have stored something important there, which you shouldn't.)
« Last Edit: February 27, 2011, 03:38:04 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline Dragynn

  • Hero Member
  • *****
  • Posts: 1436
  • Abide.
Re: move /tmp to another partition
« Reply #8 on: February 27, 2011, 03:43:23 PM »
You can also simply instruct the system to clean /tmp at each boot. Open PCC and select  boot>setup boot system>advanced, when the pop-up screen with advanced options appears, put a check mark on the selection " clean /tmp at each boot". Finish and close. PCLOS also offers this option during bootloader setup when you are first installing it.

As has been pointed out tens of times ticking "clean /tmp at each boot" won't really do that. It will actually move /tmp into RAM by adding the line "none /tmp tmpfs defaults 0 0" to /etc/fstab.

Usually this makes sense because then /tmp will indeed be empty the next time you boot, and reading and writing to and from /tmp will also be a lot faster. But if you don't have enough RAM it's not a good idea.


My /tmp file size is currently 8.3 kb after being on all day. At my modest amount of 1.5 gigs of ol' DDR400, it would take 495 years to use up all my RAM at that rate. Since i'll probably re-boot sometime prior to the year 2506, I think i'll be allright. ;)
This aggression will not stand man.

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6470
  • I'm going South
Re: move /tmp to another partition
« Reply #9 on: February 27, 2011, 04:00:21 PM »
My /tmp file size is currently 8.3 kb after being on all day. At my modest amount of 1.5 gigs of ol' DDR400, it would take 495 years to use up all my RAM at that rate. Since i'll probably re-boot sometime prior to the year 2506, I think i'll be allright. ;)

With 1.5 gigs I wouldn't hesitate keeping /tmp in RAM. But lately I've read a few posts from users trying to run PCLinuxOS with less than half a gig, and mikkl never told us how much memory he has.

(It's now eight hours since I rebooted and at the moment I have 30MB in my /tmp. A lot more than you but still not very much. Nevertheless some apps need a lot more space in /tmp.)
« Last Edit: February 28, 2011, 03:49:29 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline mikkl

  • Hero Member
  • *****
  • Posts: 869
Re: move /tmp to another partition
« Reply #10 on: March 12, 2011, 06:43:08 AM »
Thanks all.  I finally got a chance to sit down and work on this and I got it.  It took some time, but I got /tmp replaced with a link to /home/tmp and my space problems are better now.

The steps I used:

-Update desktop
-Start makeusb script
-Learn that I need to partition my USB stick to create at ext2 partition
-Partition and format USB stick
-Learn that I needed an .iso for install
-Download minime_kde
-Install minime to USB stick
-Boot eeepc to USB stick
-as root, delete /tmp
-as root, create /home/tmp
-as root, create "basic link" to /home/tmp titled "tmp" on /
-reboot eeepc and confirm that all works correctly and that /home/tmp contains the normal kde startup files (which indicates that the link worked correctly)

Thanks again,

mikkl

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6470
  • I'm going South
Re: move /tmp to another partition
« Reply #11 on: March 12, 2011, 07:35:23 AM »
Thanks all.  I finally got a chance to sit down and work on this and I got it.  It took some time, but I got /tmp replaced with a link to /home/tmp and my space problems are better now.

The steps I used:

-Update desktop
-Start makeusb script
-Learn that I need to partition my USB stick to create at ext2 partition
-Partition and format USB stick
-Learn that I needed an .iso for install
-Download minime_kde
-Install minime to USB stick
-Boot eeepc to USB stick
-as root, delete /tmp
-as root, create /home/tmp
-as root, create "basic link" to /home/tmp titled "tmp" on /
-reboot eeepc and confirm that all works correctly and that /home/tmp contains the normal kde startup files (which indicates that the link worked correctly)

Thanks again,

mikkl

This is actually quite clever. I thought you wanted to make /tmp a symlink to your user's tmp (/home/<username>/tmp) but you actually created your global tmp directory directly under /home and not in your user's home directory. Good thinking!
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Offline mikkl

  • Hero Member
  • *****
  • Posts: 869
Re: [SOLVED] move /tmp to another partition
« Reply #12 on: March 12, 2011, 08:32:20 AM »
Thanks.  Because of the limited size of the root drive on this version of the eeepc (a 4GB SSD), I had to do a similar thing with /opt for the installation of Open Office.  In that case, however, I did not have to use a LiveCD as /opt was not a system directory whereas /tmp is a system directory and can not me moved when the system is running.

mikkl