LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 05-29-2011, 07:43 PM   #1
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 91

Rep: Reputation: 38
Question Reducing writes to SSD: mounting /var (and others) on RAM disks (tmpfs).


I'm getting ready to do an installation of 13.37 which will be my first on a SSD. I would like to minimize the writes to it to (hopefully) increase its lifespan. What directories and/or sub-directories should I mount on RAM drives? I am not worried about RAM usage since I installed 16 GB in this new computer. Is there anything else I should be doing (differently)? Can anyone see any problems with this plan (particularly with the directories not restored)?

Here are my current thoughts:

Mount the SSD using the 'noatime' option in fstab. I am currently debating whether to use ext2 (to eliminate journalling writes) or ext4 although I am leaning towards ext4 since (I believe) that the journal will barely be used anyway if there are few writes to the drive.

Mount /tmp on a tmpfs: this one should be easy as I don't think I need to do anything more than creating a tmpfs in fstab for it.

Mount /var on a tmpfs: this one could be a little trickier. I believe I need to restore the directory structure and a good portion of the files in order for this to work.
The sub-directories I can just throw away (any I have to create the structure for at startup?):
cache db empty games lock man mail named run rwho spool state tmp
The ones to restore at startup but throw away at shutdown:
www X11 X11R6 yp
The ones to restore at startup and save at shutdown:
adm lib log

At which point in the startup/shutdown should I restore/save? I am planning on using rsync.
I'm thinking the save is probably fine in rc.local_shutdown (or is that too early?), but rc.local is probably too late for restore. The restore will probably be in rc.M and come just after:
# Save the contents of 'dmesg':
/bin/dmesg -s 65536 > /var/log/dmesg
(of course I'll skip the restore of dmesg in /var/log).
This is just before starting the system logger.

What about /proc? Is that just created in RAM or is any part of it written to disk while the system is running?
 
Old 05-29-2011, 08:14 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,868
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
I would definitely go for ext4, as far as I know ext2 doesn't have support for the TRIM function. To enble that you have to add the mount option discard for partitions on the SSD.
For a machine with that amount of RAM I doubt you will need a swap partition.

The only partitions I mounted to tmpfs on my laptop were /tmp and the ~/.cache directory. I don't find it practical to fiddle with the folders in /var.
 
1 members found this post helpful.
Old 05-29-2011, 08:54 PM   #3
marafa
LQ Newbie
 
Registered: Sep 2008
Posts: 26

Rep: Reputation: 1
nice project

i was thinking of getting my myself an ssd. which disk did you purchase and why?

anyways, my 2 cents worth on your issue: get a second disk, a sata3 for static data like /home or /var/www (if you do web development).

you should note that some directories are needed and cannot be thrown away. eg. on fedora /var/cache/yum is where the mirror speed file and sqlite db is kept. and then you have /var/lib and things like /var/lib/yum which has the yumdb of historical transaction (up to you to throw it away or not) or /var/lib/mysql where the actual databases are kept or /var/lib/libvirt where the qemu images are kept.

which brings me back to what i was thinking: my objective was to make boot up and shut down faster so /boot and /usr /sbin /bin and /lib would go on to the ssd but everything else which is used every so once in a while like /home and /etc/ and /var go on to the sata disk

but then again. this is all dependent on what your objective is
 
1 members found this post helpful.
Old 05-29-2011, 09:12 PM   #4
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,215

Rep: Reputation: 176Reputation: 176
check out this article http://cptl.org/wp/index.php/2010/03...ives-in-linux/

Theres a lot of useful info on SSD's and Linux.


P.S. The site seems to be down, hopefully it will be back up soon.

Last edited by Daedra; 05-29-2011 at 09:22 PM.
 
Old 05-29-2011, 09:30 PM   #5
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 14,868
Blog Entries: 2

Rep: Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805Reputation: 3805
Quote:
Originally Posted by marafa View Post
and /etc/ and /var go on to the sata disk
With /etc on a different partition you will run into serious problems. /etc can't be mounted on boot, since fstab, which contains the mount information, is on /etc.
 
Old 05-29-2011, 09:51 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The data in /var needs to be retained between reboots. You might want to look at aufs (advanced union file system) and have a tmpfs layer on top. This is similar to the configuration on the original eeepc which used cheap SSD drives.

For laptops, IMHO, not using swap and mounting partitions with the noatime option would be enough. Especially when you consider how a regular hard drive can get damaged over time from shock & motion.
 
1 members found this post helpful.
Old 06-26-2011, 08:57 PM   #7
sysfce2
Member
 
Registered: Jul 2009
Distribution: Slackware
Posts: 91

Original Poster
Rep: Reputation: 38
Thanks for all the input guys: I've got the installation up and running and it appears to work great! The boot time is super fast, such that I now usually shut down the computer now at night (whereas before I didn't bother because it would take too long to get going again). The main change I ended up doing was adding the following to my fstab (along with the noatime and discard options):
Code:
	tmpfs	/tmp		tmpfs	size=8G,mode=0777	0	0
	tmpfs	/var/tmp	tmpfs	size=4G,mode=0777	0	0
