Thinking about putting an SSD in my Ubuntu box and have some ?'s

Deadjasper

2[H]4U
Joined
Oct 28, 2001
Messages
2,584
1. Does Ubuntu make proper use of SSD's?

2. Is it possible to move my install from it's current regular HD to the SSD or would I be better off doing a fresh install?

TIA
 
1. Does Ubuntu make proper use of SSD's?

Sure does as long as your kernel is 2.6.32 or higher and your drive is formatted in Ext4 (I believe this is the only supported FS currently). Linux won't detect the SSD automatically, so you'll need to go into fstab and add "discard" to the options list for your SSD.

Here's a good article to help you out.

2. Is it possible to move my install from it's current regular HD to the SSD or would I be better off doing a fresh install?

I would do a clean wipe, but I tend to go overboard with things. I feel doing a fresh install is the easiest way.
 
I decided that since the SSD boots so damn fast that I would just run Ubuntu as a virtualization in VMware in Win7.
 
Sure does as long as your kernel is 2.6.32 or higher and your drive is formatted in Ext4 (I believe this is the only supported FS currently). Linux won't detect the SSD automatically, so you'll need to go into fstab and add "discard" to the options list for your SSD.

Here's a good article to help you out.



I would do a clean wipe, but I tend to go overboard with things. I feel doing a fresh install is the easiest way.

Thank you, sir. This is most helpful. I assume from reading the link that I first install Ubuntu and then enable TRIMM, correct?

I've decided to do a clean install, that everything starts out fresh.
 
Thank you, sir. This is most helpful. I assume from reading the link that I first install Ubuntu and then enable TRIMM, correct?

This is correct. On a side note, if you're using a drive that has previously been used its a good idea to restore it to factory by issuing a secure wipe. From my understanding, merely formatting a SSD isn't enough to regain its out-of-the-box-new read/write performance.

To do a secure wipe, you basically run the Ubuntu live CD, open a terminal and use HDPARM to issue the wipe command on the SSD.

Here's another article that better explains the procedure.

I've found running Linux on an SSD to be a better experience then under Win7. Then again, that could just be my neck beard talking.
 
It's done. Now I'll have to slog through a month of Sundays to get it configed the way it was. :mad:

I activated TRIMM (I think), but the instructions on how to test if is garbage. If I follow them verbatim, I get errors. If I deviate, I still get errors. For example, it shows - /dev/sdx. this don't work but it's not too hard to figure out that there has to be space in there. But the starting LBA is trickier, I have no idea which number I'm supposed to use and the writeup only confuses me more. the place where you're supposed to put in the starting LBA is shown as [ADDRESS]. It says nothing about the brackets, do they stay or do they go? anyway, after fighting with it for a while I gave up. I'll either look for an easier way skip it altogether. When it comes to syntax, instructions tend to create more questions than answers. :(
 
It's done. Now I'll have to slog through a month of Sundays to get it configed the way it was. :mad:

I activated TRIMM (I think), but the instructions on how to test if is garbage. If I follow them verbatim, I get errors. If I deviate, I still get errors. For example, it shows - /dev/sdx. this don't work but it's not too hard to figure out that there has to be space in there. But the starting LBA is trickier, I have no idea which number I'm supposed to use and the writeup only confuses me more. the place where you're supposed to put in the starting LBA is shown as [ADDRESS]. It says nothing about the brackets, do they stay or do they go? anyway, after fighting with it for a while I gave up. I'll either look for an easier way skip it altogether. When it comes to syntax, instructions tend to create more questions than answers. :(

When the tutorial is reference the mounting location of your drive, they used /dev/sdX simply as a place holder. For instance, on my machine, the mounting location of my SSD is /dev/sda and the mounting location of HDD is /dev/sdb, so simply replace /dev/sdX with the real location of your SSD.

So here's how I'd test TRIM on my drive:

1. Open a terminal and cd to the root '/' directory. I'm changing to the root directory because all my system files are on my SSD while the home directory and SWAP are on my HDD:
me@mymachine:~$ cd /

2. Next, I create a 50mb file filled with random data:
me@mymachine:/$ sudo dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct

And here's the output after I've successfully created that file:
me@mymachine:/$ sudo dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct
100+0 records in
100+0 records out
52428800 bytes (52 MB) copied, 6.11487 s, 8.6 MB/s

