You are not logged in.

#1 2010-06-10 03:25:21

onthejob
Member
Registered: 2007-10-19
Posts: 24

alignment and performance

hey, i'd really like to get the best out of ssd but the linux documentation is patchy and on average is contradictory and at worst is destructive.

here's the deal, i have a 50gb ocz vertex which i am more than willing to thrash to death to discover the best alignment parameters for ssd under linux and can be applied (roughly) for my next ssd.

i've already tried numerous techniques for partitioning an ssd the best result came with a nothing special install which culminated in a top seek of just under 200mb.sec. the ocz website tells me sustained througput can be 250+... that is my aim.

so an initial suggestion on how to align 4 primary partitions. there will be no swap!

part 1 = /boot and some extra for safe storage = 1 gb = ext2
part 2 = /root =10000 gb = ext4
part 3 = /home = 20000 gb = ext4 or maybe xfs
part 5 = storage = the rest = ext4

(for some reason sda4 is only used for  extended/logical)

i know how to align a single entire disk partition with info i found here http://www.ocztechnologyforum.com/forum … post373226 but once more partitions are created the  fstab is altered and thus becomes mis-aligned. so, it might be helpful (possible?) to align four separate partitions as they are created or post created.

so, if i created the aforementioned partitions with fdisk or parted does anybody at all know the command line parameters to create and format all 4 partitions and alignment occurs?

i have gone over the man for fdisk but it remains a bit unclear;

will partitions 235 be automatically aligned if part 1 is aligned or will part 235 have to be resized to have a length of 0 at the respective partitions opening cylinder? i digress

anyway, fdisk setup creation for ssd suggestions very welcome and unless they are completely outlandish i'll give 'em a whirl.

thx

Offline

#2 2010-06-10 03:53:00

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: alignment and performance

This is interesting, I have thought about performance and order of the partitions. I am using a SATA drive though. Any tips?

I believe keeping the SWAP on the outside is better, and what else? Files that are accessed a lot should be on the outside so the drive head can reach it faster than moving to the inside of the drive?

Offline

#3 2010-06-10 04:26:03

onthejob
Member
Registered: 2007-10-19
Posts: 24

Re: alignment and performance

no particular rationale to my hd partition setup. i just use what i hopefully can pass on as logic (hahaha) i.e.
the boot partition is at the start of the disc because it's the first thing needed by the computer, so i put it at the start, which i believe may be helpful to alignment. it's noauto 0 0 in fstab so it's mounting is fleeting. root partition (2) is next to be accessed so it's the second partition to be accessed but by now /boot is umounted so /root effectively becomes the first mounted partition to be accessed. /home can only be accessed once root is mounted so partition 3 is i think is it's natural home. part 4 = my playground

i don't need swap. my computer use is not cpu/memory intensive (bar all this compiling). i have been monitoring swap for a few weeks and it has never been used... for me it is a waste of a partition. 4gb of memory seem more than adequate for my purposes without swap needed. instead, i'll go for a swap file on an existing active partition just in case.

i await correction on any number of points.

Last edited by onthejob (2010-06-10 04:38:31)

Offline

#4 2010-06-10 04:47:06

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: alignment and performance

I believe boot is placed at the start not because it comes first, but old machines could only read the boot partition on the first thousand or so sectors of the hd (is this correct, someone?!). I believe nowadays that is probably not even relevant, and you don't really need a boot partition in the first place, but some people like them.

I see root being placed high, and I can only guess it's because the closer to the outside of the head (on a SATA hd?) means the head moves less distance and thus reaches the data faster, and root being used to run the system it makes sense that it is accessed a lot, and thus the 'tiny' speed gain by less head traveling equals an overall speed boost or at least less stress on the HD.

I am a newbie myself, so if anyone can confirm or correct any of this that would be great.

Then again an SSD probably nulls everything I just said.

I am trying to whip up a good partition order myself.

edit:

PS, my use of terms like head/drive and sectors isn't to be taken too seriously, I am not sure if I have grasped the concepts correctly and I am probably using them incorrectly.

Last edited by Google (2010-06-10 04:59:11)

Offline

#5 2010-06-10 05:10:17

onthejob
Member
Registered: 2007-10-19
Posts: 24

Re: alignment and performance

just a quicky... i have placed boot on the 7th 10th 5th 11th or whatever partition on whatever location on whatever disc. i don't think it has much relevance. it is just horribly convenient to have boot always on part 1 so i know always where the damn thing is lol. the location of root however is a different matter!

there is a program called paragon alignment tool that works on win7 which i have used... i think there's a demo available. anyway, i formatted ssd with 4 ntfs partitions and installed doze on pre-formatted part 1 so it wouldn't create an extra partition and then used the paragon tool to align parts 2-4.
well bloze rocked after that, a new linux install on part 2 reformatted as ext4 blew the roof. unfortunately once ntfs on part 1 was reformatted to use a linux file system the whole thing shit itself and performance dived! what does bloze do that linux doesn't in the first sector????

Last edited by onthejob (2010-06-10 05:12:49)

Offline

#6 2010-06-10 05:44:52

rusty99
Member
Registered: 2009-03-18
Posts: 253

Re: alignment and performance

Google wrote:

