Linux and SSD discs.

As I am about to upgrade my machine I am thinking about using an SSD disc for boot and the OS including KDE. I generally associate a raid set up for my home directory and some small old or new disc for swap.

As my home directory and swap is on a normal disc I needn’t worry about write cycles wearing the ssd out. Swap wouldn’t be normally used anyway. I do know something about the technology used in ssd discs from working on software and hardware in the automotive field. Basically read them for no one is sure how many cycles without any problems. Write cycles are another matter.

I’ve noticed that system temp is used a fair amount and probably other system directories as well and wonder if there is some way of installing so that these always go to a normal disc or some guide some where aimed at achieve this. I suspect is it possible in a sense using ram caches for temps as usb stick boot ups need to work that way. Another option but too real discs would be preferable.

As a for instance why my //tmp system directory has myriads of pdf’s in it that I downloaded directly to the viewer rather than saving them. I usually work that way and save them if they are of any use. There are also 253 folders in it. This directory also appears to hold files intended to show that an instance of a program is already running.

Ok maybe an ssd may last several years anyway but I’m mean and would rather it lasted until I wanted rather than needed to replace it.

John

I saw your statements about your /tmp directory and what it contains. Maybe it is better to manage that a bit. YaST > System > /etc/sysconfig editor and there: System > Cron >

For systems that are booted every (few) day(s), setting CLEAR_TEMP_DIRS_AT_BOOTUP is very useful. There are a few more parameters there which you might be interested in.

Greetings!

I have not yet purchased an SSD for any of my systems. Beyond it being for rich people and also my uncertainty as to how long it will actually last, I have not taken the plunge. I did some checking and the following devices utilize the tempfs by default in openSUSE 12.3

/dev/shm
/run
/sys/fs/cgroup
/var/lock
var/run (which is really just /run)

tempfs is generally stored in volatile memory (RAM) not on a persistent storage medium.
So, I don’t think you have to do anything there.

If you really want to push the /tmp to your RAID setup, you could create a directory on your /home partition called tmp/ with owner root, group root where owner, group and others can view and modify content and link it in place of /tmp

I’m not sure how it will work out but it’s worth playing around with.

Cheers!

I would probably put the “tmp” directories on the swap disc. My machine doesn’t get rebooted very often and no concern about the space used.

There is some info on the general subject on the Arch wiki’s but not completely specific to what I hope to do. One interesting aspect is write life with newer finer technologies. Hope intel aren’t going the same way with processors. They are having problems getting people to upgrade.

I suspect the needed changes are all kernel related.

John

I don’t think you can use your Swap to hold tmp files. It acts as virtual RAM memory. If it were possible, I don’t even know how one would go about setting that up unless you created a RAM disk for /tmp

Something else you can do is to just manually clear out /tmp. It really doesn’t fill up that much and I do believe that it can be set to be self maintaining as well. You could also create a script to purge things older than a certain date.

Just a thought.

Cheers!

My “/etc/fstab” contains:


none   /tmp    tmpfs   defaults        0 0

This is working well for using ram and/or swap for “/tmp”.

To set that up, I just edited the line into “fstab”, then rebooted (hoping for the best). It works fine.

At a later time, I did:


# mount --bind / /mnt
# cd /mnt/tmp
# rm -rf * .??*
# cd /
# umount /mnt

That deletes what was left behind in “/tmp” and is now hidden under the mount point.

> I don’t think you can use your Swap to hold tmp files. It acts as
> virtual RAM memory. If it were possible, I don’t even know how one
> would go about setting that up unless you created a RAM disk for /tmp

True, but if you have a second disk (other than the SSD) for things like
swap and /home you could also use it for /tmp… just another partition.
I think this is what he means.

> Something else you can do is to just manually clear out /tmp. It
> really doesn’t fill up that much and I do believe that it can be set to
> be self maintaining as well. You could also create a script to purge
> things older than a certain date.