The rest of the directories in /var I left alone as it looks like in Slackware very little is written there anyway (at least with the desktop services I have going) and I figured I would end up with too many headaches if I started messing with them.
Quote:
Originally Posted by TobiSGD View Post
I would definitely go for ext4, as far as I know ext2 doesn't have support for the TRIM function. To enble that you have to add the mount option discard for partitions on the SSD.
For a machine with that amount of RAM I doubt you will need a swap partition.
I did use EXT4 for the / partition with TRIM but EXT2 for the boot partition so that I could use GRUB for the boot loader (I usually just mount it manually when I update the kernel).
One thing I had trouble figuring out is how I was supposed to align the SSD partition, but I figured if I made /boot 256 MB with / taking the rest of sda I should be all right. Was that an erroneous assumption?

I did also make a large swap partition on the WD drive but that was mostly because it is so large anyway and I figured it could come in handy if I ever wanted to try to get hibernation working.

Quote:
Originally Posted by marafa View Post
nice project

i was thinking of getting my myself an ssd. which disk did you purchase and why?

anyways, my 2 cents worth on your issue: get a second disk, a sata3 for static data like /home or /var/www (if you do web development).
I bought an Intel X25-V SSD because it was on sale and I had heard that (at least the early) Intel SSDs had a good reputation.

I have /home mounted on one of the WD Green 2 TB drives. This is a desktop system so I bought the SSD purely for performance rather than shock & motion issues.

I wasn't really considering mounting /etc on another drive: my configuration does remain relatively static once set up and I figured that it is one of the directories that would benefit from SSD performance.

I did take a look at aufs too, but I figured it was probably overkill for my (immediate) situation. I'll definitely play with it though as I can see a few potential applications.
 
1 members found this post helpful.
Old 08-26-2011, 02:00 AM   #8
storkus
Member
 
Registered: Jun 2008
Posts: 296

Rep: Reputation: 45
Thanks, sysfce2, for making this posting, and for everyone who replied. I just bought a Corsair Force 115 GB SSD from Fry's Electronics on sale yesterday (today is the last day) that I want to put in my 3yo or so laptop. This SSD apparently has some conflicts between certain BIOSes and its firmware--it sounds ACPI-related, but with all the complaints from winblows lusers, it can be hard to tell. I guess I'll know soon enough, but with a 15 day return window--14 days now--I need to hurry to find out!

ANYWAY, my laptop has far lower specs than the one above: 2GB PC-5300 that came with it, which has been more than enough for Slackware, but not for the icky vista that came with it; and the single HDD bay with a Toshiba SATA-1 5400 RPM 160GB slower-than-molasses drive in it (and the reason I want to upgrade).

WRT tmpfs, /tmp is obvious, but I'm thinking most of the files in /var/log should go there as well, once the machine is running stable. Also, while the article says you just need to turn off caching in Firefox, that obviously won't help with Flash and other plugins, and since a lot of guys are redirecting ".macromedia" to /tmp or even /dev/null anyway (and, frankly, so am I), it seems linking a lot of those "." directories to /tmp may be the way to go.

WRT swap, you need it for hibernation functionality; also some things, like Firefox's (and especially Flash's) memory leaks and running the GIMP for any reason will usually send some stuff in there, but not really thrash much. It seems to me having some swap shouldn't hurt the device overall.

As for TRIM, this I do know: TRIM is currently only supported in EXT4 and BTRFS, courtesy of the "discard" command. Since BTRFS is not ready for production yet, that leaves EXT4.

I was about to write that I'm not sure "noatime" was needed, but then I read this from Ted T'so:

http://es.linuxfoundation.org/news-m...oatimerelatime

So I guess I'll be using "noatime", after all. That entry also debunks using EXT2/3.

I kind of lost my way in all the links of how I got there, but here's some comments from some VERY respected people on the subject:

First, Ted T'so's has blogged at least 3 times on SSD's. His blog's main page is at http://www.linuxfoundation.org/blog/9

Second, Linus himself has weighed in on the subject; this link was from one of Ted's blogs:

http://www.realworldtech.com/forums/...92678&roomid=2

I find this bit the most interesting:

Quote:
Again, if your SSD vendor says "align to 64kB boundaries"
or anything like that, you really should tell them to go
away, and you should do what Val said - just get a real
disk instead. Let them peddle their crap to people who are
stupider than you, but don't buy their SSD.

So what you want to happen if you split an SSD into multiple
partitions is exactly nothing. It shouldn't matter
one whit. If it does, the SSD is not worth buying. If it is
so sensitive to access patterns that you can't reasonably
write your data where you want to, just say "No, thank you".
Wow. That's Linus for you. And if that's true, then--outside of TRIM/discard, we really shouldn't care how we set up our drives.

Anyway, I'm getting off work, so I'm "tying off" this message. I look forward to any comments when I look at this tomorrow.

Mike
 
  


Reply

Tags
boot, installation, slackware, ssd, tmpfs


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
not able to boot from ssd with multiple hard disks system kapsule Linux - Newbie 6 05-03-2011 05:57 AM
LXer: Speed up Firefox by mounting the profile in tmpfs (RAM) [Linux only] LXer Syndicated Linux News 0 05-04-2009 09:11 AM
Creating tmpfs larger than physical ram arizonagroovejet Linux - General 6 10-05-2008 04:45 PM
reducing RAM usage Furlinastis Slackware 21 04-02-2005 12:53 PM
Mounting /var/log as a tmpfs mr666white Linux - Laptop and Netbook 2 12-06-2004 08:07 PM


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

Main Menu
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