I see root being placed high, and I can only guess it's because the closer to the outside of the head (on a SATA hd?) means the head moves less distance and thus reaches the data faster, and root being used to run the system it makes sense that it is accessed a lot, and thus the 'tiny' speed gain by less head traveling equals an overall speed boost or at least less stress on the HD.

Using diskinfo you can see the speed differences,

1st disk is WD 250GB RE3
2nd is WD 1TB Caviar Black

$ su -m root -c 'diskinfo -ctv ada0'
Password:
ada0
<snip>
Transfer rates:
        outside:       102400 kbytes in   0.908697 sec =   112689 kbytes/sec
        middle:        102400 kbytes in   1.019528 sec =   100439 kbytes/sec
        inside:        102400 kbytes in   1.584170 sec =    64640 kbytes/sec

$ su -m root -c 'diskinfo -ctv ada2'
Password:
ada2
<snip>
Transfer rates:
        outside:       102400 kbytes in   0.930910 sec =   110000 kbytes/sec
        middle:        102400 kbytes in   1.052179 sec =    97322 kbytes/sec
        inside:        102400 kbytes in   1.792023 sec =    57142 kbytes/sec

Offline

#7 2010-06-10 05:54:26

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: alignment and performance

How can I tell the inside/middle/outside when I partition?

Does it travel like this?

Outside
sda
sda1
sda2
Inside

edited:

Last edited by Google (2010-06-10 05:57:05)

Offline

#8 2010-06-10 06:15:39

rusty99
Member
Registered: 2009-03-18
Posts: 253

Re: alignment and performance

Yes, as long as you're not using extended/logical partitions that would be a good way to picture the layout.

Offline

#9 2010-06-10 06:17:20

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: alignment and performance

What if someone does use extended/logical and the other 3 primaries?

I assume the directionality is the same, but from the first partition down?

Last edited by Google (2010-06-10 06:45:42)

Offline

#10 2010-06-10 07:15:46

onthejob
Member
Registered: 2007-10-19
Posts: 24

Re: alignment and performance

so i assume that from the discussion so far that my partition layout is just about okay and my placement premise is more or less correct. . my original question stands... how does one align four primary partitions to each other?

Last edited by onthejob (2010-06-10 07:20:52)

Offline

#11 2010-06-10 08:32:54

rusty99
Member
Registered: 2009-03-18
Posts: 253

Re: alignment and performance

I would go with your original listing, pretty foolproof that way.

Offline

#12 2010-06-10 10:00:58

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: alignment and performance

This is how i've aligned my Intel X25-M:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
32 heads, 32 sectors/track, 152638 cylinders
Units = cylinders of 1024 * 512 = 524288 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x929cf67c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           2         513      262144   83  Linux
/dev/sda2             514        2049      786432   82  Linux swap / Solaris
/dev/sda3            2050       12289     5242880   83  Linux
/dev/sda4           12290      152638    71858688    5  Extended
/dev/sda5           12290      152638    71858672   83  Linux

Nr AF  Hd Sec  Cyl  Hd Sec  Cyl     Start      Size ID
 1 80   0   1    1  31  32  512       1024     524288 83
 2 00   0   1  513  31  32 1023     525312    1572864 82
 3 00  31  32 1023  31  32 1023    2098176   10485760 83
 4 00  31  32 1023  31  32 1023   12583936  143717376 05
 5 00  31  32 1023  31  32 1023       1024  143717344 83

It's based on assumptions / tips i've found on the net:
* use fdisk to partition in cylinders instead of sectors so that the partitions automatically align to cylinder boundaries. I've used fdisk -H 32 -S 32, obviously.
* partition with an alignment of at least 32-64kb (ideally to fit the erase block size) to minimize unnecessary writes. 32*32*512b gives you 524288b = 512k alignment which many assume is the erase block size of the intel ssds.
* If you use an extended partition you have to manually change the offset because it's set to 32 by default. Choose alignment *2 instead.
* When using 4k block size, tell ext4 to stripe times 128, so that the FS aligns to 512k, too.
Feel free to add and/or correct me, if i'm wrong.

But, badly aligned, well aligned, JFS, XFS, EXT4, BTRFS or even x86 vs x86_64 - I tried it all and you really don't _feel_ a difference. It always just feels very responsive and fast. I didn't bother with benchmarks, but hdparm -t always gave me ~250MBps.

Last edited by demian (2010-06-10 10:21:30)


no place like /home
github

Offline

#13 2010-06-10 11:24:20

onthejob
Member
Registered: 2007-10-19
Posts: 24

Re: alignment and performance

impressive demian. i'll try your suggested parameters and report back.

Last edited by onthejob (2010-06-10 11:31:16)

Offline

#14 2010-06-14 23:22:30

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: alignment and performance

there's a similar thread in the newbie corner:
http://bbs.archlinux.org/viewtopic.php?id=99036


no place like /home
github

Offline

#15 2010-06-15 09:57:32

onthejob
Member
Registered: 2007-10-19
Posts: 24

Re: alignment and performance

i am pleased to show you this;

[root@myhost ~]# hdparm -t /dev/sda

/dev/sda:
Timing buffered disk reads:  766 MB in  3.00 seconds = 255.22 MB/sec
[root@myhost ~]#

thx for the very useful info :-)

Offline

Board footer

Powered by FluxBB