alpharesearch
May 24th, 2010, 04:11 PM
I want to write down what I did so I don't forget - and this post may serves as a howto for other users.
Setup
First I booted my HDD Linux installation up to install bootchart and then I rebooted my PC 3-5 times with 5 minutes wait in between
to get some readings how the system performs with the HDD. When I was finished migrating I did that same test again with the SSD Linux
installation to see if the SSD was a good investment.
http://www.alpharesearch.de/ocz/hdd_bootchart.png
The little red x is when Firefox starts up and the systems becomes usable; as an excuse I have over 2600 additional packages installed
and my root is over 17 GB. There are a lot of server things like data bases starting up.
Hardware and BIOS
I got a 50 GB Vertex LE and a 100GB Vertex LE (thanks to Newegg for good service!). I also had to order a 2.5" to 3.5" mounting bracket
for $5.99 - to make this in China in large quantities should not cost more that a couple of cents so please OCZ include something with
your product.
I still had two SATA II cables at hand, so I didn't need one... but in my opinion it would make sense to offer a retrial box with
SSD+bracket+cable for a little more and a OEM box with just the SSD of course.
In the next step I installed everything in my PC and changed the BIOS IDE setting to AHCI.
First Benchmark
Than I use the 10.04 install CD to boot into a independent live CD system Please note that the Live CD must be the same as the system
you are having - either 32-bit or 64-bit (if not then the chroot later will fail)...
First I started the Gnome Disk Utility (System->Administration->Disk Utility) to check if my AHCI controller can handle the SSD speed.
ou can only perform the Read/Write Test if the disk is empty so now is the best time to do this type of benchmark. Here are my results,
it looks just like advertised :)
http://www.alpharesearch.de/ocz/Screenshot-50 GB Solid-State Disk (ATA OCZ VERTEX-LE) – Benchmark.png
http://www.alpharesearch.de/ocz/Screenshot-100 GB Solid-State Disk (ATA OCZ VERTEX-LE) – Benchmark.png
Partitioning
The next step is to create the partitions, the Disk Utility could do this but I wanted the correct alignment so I used the
fdisk method from this forum (http://www.ocztechnologyforum.com/forum/showthread.php?54379-Linux-Tips-tweaks-and-alignment]Linux%20-%20Tips,%20tweaks%20and%20alignment).
I created one root (/) a /home and a /boot (for future RAID) partition. I will use the swap partition from on my existing HDD.
sudo fdisk -H 32 -S 32 /dev/sda starts for first hard drive, use the Disk Utility to find your device name, then use "o" creates a new partition
table and "n" creates the partitions (I followed the guide (http://www.ocztechnologyforum.com/forum/showthread.php?54379-Linux-Tips-tweaks-and-alignment]Linux%20-%20Tips,%20tweaks%20and%20alignment) and created a primary partition starting with sector 2),
"t" with 83 sets the partition type to Linux, and "w" writes everything to disk.
Here is the example form TortureTest guide:
$ sudo fdisk -H 32 -S 32 /dev/sda
The number of cylinders for this disk is set to 15711.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): o
Building a new DOS disklabel with disk identifier 0x8cb3d286.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 15711.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15711, default 1): 2
Last cylinder, +cylinders or +size{K,M,G} (2-15711, default 15711):
Using default value 15711
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Here are my result:
http://www.alpharesearch.de/ocz/fdisk.png
Format the partition
I used gparted or the Disk Utility to format it to EXT4 (with the next kernel version this will support trim I guess)
Copy your files
For the next copy step I used this
article as an inspiration. (http://www.linuxjournal.com/content/copy-your-linux-install-different-partition-or-drive) Still in the live CD system you can use the Disk Utility to mount both your old HDD partition and the
new SSD partition. To copy use this command:
sudo cp -afv /path/to/source/* /path/to/destination
(Don’t forget the asterisk after the source path and just copy the path from Disk Utility or Nautilus). Unmount both partitions with Disk
Utility and repeat this for all your other partitions.
Tweak some files on the new SSD root
To boot from the SSD you need to change the fstab file on the new partition, so mount your new SSD root partition and edit path/to/new/ssd/etc/fstab:
I used "sudo gedit /media/large UUID number/etc/fstab" in command line to do this. Replace the HDD UUID with the SSD UUID for your directory.
To see all the UUIDs use this command:
ls -l /dev/disk/by-uuid/
or as an alternative the Disk Utility tool will show the UUID as mount point name if you never entered a partition name.
Unmount all drives.
Next I added those lines to my path/to/new/ssd/etc/rc.local file
echo cfq > /sys/block/sda/queue/scheduler
echo noop > /sys/block/sdb/queue/scheduler
echo noop > /sys/block/sdc/queue/scheduler
echo cfq > /sys/block/sdd/queue/scheduler
echo 0 > /proc/sys/vm/swappiness
cfq is for HDD and
noop or deadline is for SSD
To make sure the swap is not used to much I used swappiness = 0
Because I boot from the SSD and I have GRUB 2 I added as the default to /etc/default/grub
GRUB_CMDLINE_LINUX="elevator=noop"
(if you change this later you need to run sudo update-grub)
Make drive boot with GRUB 2
Since Ubuntu 9.10 Grub 2 is the default so there are some other steps necessary that are not covert on the other web page, but if you still
use Grub 1 just follow the link (http://www.linuxjournal.com/content/copy-your-linux-install-different-partition-or-drive) for the
old Grub modification.
For Grub 2 I used METHOD 3 - CHROOT from here (https://help.ubuntu.com/community/Grub2)
Still in Live CD Desktop in a terminal use:
sudo fdisk -l
(the switch is a lowercase "L") again to remember the device names to use in the next step. Now you need to mount the file system to the /mnt folder.
Mount your new SSD system root partition, substitute the correct partition: sda1, sdb5, etc.
sudo mount /dev/sdXX /mnt # Example:
sudo mount /dev/sda1 /mnt
Only if you have a separate boot partition, sdYY is the /boot partition designation (for example sdb3)
sudo mount /dev/sdYY /mnt/boot
Mount the critical virtual filesystems:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
Chroot into your normal system device:
sudo chroot /mnt
To update the grub files run:
update-grub
Now reinstall GRUB 2:
Substitute the correct device - sda, sdb, etc. Do not specify a partition number.
grub-install /dev/sdX
Exit chroot: CTRL-D on keyboard
Unmount virtual filesystems:
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
If you mounted a separate /boot partition:
sudo umount /mnt/boot
Unmount last device:
sudo umount /mnt
Now reboot and take the CD out and it should boot with the new SSD, you can use the Disk Utility to check for this. For bootchat
I recommend to do more than on boot up to get an average result.
Compare your Bootcharts
As you can see the performance gain is huge!
http://www.alpharesearch.de/ocz/ssd_bootchart.png
The little red x is when Firefox starts up and i can start using the system.
Conclusion
Like I said I do have a lot of extra packages installed I guess if I would not need all the other software and if I would do a clean install
I would be able to boot even faster. But from 35-75 seconds down to 15-20 is very good.
I will hopefully be able to edit this post soon to add more details.
Regards,
Markus Schulz
PS: For TRIM I use the whiper.sh script with the sandforce option and it seams to work.
Setup
First I booted my HDD Linux installation up to install bootchart and then I rebooted my PC 3-5 times with 5 minutes wait in between
to get some readings how the system performs with the HDD. When I was finished migrating I did that same test again with the SSD Linux
installation to see if the SSD was a good investment.
http://www.alpharesearch.de/ocz/hdd_bootchart.png
The little red x is when Firefox starts up and the systems becomes usable; as an excuse I have over 2600 additional packages installed
and my root is over 17 GB. There are a lot of server things like data bases starting up.
Hardware and BIOS
I got a 50 GB Vertex LE and a 100GB Vertex LE (thanks to Newegg for good service!). I also had to order a 2.5" to 3.5" mounting bracket
for $5.99 - to make this in China in large quantities should not cost more that a couple of cents so please OCZ include something with
your product.
I still had two SATA II cables at hand, so I didn't need one... but in my opinion it would make sense to offer a retrial box with
SSD+bracket+cable for a little more and a OEM box with just the SSD of course.
In the next step I installed everything in my PC and changed the BIOS IDE setting to AHCI.
First Benchmark
Than I use the 10.04 install CD to boot into a independent live CD system Please note that the Live CD must be the same as the system
you are having - either 32-bit or 64-bit (if not then the chroot later will fail)...
First I started the Gnome Disk Utility (System->Administration->Disk Utility) to check if my AHCI controller can handle the SSD speed.
ou can only perform the Read/Write Test if the disk is empty so now is the best time to do this type of benchmark. Here are my results,
it looks just like advertised :)
http://www.alpharesearch.de/ocz/Screenshot-50 GB Solid-State Disk (ATA OCZ VERTEX-LE) – Benchmark.png
http://www.alpharesearch.de/ocz/Screenshot-100 GB Solid-State Disk (ATA OCZ VERTEX-LE) – Benchmark.png
Partitioning
The next step is to create the partitions, the Disk Utility could do this but I wanted the correct alignment so I used the
fdisk method from this forum (http://www.ocztechnologyforum.com/forum/showthread.php?54379-Linux-Tips-tweaks-and-alignment]Linux%20-%20Tips,%20tweaks%20and%20alignment).
I created one root (/) a /home and a /boot (for future RAID) partition. I will use the swap partition from on my existing HDD.
sudo fdisk -H 32 -S 32 /dev/sda starts for first hard drive, use the Disk Utility to find your device name, then use "o" creates a new partition
table and "n" creates the partitions (I followed the guide (http://www.ocztechnologyforum.com/forum/showthread.php?54379-Linux-Tips-tweaks-and-alignment]Linux%20-%20Tips,%20tweaks%20and%20alignment) and created a primary partition starting with sector 2),
"t" with 83 sets the partition type to Linux, and "w" writes everything to disk.
Here is the example form TortureTest guide:
$ sudo fdisk -H 32 -S 32 /dev/sda
The number of cylinders for this disk is set to 15711.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): o
Building a new DOS disklabel with disk identifier 0x8cb3d286.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 15711.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15711, default 1): 2
Last cylinder, +cylinders or +size{K,M,G} (2-15711, default 15711):
Using default value 15711
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Here are my result:
http://www.alpharesearch.de/ocz/fdisk.png
Format the partition
I used gparted or the Disk Utility to format it to EXT4 (with the next kernel version this will support trim I guess)
Copy your files
For the next copy step I used this
article as an inspiration. (http://www.linuxjournal.com/content/copy-your-linux-install-different-partition-or-drive) Still in the live CD system you can use the Disk Utility to mount both your old HDD partition and the
new SSD partition. To copy use this command:
sudo cp -afv /path/to/source/* /path/to/destination
(Don’t forget the asterisk after the source path and just copy the path from Disk Utility or Nautilus). Unmount both partitions with Disk
Utility and repeat this for all your other partitions.
Tweak some files on the new SSD root
To boot from the SSD you need to change the fstab file on the new partition, so mount your new SSD root partition and edit path/to/new/ssd/etc/fstab:
I used "sudo gedit /media/large UUID number/etc/fstab" in command line to do this. Replace the HDD UUID with the SSD UUID for your directory.
To see all the UUIDs use this command:
ls -l /dev/disk/by-uuid/
or as an alternative the Disk Utility tool will show the UUID as mount point name if you never entered a partition name.
Unmount all drives.
Next I added those lines to my path/to/new/ssd/etc/rc.local file
echo cfq > /sys/block/sda/queue/scheduler
echo noop > /sys/block/sdb/queue/scheduler
echo noop > /sys/block/sdc/queue/scheduler
echo cfq > /sys/block/sdd/queue/scheduler
echo 0 > /proc/sys/vm/swappiness
cfq is for HDD and
noop or deadline is for SSD
To make sure the swap is not used to much I used swappiness = 0
Because I boot from the SSD and I have GRUB 2 I added as the default to /etc/default/grub
GRUB_CMDLINE_LINUX="elevator=noop"
(if you change this later you need to run sudo update-grub)
Make drive boot with GRUB 2
Since Ubuntu 9.10 Grub 2 is the default so there are some other steps necessary that are not covert on the other web page, but if you still
use Grub 1 just follow the link (http://www.linuxjournal.com/content/copy-your-linux-install-different-partition-or-drive) for the
old Grub modification.
For Grub 2 I used METHOD 3 - CHROOT from here (https://help.ubuntu.com/community/Grub2)
Still in Live CD Desktop in a terminal use:
sudo fdisk -l
(the switch is a lowercase "L") again to remember the device names to use in the next step. Now you need to mount the file system to the /mnt folder.
Mount your new SSD system root partition, substitute the correct partition: sda1, sdb5, etc.
sudo mount /dev/sdXX /mnt # Example:
sudo mount /dev/sda1 /mnt
Only if you have a separate boot partition, sdYY is the /boot partition designation (for example sdb3)
sudo mount /dev/sdYY /mnt/boot
Mount the critical virtual filesystems:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
Chroot into your normal system device:
sudo chroot /mnt
To update the grub files run:
update-grub
Now reinstall GRUB 2:
Substitute the correct device - sda, sdb, etc. Do not specify a partition number.
grub-install /dev/sdX
Exit chroot: CTRL-D on keyboard
Unmount virtual filesystems:
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
If you mounted a separate /boot partition:
sudo umount /mnt/boot
Unmount last device:
sudo umount /mnt
Now reboot and take the CD out and it should boot with the new SSD, you can use the Disk Utility to check for this. For bootchat
I recommend to do more than on boot up to get an average result.
Compare your Bootcharts
As you can see the performance gain is huge!
http://www.alpharesearch.de/ocz/ssd_bootchart.png
The little red x is when Firefox starts up and i can start using the system.
Conclusion
Like I said I do have a lot of extra packages installed I guess if I would not need all the other software and if I would do a clean install
I would be able to boot even faster. But from 35-75 seconds down to 15-20 is very good.
I will hopefully be able to edit this post soon to add more details.
Regards,
Markus Schulz
PS: For TRIM I use the whiper.sh script with the sandforce option and it seams to work.