SSD optimisation in SL 6.1

Status
Not open for further replies.

amdfangirl

Expert
Ambassador
You all know I don't know all that much about Linux, possibly even less about terminal.

Well...

I want to enable TRIM, disable swap/tmp if possible and optimise my SSD for Linux according to an article in APC. Here's a little background...

Scientific Linux 6.1 + all updates, Crucial m4 64GB SSD.

You might notice this thread being on the APC forum. That's because I'm asking on behalf of that user I know irl.

Code:
[strayfire@Katyr ~]$ su
Password: 
[root@Katyr strayfire]# fdisk -l

Disk /dev/sda: 64.0 GB, 64022175232 bytes
255 heads, 63 sectors/track, 7783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4fa3da4e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        7784    62008320   8e  Linux LVM

Disk /dev/mapper/vg_katyr-lv_root: 30.3 GB, 30270291968 bytes
255 heads, 63 sectors/track, 3680 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_katyr-lv_root doesn't contain a valid partition table

Disk /dev/mapper/vg_katyr-lv_swap: 10.1 GB, 10133438464 bytes
255 heads, 63 sectors/track, 1231 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_katyr-lv_swap doesn't contain a valid partition table

Disk /dev/mapper/vg_katyr-lv_home: 23.1 GB, 23089643520 bytes
255 heads, 63 sectors/track, 2807 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/vg_katyr-lv_home doesn't contain a valid partition table
[root@Katyr strayfire]#

From the magazine I'm reading (APC Feb 2012; Linux Mint 12):

No distributions enable it (TRIM) by default, but it's simple to do by adding the 'discard' flag to any mounted SSDs. To make these changes, open up terminal and run:

sudo nano -w /etc/fstab

Then for all SSD devices remove 'relatime' if present and add 'noatime, nodiratime,discard' so it looks something like:

dev/sda / ext4
noatime, nodiratime,discard,errors=remount-ro 0 1

So where would I put it on my etc/fstab? Do I just copy and paste it somewhere??

Code:
# /etc/fstab
# Created by anaconda on Fri Feb  3 04:43:17 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_katyr-lv_root /                       ext4    defaults        1 1
UUID=44b1e55b-616c-454e-82f7-6d3e2b82399f /boot                   ext4    defaults        1 2
/dev/mapper/vg_katyr-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_katyr-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0


If there is a more elegant way of no having tmp/swap requires a re-installation/repartition manually to regain disk space, I'm really not that worried. Thanks all.
 
Solution
[cpp]#lvremove vg_katyr/lv_swap
#lvextend vg_katyr/lv_home
#resize2fs /dev/mapper/vg_katyr-lv_home[/cpp]
should deal with the swap partition (first to remove the swap LV, second to resize the home LV, and third to resize the filesystem). Remove line 10 of /etc/fstab as well. You may well have to do it from a bootable CD/DVD/USB. And no guarantees that it will work – it came from "man lvm" (to find the utilities, then their man pages for details) and "man -k ext4" (to find out it was resize2fs I was looking for, then man resize2fs for details).

Then lines seven through nine of /etc/fstab will need "defaults" changing to "defaults,noatime,nodiratime,discard".

PreferLinux

Distinguished
Dec 7, 2010
1,023
0
19,460
[cpp]#lvremove vg_katyr/lv_swap
#lvextend vg_katyr/lv_home
#resize2fs /dev/mapper/vg_katyr-lv_home[/cpp]
should deal with the swap partition (first to remove the swap LV, second to resize the home LV, and third to resize the filesystem). Remove line 10 of /etc/fstab as well. You may well have to do it from a bootable CD/DVD/USB. And no guarantees that it will work – it came from "man lvm" (to find the utilities, then their man pages for details) and "man -k ext4" (to find out it was resize2fs I was looking for, then man resize2fs for details).

Then lines seven through nine of /etc/fstab will need "defaults" changing to "defaults,noatime,nodiratime,discard".
 
Solution

amdfangirl

Expert
Ambassador
After reading over the RHEL storage admin guide, I ended up with:

sda (SSD)
sda1 / Rest of space
sda2 /boot 500MB
Free Space 2 MB

sdb (HDD)
sdb1 /home Rest of space
sdb2 /tmp 200MB
Free Space 2MB

I chose not to have swap because I could never use all of my 8GB of RAM in Windows 7 (no pagefile and more of a memory hog) anyway. :)

I will flag the SSD with defaults,noatime etc. after I finish the reinstallation. Thanks mate!
 
Status
Not open for further replies.