3. Now, using hdparm, I find out what the starting LBA (logical block addressing) for the file, "tempfile", is that I had just created:
me@mymachine:/$ sudo hdparm --fibmap tempfile

And here's the output from hdparm:
me@mymachine:/$ sudo hdparm --fibmap tempfile

tempfile:
filesystem blocksize 4096, begins at LBA 2048; assuming 512 byte sectors.
byte_offset begin_LBA end_LBA sectors
0 1590272 1591295 1024
524288 1594368 1609727 15360
8388608 1624064 1640447 16384
16777216 1853440 1886207 32768
33554432 2000896 2033663 32768
50331648 2705408 2709503 4096

This is where it gets tricky. Keep in mind, your output will be different than mine. The number you'll want is on the first row, second column (the "begin_lba" column), which for me is the number 1590272 (as I've highlighted in the output above). So, now when we tell hdparm that beginning address:

me@mymachine:/$ sudo hdparm --read-sector 1590272 /dev/sda

hdparm should output the hash for that address:
me@mymachine:/$ sudo hdparm --read-sector 1590272 /dev/sda

/dev/sda:
reading sector 1590272: succeeded
4450 e8d6 20f1 2ded 7c69 edeb 19db d995
e79a 4e93 66cc e2c3 dbce 82f0 dac7 1c6d
c008 8284 50eb 370f a4e0 5755 5315 1341
f7f2 40ea c114 3b16 b759 fd87 19bd 848e
d090 ae6d a14c a1f4 381e 254d 2f80 b6eb
13cb fddf a953 81c6 7585 1014 b42a 1e7e
a71f 324f 3fd7 af97 e6a3 4162 8264 4dba
33a3 421e 8fa5 5da9 ea66 4aa8 226f 89d8
5c6a f95b 0e66 b192 39cb cd2b ac1d 174a
496a eb70 e26a 1a93 ccb7 be8c 5195 8c56
4365 7312 1ff5 cb23 a63c 4e44 b118 77ef
16e4 ebcf c921 9e82 0935 eff1 af5a 06bb
a917 c37e f48e cc99 f254 6365 cf62 155d
4426 b8d6 bc5b 2c3c 4f5e 5037 131f 5b77
547e a291 76df 327d 3e76 e3b4 9b05 5c24
0bac 5dd9 5969 ff57 75d7 05f0 a201 345e
d43c df0d ea63 a201 fe98 5ace 8897 64b8
a015 7795 2f40 830c f82e 2f8e 24e9 8a27
0ae4 3266 6ecc 0014 192c 34af 0946 bd13
68c4 af3b c277 293e b7ce 17b3 dc1f 837f
eedf d2d9 9bec ec0d a9d1 7fc7 b218 d1cb
e739 ced2 a0bd f435 dabd 8f5e 3637 3ca5
13ec 176b be0f 64aa b6bc dcc3 1fa8 bbdc
3327 61e3 32ed 24b6 1fb2 a4b5 4d19 88db
aca7 e45f bd84 fde8 7e00 57e4 e9a5 76ef
58cf 05f9 6936 a38b 0b76 cf23 c062 8eef
5465 4b26 7097 0979 8622 4ee0 802f 044d
2e1b 38e1 a64b fa4a 7eea d33c bf01 29f1
1cd1 d22f 232e 88f0 0869 7232 ee3f 4ed5
a3d8 1a29 bbf0 a7cb 10d3 b4e7 f717 4f63
1c36 88d7 3767 821e f06c b0c8 d414 f0ee
c667 4fcc f8f7 ccb7 adae a119 311f 4bd1

All of that randomness means there's data at that location.

5. Now delete "tempfile" and sync:
me@mymachine:/$ sudo rm tempfile
me@mymachine:/$ sync

6. Now we check that address again and if TRIM is indeed enabled we should see this:
me@mymachine:/$ sudo hdparm --read-sector 1590272 /dev/sda

/dev/sda:
reading sector 1590272: succeeded
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000

All of those zeros mean that the TRIM command was successfully called. If you're still seeing random junk then I would go back through your /etc/fstab and make sure its correctly configured.

Hope this explains it better!
 
Back
Top