| 1 | = SSD Setup Tutorial = |
| 2 | |
| 3 | The following is a short tutorial on how to setup a Solid State Drive on Linux and use for swap space and storing temporary files. Upon completion of this procedure you should have a faster system in general and particularly a more responsive LAG. Note that all the commands listed below should be run as super user. |
| 4 | |
| 5 | == Installation == |
| 6 | |
| 7 | To install an SSD drive you need to connect it with two cables: SATA data cable and a power cable. Turning off the workstation to do it is not necessary, but is recommended. If there are no spare cables inside your case it should be fine to use those that connect the optical drive as it is not being used anyway. The picture below shows the cables that need to be plugged into SSD. |
| 8 | |
| 9 | [[Image(http://topsolidstatedrives.com/wp-content/uploads/2012/02/SATA-Power-And-Data-Cables.jpg,align=center)]] |
| 10 | {{{ |
| 11 | #!div style="font-size: 80%; text-align: center" |
| 12 | SATA and power cables which need to be connected. |
| 13 | }}} |
| 14 | |
| 15 | == Partitioning == |
| 16 | |
| 17 | Run gparted as root and select your new device from the list in the top-right corner. It should be called something like ///dev/sdc// and have 112GB capacity. Create one partition of size 122880MB with linux-swap file system and next partition with the remaining space as ext4 filesystem. |
| 18 | |
| 19 | [[Image(gparted.png,align=center)]] |
| 20 | {{{ |
| 21 | #!div style="font-size: 80%; text-align: center" |
| 22 | Gparted - that's how your drive should look like after partitioning. |
| 23 | }}} |
| 24 | |
| 25 | == Setting up the swap space == |
| 26 | |
| 27 | To move the swap space you first need to check where is it already mounted: |
| 28 | {{{ |
| 29 | #!bash |
| 30 | cat /etc/fstab | grep swap |
| 31 | }}} |
| 32 | |
| 33 | The firt column will tell you the mount point which should be something like ///dev/mapper/vg0-lv1/. Now, assuming your newly created swap partition is on /dev/sdc1, run: |
| 34 | {{ |
| 35 | #!bash |
| 36 | swapoff -v /dev/mapper/vg0-lv1 |
| 37 | mkswap /dev/sdc1 |
| 38 | swapon -v /dev/sdc1 |
| 39 | }} |
| 40 | |
| 41 | You can confirm that a 12GB swap has been created by running //free//. |
| 42 | |
| 43 | == Editing /etc/fstab == |
| 44 | |
| 45 | To make the permanent changes to the filesystem you have to edit /etc/fstab file. Comment out or delete the line with //swap// in it and the line starting with tmpfs. At the and of the file add the following two lines: |
| 46 | {{ |
| 47 | #!bash |
| 48 | /dev/sdb1 swap swap defaults 0 0 |
| 49 | /dev/sdb2 /tmp ext4 defaults,discard,noatime,rw,nosuid,noexec 0 0 |
| 50 | }} |
| 51 | |
| 52 | Your fstab file should be similar to the one below: |
| 53 | |
| 54 | [[Image(fstab.png,align=center)]] |
| 55 | {{{ |
| 56 | #!div style="font-size: 80%; text-align: center" |
| 57 | /etc/fstab file after modification. |
| 58 | }}} |
| 59 | |
| 60 | To apply the changes and properly setup the /tmp folder run: |
| 61 | {{{ |
| 62 | #!bash |
| 63 | mount -a |
| 64 | chown root:root /tmp |
| 65 | chmod 1777 /tmp |
| 66 | }}} |
| 67 | |
| 68 | To confirm all worked you can now run //df// and see your /dev/sdc2 mounted on /tmp. |