I thought most of the many-write-SSD-failure issues were basically handled
these days by magic within the SSDs and OS kernels. I’ve been using an
SSD on a very busy laptop for a year now (I write more files than most
people) and have filled the space a couple of times over (and cleaned out
again) and so far all has been just great. SSDs are great for performance
and the only downside is, like high-speed Internet, once you go there
you’ll never want to go back. You can get a 120 GB SSD for something like
$9 on Newegg… prices are definitely falling.

Good luck.

If people are interested in SSD’s it should be worth reading this but it doesn’t cover what I want to try to do

https://wiki.archlinux.org/index.php/Solid_State_Drives

Yes I did mean a partition for “tmp” on a swap disc. I have been using an enterprise 32gb sata 1 disc for the swap partition only for years. Be hard to find something small enough now probably but it’s getting very old.

I will have to have a nose around fstab but I understand that is at least part depreciated on 11.4 and I will be moving to 12.3 hoping our wonderful packagers etc have done an excellent job on that as they did on 11.4. Other disto’s seem to have lots of problems with KDE at times.

Things have changed a lot since I built this machine. Looks like I would be happy with mirrored raid for my home and there are some decent boards around for sata-600 at relatively low cost. The low cost raid 5 capable boards are rather slow. SSD sounds attractive for the OS. :wink: If it lasts 10 years. I’m a bit mean.

John

I just installed 12.3. rotfl! Fairly painless but that would be off topic. Couple of thing tempt me to moan.

One of the custom partitioning options is /tmp placement so I assigned a partition to that. The partitioning is

ssd
----boot
----/

Sata1
----swap
----/tmp
----/home/home2

Sata2 and 3
----Raid /home

I wonder if there is some way of monitoring writes to a partition.

John

I’ve had a similar set-up for about half a year now, root on SSD, home and swap on a normal drive. I initially set /tmp, as well as /var/tmp, /var/cache and /var/log, to use RAM but changed the set-up back to use the normal mount points, on the SSD; should be interesting to see how long the SSD will last.

Also, if you haven’t done so already you should change scheduler used for the SSD partition(s) to a different than the default ‘cfq’. I could not see any mention of it, and at least on OS 12.2 I had to set this manually.

Cheers

I wonder if there is some way of monitoring writes to a partition.

Perhaps iostat (sysstat package) might be usable for you? iostat(1) - Linux man page

Could some one elaborate on “cfq” desktop user style - how, where and what it is?

As I messed up the install and wanted to change discs in the machine as well I had a look through 11.4 to see what seems to use tmp type set ups. Came up with these. Dev’s an interesting one - re loaded on every start up. Logs go into var and maybe one or two other things. It boots of flash so quickly I have added a delay in case I need the bios so these little bits shouldn’t matter.

/tmp
/var
/dev
plus swap - which shouldn’t see any use anyway.

On for flash rich people etc I just noticed that I have been using 30gb for the system disc in this machine. It’s just over half full and I have loads of applications installed. Make me wonder why I bought such a big ssd disc. My home directory is on a separate raid array, just short of 140gb. Under 1/2 full. And about 250 odd gb on a nas. rotfl! I’m having problems finding a small enough disc for system writes so will be using a 250gb for that, most of it will have to be a home2 partition.

Next step will be to try and get app software in my home that doesn’t write onto the ssd - eventually. I should be running the new machine by now.

John

On 2013-06-15 15:26, hcvv wrote:
>
> I saw your statements about your /tmp directory and what it contains.
> Maybe it is better to manage that a bit. YaST > System > /etc/sysconfig
> editor and there: System > Cron >
>
> For systems that are booted every (few) day(s), setting
> CLEAR_TEMP_DIRS_AT_BOOTUP is very useful. There are a few more
> parameters there which you might be interested in.

Just to comment that the above does not work when using systemd, it is
disabled. Instead, it is configured in “/usr/lib/tmpfiles.d/tmp.conf”:


# Clear tmp directories separately, to make them easier to override
d /tmp 1777 root root 10d
d /var/tmp 1777 root root 30d


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

On 2013-07-08 15:06, John 82 wrote:

