LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 10-04-2012, 01:34 AM   #1
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Rep: Reputation: 187Reputation: 187
Move /tmp to another drive


My current setup...

sda = 120gb SSD with windows 7
sdb = 60gb SSD with Slackware64-14
sdc = 250 sata drive I use for current/testing

To reduce the number of writes on my SSD I was thinking about moving my /tmp directory to the -current /tmp directory on sdc. What would be the best method for doing this, I figure it just to edit /etc/fstab but I'm not 100% sure.

Thanks.
 
Old 10-04-2012, 02:03 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,974

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Hi,

you could create a /tmp directory on the other drive (if there isn't one).

Then mount this drive for example to /mnt/tmp/

Afterwards move (mv) the files from your /tmp/ directory to /mnt/tmp/

Then unmount /mnt/tmp/

Edit /etc/fstab and make an entry for the /dev/sdc partition
Code:
/dev/sdc?  /tmp  ........
Now execute "mount /tmp".

Markus

Last edited by markush; 10-04-2012 at 02:26 AM.
 
Old 10-04-2012, 02:19 AM   #3
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Original Poster
Rep: Reputation: 187Reputation: 187
Ok I think I am with you, right now I have sbc1 mounted at /slackware in my /etc/fstab, sdc2 is a swap partiton.

/dev/sdc1 /slackware ext4 defaults 1 1

and I have a tmp directory located there at /slackware/tmp so what would the correct entry in /etc/fstab be to make /slackware/tmp my working /tmp directory?
 
Old 10-04-2012, 02:38 AM   #4
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,974

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
mh, I think you should simply create a simlink, when you want to use /slackware as before.

Code:
ln -s /slackware/tmp /tmp
You can only mount a partition but not a directory on a partition. This means you could use the whole /dev/sdc1 for /tmp or the whole /dev/sdc1 for /slackware.

You should probably consider to create another partition, for example /dev/sdc2 or even a bunch of logical partitions on /dev/sdc (which gives you more flexibility).

Markus
 
Old 10-04-2012, 02:39 AM   #5
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Original Poster
Rep: Reputation: 187Reputation: 187
If I have sdc1 already mounted at at /slackware (or where ever) could I delete the /tmp directory and create a symbolic link to the /slackware/tmp directory like so..

chmod 1777 /slackware/tmp
rm -r /tmp
ln -s /slackware/tmp /tmp

I posted this right before I saw your post lol. Yeah The symlink thing did occur to me, but I think I agree with you, there is nothing important on the drive now, its just current and since 14 is stable I think I am just going to partition it for more flexibility like you said.

Thanks for your help.

Last edited by Daedra; 10-04-2012 at 02:41 AM.
 
Old 10-04-2012, 02:41 AM   #6
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,974

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Quote:
Originally Posted by Daedra View Post
...
chmod 1777 /slackware/tmp
rm -r /tmp
ln -s /slackware/tmp /tmp

I posted this right before I saw your post lol.
Yes, this will work.

Markus
 
Old 10-04-2012, 03:04 AM   #7
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 256

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by markush View Post
You can only mount a partition but not a directory on a partition. This means you could use the whole /dev/sdc1 for /tmp or the whole /dev/sdc1 for /slackware.
You CAN mount a directory, after first converting it into a mount point using the --bind option to mount the directory onto itself...
Code:
mount --bind /slackware/tmp /slackware/tmp
...and then using the --move option to move that mount point to your target:
Code:
mount --move /slackware/tmp /tmp
In fact, if you specify a directory as your mount "device" in fstab (with the bind option), Linux apparently is able to figure things out.
Code:
/slackware/tmp /tmp none rw,bind 0 0
 
1 members found this post helpful.
Old 10-04-2012, 03:11 AM   #8
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,014

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by Daedra View Post
...
chmod 1777 /slackware/tmp
rm -r /tmp
ln -s /slackware/tmp /tmp
...
mount --bind /slackware/tmp /tmp

However, I'd prefer to put not only /tmp but also swap on SSD as SSDs are small and fast. They are perfect for that purpose.
 
Old 10-04-2012, 03:16 AM   #9
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 256

Rep: Reputation: 121Reputation: 121
quanx is correct. The --bind option now works on directories. Apparently the kernel devs have addressed this in recent kernels because it was not too far back that the bind/move trick was necessary.
 
1 members found this post helpful.
Old 10-04-2012, 03:33 AM   #10
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Original Poster
Rep: Reputation: 187Reputation: 187
Quote:
Originally Posted by guanx View Post
mount --bind /slackware/tmp /tmp

However, I'd prefer to put not only /tmp but also swap on SSD as SSDs are small and fast. They are perfect for that purpose.
Thanks for the info, but I fail to see why you would want swap and /tmp on your SSD if you don't have to? Yes you want your main program directories on there for the speed, but what is going to get written to the /tmp directory that would benefit from the speed increase.
 
Old 10-04-2012, 04:03 AM   #11
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,014

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by Daedra View Post
Thanks for the info, but I fail to see why you would want swap and /tmp on your SSD if you don't have to? Yes you want your main program directories on there for the speed, but what is going to get written to the /tmp directory that would benefit from the speed increase.
Temporary data, of course. For example one of my programs caches a lot of arrays in /tmp.

Same reason to put swap on SSD.
 
Old 10-04-2012, 04:16 AM   #12
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Original Poster
Rep: Reputation: 187Reputation: 187
Yeah I understand I am just saying on my system I don't have any programs writing massive amounts of data the the /tmp directory and my swap hardly ever gets touched so putting /tmp on the SSD would only add unnecessary writes to the drive which as you know can over time degrade the performance. Granted with newer gen SSD's this isn't much of a concern since it can take millions of writes before you take a performance hit. On your system maybe you see a benefit but on mine it wouldn't make any speed improvement. I don't think firefox cache and slackbuilds are really going to benefit from an ssd over a mechanical drive .
 
Old 10-04-2012, 05:46 AM   #13
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,014

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by Daedra View Post
... I don't have any programs writing massive amounts of data the the /tmp directory ...
... so putting /tmp on the SSD would only add unnecessary writes to the drive which as you know can over time degrade the performance ...
Although it's a bit beyond my understanding why if no program writes then there should come many unnecessary writes, I'd wish you good luck and have a nice day!
 
Old 10-04-2012, 07:10 AM   #14
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,974

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Hi,

I did not think of the "bind" option. Maybe this would be a proper solution.

As of the partitioning, as far as I know there is still the problem that SSDs have a very fast reading access but too much write access is harmful for such devices.

Therefore it is a good Idea, to have directories with much write access on a traditional harddrive (SATA in this case) and the directories which have much more read- than write-access on an SSD.

If I had such an SSD-device, I would leave /boot, /etc and /usr (with all the libraries and executables) on the SSD, but /home, /tmp and /usr/local on the SATA-drive.

As I suggested above I would create an extended partition on the SATA-drive and create logical partitions for /home, /tmp and /usr/local.

BTW: I don't think that a computer with enough RAM would benefit from swapspace on an SSD since the swapspace is (normally) not used. And if the swapspace is often used (due to too less RAM) I would think that it isn't good for the SSD to have as much write-access.

Markus
 
Old 10-04-2012, 09:05 AM   #15
GazL
Senior Member
 
Registered: May 2008
Posts: 3,503

Rep: Reputation: 1025Reputation: 1025Reputation: 1025Reputation: 1025Reputation: 1025Reputation: 1025Reputation: 1025Reputation: 1025
Have you considered using tmpfs for /tmp instead? Anything that is too large to use /tmp can always use /var/tmp instead.

In your situation I'd be inclined to put /tmp on a tmpfs and /var/tmp on sdc
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Move browser tmp to RAM with Opera Blasphemous Linux - Newbie 2 12-08-2011 01:16 PM
Disk Drive For .TMP Goes Missing Sometimes.......??? Sumguy Linux - Newbie 9 07-30-2010 04:30 AM
How do I move files from a ntfs drive to a ext3 drive? adrian30020 Linux - Newbie 6 11-15-2007 03:27 PM
Hard drive for swap/tmp/var? superluser Linux - Hardware 11 08-12-2006 06:21 PM
move /tmp puzz_1 Linux - Newbie 3 06-30-2003 03:22 PM


All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration