Help with ssd

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Help with ssd

Postby Domaiv on Tue Aug 16, 2011 11:11 pm

I have decided to try out Linux,as I have just got a 60gb ssd. Windows takes up far too much space and I want to get the most out of my disk.

Because Linux is new to me every page I look at when trying to find info on the best settings to use with an ssd might as well be written in clingon. This might seem like I am trying to run before I can walk, but I would like to set the os that it reduces the amount of writes on the disk.

Could anyone point to a tutorial that can be understood by a mint virgin. I would like to set up a ramdisk for all cache and temp files. It would also be handy to know if I really need a swap partition, and if not how to get rid of it.

Thanks from a confused newbie.
Last edited by Domaiv on Wed Aug 17, 2011 5:02 pm, edited 2 times in total.
If it helps answer the many questions I am likely to ask:
msi 770-c45 mb
phenom 555be (unlocked)
xfx hd 5830 graphics
8gb ram
ocz agility 3 60gb (conected to sata II)
Domaiv
Level 1
Level 1
 
Posts: 7
Joined: Tue Aug 16, 2011 10:58 pm

Linux Mint is funded by ads and donations.
 

Re: Help with ssd

Postby xenopeek on Wed Aug 17, 2011 2:24 am

Update 2: below I share how to enable TRIM for your SSD with the discard keyword. For some specific SSD models this may in fact cause file deletions you do to take more time than without the discard keyword. If that is the case for your SSD, here is the alternative of enabling TRIM with the fstrim command run once daily through cron: http://www.webupd8.org/2013/01/enable-t ... rives.html

Update: if you are using the MATE desktop, replace the editor "gedit" in below commands with "pluma". Or for KDE replace it with "kate.

Hi, first off, it is Klingon. You don't want to get caught by these guys misspelling their language :wink:

As for swap, that depends on how much main memory your machine has. (You can see this in Menu -> Control Center -> System Profiler and Benchmark, then under Devices click Memory and look at Total Memory--roughly devide by 1,000,000 to get to how much GB that is.) If you have 1GB or less, you really need swap. If you have around 2GB it depends on what you use your machine for (Internet and Office will run fine without swap, but if you do movie editing, rendering, DAW or such things you need swap). At 4GB or over you don't really need swap, I run without it. If however you want to hibernate your machine, you need swap at least equal to how much main memory your machine has.

On to optimizing for SSD. For this you need to open Terminal (find it in Menu). Normally the system is optimized to work with a normal harddisk, but this is actually all overhead for a SSD that is slowing the system down.To fix this, in Terminal type:
Code: Select all
gksudo gedit /etc/default/grub

Enter your password when asked, and then change the line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

To:
Code: Select all
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"

Save & close the file. Then do the following to activate the changes from next reboot:
Code: Select all
sudo update-grub2

Next up, you need to find out if your SSD supports TRIM. Just copy & paste the following command string to the Terminal and execute it. When asked type your password (nothing will seem to happen as you type, this is normal):
Code: Select all
for h in /dev/sd?; do if [ `sudo hdparm -I $h | grep TRIM | wc -l` != 0 ]; then sudo hdparm -I $h | egrep "/dev/|Model"; fi; done

Did it list your SSD? Then it supports TRIM, if it didn't show anything your SSD doesn't support TRIM. Remember that, and continue with:
Code: Select all
gksudo gedit /etc/fstab

First the easy part, at the end of this file add the following line. These change it so temporary files are stored in memory instead of on your SSD.
Code: Select all
none /tmp     tmpfs nodev,nosuid,mode=1777 0 0

Now for the hard part. Probably you have a line like something like the following in your file:
UUID=0c4de1f6-b77b-49d7-bccf-63c4268e8f43 / ext4 errors=remount-ro 0 1

You need to change the:
errors=remount-ro

To read (this disables writing to disk each time a file is read):
Code: Select all
errors=remount-ro,noatime

And if your SSD supported TRIM, instead change it to (this does the same as above, but enables TRIM use on your SSD):
Code: Select all
errors=remount-ro,noatime,discard

Finally, save & close this file. Then run the following two commands. This will reboot your system to activate all changes.
Code: Select all
sudo rm -rf /tmp/*
sudo reboot

After the rebot, you'll want to start Firefox, type in the address bar:
Code: Select all
about:config

And hit enter. Accept the warning and continue. Right click on an empty part, and select New -> String from the context menu that popped up. Enter:
Code: Select all
browser.cache.disk.parent_directory

And give it the value:
Code: Select all
/tmp

This makes the Firefox cache also be stored in memory instead of on disk. If you have 2GB or less, you might not want to do this though.

Edit: some questions answered about mounting options and scheduler, here viewtopic.php?f=90&t=101810&p=578163.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Help with ssd

Postby Domaiv on Wed Aug 17, 2011 2:58 pm

You learn something new everyday. I learned the correct spelling of Klingon (is it considered a weakness to ask for forgiveness for my mistake?)

That all seems to have worked. Thank you for your time and help.

I also managed to turn off swap and delete the partition. Now to reallocating that free space.

QA TLHO'
If it helps answer the many questions I am likely to ask:
msi 770-c45 mb
phenom 555be (unlocked)
xfx hd 5830 graphics
8gb ram
ocz agility 3 60gb (conected to sata II)
Domaiv
Level 1
Level 1
 
Posts: 7
Joined: Tue Aug 16, 2011 10:58 pm

Re: Help with ssd

Postby xenopeek on Wed Aug 17, 2011 3:21 pm

buy' ngop
majQa'

Brilliant signature BTW :wink:
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Help with ssd [SOLVED]

Postby Domaiv on Wed Aug 17, 2011 4:15 pm

I'm sure your instructions will be used by many as ssd's become more popular
If it helps answer the many questions I am likely to ask:
msi 770-c45 mb
phenom 555be (unlocked)
xfx hd 5830 graphics
8gb ram
ocz agility 3 60gb (conected to sata II)
Domaiv
Level 1
Level 1
 
Posts: 7
Joined: Tue Aug 16, 2011 10:58 pm

Re: Help with ssd

Postby Domaiv on Wed Aug 17, 2011 5:05 pm

My temp files are still going to file "system/tmp"


After the first command change I get this message in the terminal:
(gedit:4862): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory
If it helps answer the many questions I am likely to ask:
msi 770-c45 mb
phenom 555be (unlocked)
xfx hd 5830 graphics
8gb ram
ocz agility 3 60gb (conected to sata II)
Domaiv
Level 1
Level 1
 
Posts: 7
Joined: Tue Aug 16, 2011 10:58 pm

Re: Help with ssd

Postby xenopeek on Thu Aug 18, 2011 1:24 am

(gedit:4862): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory

You can ignore that. Gedit keeps a list of recently used files, and as you are executing commands as root it tries to update also for the root user the list of recently used files. On default install the folder /root/.local/share doesn't exist. No harm in this. But if you want to not see these errors, run:
Code: Select all
sudo mkdir -p /root/.local/share

And files will continue to go to /tmp folder, but having done all the commands I gave you the /tmp folder is no longer on your disk but is in memory. That is what the line:
none /tmp tmpfs nodev,nosuid,mode=1777 0 0

Added to /etc/fstab file does. It makes a new temporary filesystem in memory (type=tmpfs). If you doubt if it is active, after reboot on the changes do:
Code: Select all
cat /etc/mtab

Or:
Code: Select all
mount

That lists all the active filesystem mounts, and should now have a line added for /tmp as tmpfs.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Help with ssd

Postby Domaiv on Thu Aug 18, 2011 2:35 am

I think I understand. /tmp shows the temp files on the ssd and ram.

I think the hardest part of this is going to be forgeting about windows after 20 years of using it.
If it helps answer the many questions I am likely to ask:
msi 770-c45 mb
phenom 555be (unlocked)
xfx hd 5830 graphics
8gb ram
ocz agility 3 60gb (conected to sata II)
Domaiv
Level 1
Level 1
 
Posts: 7
Joined: Tue Aug 16, 2011 10:58 pm

Re: Help with ssd

Postby Eucalyptus on Tue Jun 12, 2012 12:01 pm

Vincent Vermeulen wrote:First the easy part, at the end of this file add the following two lines. These change it so temporary files are stored in memory instead of on your SSD.

Code: Select all
none /tmp     tmpfs nodev,nosuid,mode=1777 0 0
none /var/tmp tmpfs nodev,nosuid,mode=1777 0 0

Hi Vincent,
I hope you won't mind if I resuscitate this post. Can you please clarify about the using the RAM for tmpfs?

On a machine having 4GB RAM and using LM13 64 bits, would there be any chance that tmpfs runs out of memory? The typical applications opened on this computer is Firefox (10 tabs in general), Virtualbox (the VM is allocated 800 MB), evince PDF Viewer, burning DVD from time to time. System monitor shows RAM usage between 1.4 to 2.0 GB.

Let's assume tmpfs doesn't have enough RAM, would there be any visible sign or would the computer hang unexpectedly?

Thanks in advance
User avatar
Eucalyptus
Level 3
Level 3
 
Posts: 114
Joined: Thu May 14, 2009 9:50 am
Location: Canada

Re: Help with ssd

Postby xenopeek on Tue Jun 12, 2012 1:05 pm

tmpfs mounts are by default set to half your memory size. In your case, each tmpfs mount will be 2 GiB it size. That is its virtual size, it only uses as much memory as the space that it actually needs. As happens with any mount that is filling up, you will receive a warning when it is close to running out of free space.

Usually your /tmp is not needing that much space and 2 GiB will be unlikely to be used. You can check how much is being used with the command:
Code: Select all
df

Sizes shown are in KiB.

If you want, you can configure your tmpfs mount to have a different size. You can do so with the "size" option, as for example to restrict it to 25% of memory:
Code: Select all
none /tmp     tmpfs nodev,nosuid,mode=1777,size=25% 0 0

Instead of percentages, you can also give it a specific amount of bytes. Or add the suffix k, m or g to make that KiB, MiB or GiB. More details available in the kernel documentation on tmpfs: https://www.kernel.org/doc/Documentatio ... /tmpfs.txt
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Help with ssd

Postby Eucalyptus on Thu Jun 14, 2012 11:22 pm

Hi,

It looks like 4GB RAM is not enough for LM13 x64. After half of a day, the machine experiences little strange behavior with Firefox 13. FF 13 is slow when the window is dragged around and has experiences a perceivable reduction of responsiveness. Clicking in a folder in the FF bookmark toolbar no longer unfold the content. After a reboot, all these issues disappear and reappear a few hours later.

May be this is a FF13 specific issue. What is strange is that when I comment out the two lines related to tmpfs in fstab, there is no issue. I am going to increase the RAM on that machine to 8GB and put back the 2 lines in fstab to see if that improves the situation.

EDIT: More info a month after increasing the RAM from 4GB to 8GB, the hang up issue of Firefox 13 had disappeared. I am certain that the RAM increase was the fix. During the 1st week after increasing RAM, I didn't change anything else in the computer and the issue was occurring on a daily basis when there were 4GB. I have also set the size of the RAM disk to 25% (therefore reserving 2GB on the total 8GB).
User avatar
Eucalyptus
Level 3
Level 3
 
Posts: 114
Joined: Thu May 14, 2009 9:50 am
Location: Canada

Re: Help with ssd

Postby caerolle on Tue Sep 25, 2012 10:14 am

I used this post over the weekend to set up an SSD, worked really well! The main reason I am posting is to remind anyone else who uses this post that 'gedit' is the GNOME text editor. In MATE, this has been replaced as 'pluma', so you need to use pluma in place of gedit (or just open pluma and the file from the GUI). I can't remember what text edit is used in the other DEs (Cinnamon, Xfce, and so forth), but would need to use that in place of gedit. The rest of the stuff seemed pretty DE agnostic.

Thanks for the great post, Vincent!
caerolle
Level 3
Level 3
 
Posts: 143
Joined: Sun Aug 26, 2012 3:50 pm

Re: Help with ssd

Postby catch22 on Sat Dec 15, 2012 8:24 am

Vincent Vermeulen wrote:...
Code: Select all
for h in /dev/sd?; do if [ `sudo hdparm -I $h | grep TRIM | wc -l` != 0 ]; then sudo hdparm -I $h | egrep "/dev/|Model"; fi; done

Did it list your SSD? ...
Since it shows "/dev/sda" I suppose it does (?), but should I be careful about the "bad/missing" messages, or can I simply proceed?
Code: Select all
for h in /dev/sd?; do if [ `sudo hdparm -I $h | grep TRIM | wc -l` != 0 ]; then sudo hdparm -I $h | egrep "/dev/|Model"; fi; done
/dev/sda:
        Model Number:       OCZ-AGILITY3                           
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
catch22
Level 2
Level 2
 
Posts: 52
Joined: Mon Oct 01, 2012 7:50 am

Re: Help with ssd

Postby xenopeek on Sat Dec 15, 2012 8:37 am

Yes, the OCZ-AGILITY3 supports trim. I'm not sure about the errors, but at least be sure that the OCZ-AGILITY3 supports trim.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Help with ssd

Postby pjorge1036 on Thu Jan 10, 2013 12:26 am

Thank you for this guide!
pjorge1036
Level 1
Level 1
 
Posts: 4
Joined: Sun Jan 06, 2013 7:44 pm

Re: Help with ssd

Postby cool_thing76 on Mon Feb 18, 2013 8:00 am

Thank you for the nice SSD optimization guide.
cool_thing76
Level 1
Level 1
 
Posts: 14
Joined: Sat Sep 12, 2009 11:29 am

Re: Help with ssd

Postby catweazel on Mon Feb 25, 2013 4:13 pm

xenopeek wrote:below I share the old way of enabling TRIM for your SSD (with the discard keyword), but it seems these days that is better done as per this article: http://www.webupd8.org/2013/01/enable-t ... rives.html[/color]

Very interesting. If I get time at work this morning I'll do a bit of research on that to find out more. Thanks for the link.
Mint Testing Team & Mint Donor #3606
KDE 4.12.0, custom preemptive kernel 3.12.5,
Intel i7 4770K @ 4.7GHz, 16GB 2666MHz XMP,
4 Samsung 840 PRO 512GB SSDs in RAID0,
6TB HW RAID10, dual 24" Acer X243H,
Gigabyte nVidia GTX 680 Super Overclock
User avatar
catweazel
Level 7
Level 7
 
Posts: 1656
Joined: Fri Oct 12, 2012 9:44 pm

Re: Help with ssd

Postby TheForumTroll on Mon Feb 25, 2013 7:36 pm

I was writing a guide to post on here but I didn't finish it (it's done more or less, I just wanted to add some benchmarks but never got around to run them). Feel free to have a look.
PC: Intel I5-2500K || ASUS Sabertooth P67 || 4GB Corsair XMS3 || Gainward GTX 460 GS-GLH || OCZ Vertex 3 || Noctua NH-D14 || Corsair HX 750W || NZXT PanzerBox || Zalman ZM-MFC1+ || ASUS VW246H || Microsoft SideWinder X6 || Logitech G9 Lazer
TheForumTroll
Level 2
Level 2
 
Posts: 58
Joined: Tue Aug 21, 2012 3:47 am

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: bobsmith, Google Adsense [Bot] and 26 guests