> As I messed up the install and wanted to change discs in the machine as
> well I had a look through 11.4 to see what seems to use tmp type set
> ups. Came up with these. Dev’s an interesting one - re loaded on every
> start up. Logs go into var and maybe one or two other things. It boots
> of flash so quickly I have added a delay in case I need the bios so
> these little bits shouldn’t matter.

You might have a look at laptop-mode-tools. Even if you don’t install
it, look at what it does because there is a setting to delay writing to
disk “that often”. IIRC, the kernel writes about once ever 6 seconds
when iddle - some increase that to 6 minutes or even more. Even without
being so drastic, grouping writes decreases wear.

>
> /tmp
> /var
> /dev
> plus swap - which shouldn’t see any use anyway.
>

Don’t use a partition for /dev, leave it as directory of “/”. Why?
Because it is just a mount point for a virtual filesystem, same as /proc
or /sys.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

I’ve run SSDs on 2 of my Dell laptops for a few years now. Like someone else who posted here, I probably do more writes than the normal person (I do a lot with databases and do large file transfers all the time, and I am 100% SSD on internal storage and only use platters for external storage, backups, or archiving).

I’ve not had a single problem with “wearing out” an SSD by doing too many writes. Both machines are working fine — just be sensible and do the normal things you should do anyways like take backups here and there and you’ll be fine. But once you get them installed you’ll never want to use rotational storage again, ever. I tell people on older machines now that if they want to improve performance, 1st install more memory if you can, 2nd install an SSD.

One nice thing too is that I don’t have to worry about placement of data on the platter anymore (like putting more frequently-accessed filesystems and data on outer tracks, etc). Makes setup a bit easier and less worry about setting it up wrong from the get-go.

My advice would be for you to go 100% SSD if you can, use a filesystem that supports TRIM (like ext4 and / or xfs), change the IO scheduler to noop, and put /tmp in RAM if you have enough memory. You’re system will flippin’ FLY if you do – I can tell you from experience :slight_smile:

HTH…

See this thread and follow the links: http://forums.opensuse.org/english/get-technical-help-here/install-boot-login/480682-kernel-settings-question.html

Agreed, and is/describes a similar situation as for myself. To be sure, SSDs can go belly up, but I really don’t think that the average user has to worry about it being from writes.

Cfq should be fine for ssds now. Some benchmarks me and fellows at open linux forums did looked promising. I would do some benchmarks of your own first before you blindly believe me (or anyone).

I never tried tuning any of the parameters.

Things may well be getting worse and worse as far as life is concerned on ssd. Started as slc and now even more levels and narrower and narrower architecture. The extra levels cease to be strictly digital as more “bits” are obtained from one cell. Pass as to how bad this is but there are some interesting comments about. One way of increasing life might be to partition the device and not use one partition until the other has worn out. The Pelxor (?Spelling) one I have bought specifies a failure time that can only be a prediction and as such must be making and assumption about use. If for instance the manufacturers are aiming at people buying them every 3 years I won’t be happy unless I can make it last at least 6.

I’ve been using this machine for 7 years and am only changing because it’s maxed out on ram. Otherwise I might use it for another 7 - :|not sure though as I have had a couple of gremlins that suggest data corruption recently but both in KDE.

Thanks for the link. I like to know why etc.

I assume the 6 sec is flushing to the discs or is it as I would have thought that should stop if the machine is idle once the buffers are empty? I looked around on the web but couldn’t find anything else that mentioned this and using laptop tools. I can see it’s possible to use that to enforce larger disk writes but have no idea how big a buffer the kernel will maintain in memory?

If I read the /dev comment correctly it seems that I am looking at the directory of a ram disk? I noticed that the dates change on reboots and then looked at the opensuse doc’s on /dev.

Disabling file access time logging is also suggested. I am not sure if system reads are even logged though.

John

On 2013-07-08 19:16, John 82 wrote:

> If I read the /dev comment correctly it seems that I am looking at the
> directory of a ram disk? I noticed that the dates change on reboots and
> then looked at the opensuse doc’s on /dev.

Have a look at the output of the “mount” command, and find out the entry
for “/dev”.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)