You are not logged in.

#1 2010-06-13 09:19:29

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

[SOLVED]A noob-proof way to properly align SSD [how?]

Hi. I'm fairly advanced in terms of Linux knowledge, but my knowledge is very scarce when it comes down to HDDs, SSDs, partitions, cylinders, boundaries, and block sizes, etc, etc. Black magic. I want to buy a Lenovo ThinkPad T410s laptop with 128GB SSD drive, and its erase block size (I know it's very important for proper aligning and is drive-dependent) will propably by 128KB. - I've found it somewhere while googling, it is supposed to be "G1" Intel SSD drive, if You know what it means (I, for instance, don't and don't care, since I am not planning any SSD replacement after buying the laptop)

I've found some tutorials for aligning SSD in Linux, but none of them is really noob-friendly.

This one:

http://thunk.org/tytso/blog/2009/02/20/ … lock-size/

Uses LVM, something I know nothing of and therefore want to avoid.

This one seemed nice:

http://blog.aloisiojr.com/?p=28

but at the end, it says:

And it's done. The next post will show how to install Ubuntu Jaunty using a customised mkfs.ext4 command.

and there is no blog post about that sad

And as a beginner in terms of SSD alignment I am asking You to help me by writing a noob-proof tutorial for aligning partitions and then tell me how can I install Ubuntu 10.04 on it. What is the Live CD's installer supposed to do, if all the aligning actions I want to take will be executed in CLI mode?

PS.: Please do not post me other tutorials, which seem barely helpful to me. I haven't yet found one which would be fully complete and exhaustive.

Thanks in advance!

Last edited by warnec (2010-06-14 19:19:14)

Offline

#2 2010-06-13 09:47:04

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Hi there,
it's actually very straightforward. Just use fdisk and start it with -H(eads) and -S(ectors) parameters. The partitions will be automatically aligned on cylinder boundaries.
http://www.ocztechnologyforum.com/forum … post373226
I wouldn't be so sure, if the erase block size of the x25-m is 128k:
http://forums.anandtech.com/showthread.php?t=2069082
I think an alignment of 512kb is a safe choice, as described in my first link.

Greets,
demian


no place like /home
github

Offline

#3 2010-06-13 11:49:24

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Great thanks for Your help. I've seen this topic on OCZ forums, but strangely didn't see that tutorial. I didn't read as far as 7 pages, propably.
(I know the first post aggregates all tutorials within that one topic, but didn't know how to jump to specific post number containing a desired tutorial)

Do you think it is possible to check if the erase block size is 512 or 128 KB when I buy the laptop and tear it apart to see the Intel's SSD?

And is this important? if 512/128 is 4, it shouldn't be a problem if I align the SSD to 512KB, right?

PS.:

In this guide:

http://www.ocztechnologyforum.com/forum … post373226

when the guy checks if his partition his aligned, that's his output:

$ sudo fdisk -lu /dev/sda

Disk /dev/sda: 8237 MB, 8237408256 bytes
32 heads, 32 sectors/track, 15711 cylinders, total 16088688 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x8cb3d286

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            1024    16088063     8043520   83  Linux

and judging from this post:

http://blog.aloisiojr.com/?p=28

Shouldn't it be so that both Start and End boundaries are divisible by the erase block size?

ex.

number of sectors*sector size/erase block size*1024= integer ?

for Start, assuming erase block size is 512KB, it is true:

(1024*512)/(512*1024)=1

but for End, it is:

(16088063*512)/(512*1024)=15 710.999!!


strangely though, whole block number seems to be aligned:

(8043520*512)/(512*1024) =7 855

Last edited by warnec (2010-06-13 14:36:02)

Offline

#4 2010-06-13 17:59:22

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

I believe i've seen that calculation on a microsoft page once. That you get integer values for start size and block amount only means that the author did it right. The end can be off as that only affects the last few kbs of a partition. What's important is that the start sector for each partition is correct.

There's no need for those calculations if you partition with CHS format.
The start sector will be automatically set to the correct value and the sectors will end at cylinder boundaries of a size specified by you.
The only thing important here is that the amount of sectors per cylinder is divisible by 8 so that it fits the page size (smallest amount of changeable information on flash memory) of the typical SSD (which is 4096bytes (=8*512)). If the cylinders aren't 4k aligned the SSD will need to perform two read/write/modify actions for a simple 4k write.
I guess the same principle applies to erase operations, just on a larger scale.
Just make sure to start partition 1 on cylinder 2 and skip one cylinder if you create an extended partition (eg if the extended partition starts at cylinder 12290, start the first logical partition at cylinder 12291). Of course you can also go into expert mode and just adjust the start sector if you don't want to miss a cylinder.

Last edited by demian (2010-06-14 23:30:00)


no place like /home
github

Offline

#5 2010-06-13 18:14:57

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Fine, so I'll just follow the step-by-step guide found on OCZ forums. Would that be OK if I made only 1 ~128GB partition for my whole / on cylinder 2, and that's it?

Or do I need to create some dummy 1GB partition for /boot, for example, and then fine-tune the start and end of my second ~127GB partition for /?

PS.: You said:

The only thing important here is that the amount of sectors per cylinder is divisible by 8

but here:

Disk /dev/sda: 8237 MB, 8237408256 bytes
32 heads, 32 sectors/track, 15711 cylinders, total 16088688 sectors
Units = sectors of 1 * 512 = 512 bytes

16088688/15711=1 024,03972


it's not divisible by 8.
and in order to achieve a closest number divisible by 8, 1024, the number of sectors would need to be subtracted by 624:

(16088688-624)/15711=1024

Is that what the author has done by omitting some sectors at the beginning (the partition starts at 1024) or the end?


And if 1023 blocks were omitted at the beginning (or 1024, if we count 0 in), the sector/cylinder calculation will be already <1024.

(16088688-1023)/15711=1023.9746
   
(16088688-1024)/15711=1023.97454

PPS.:
Im sorry for being such a pain in the ass, but I want to simply understand the whole situation, since it is quite important for SSDs.
And hey, it can be useful for fellow Linux googlers in the future wink

Last edited by warnec (2010-06-13 18:23:54)

Offline

#6 2010-06-13 19:23:53

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

The total amount of sectors is just the total of bytes divided by 512 (bytes per sector):
8237408256 bytes : 512 = 16088688.

The amount of sectors per cylinder is defined by the heads and sectors:
32*32*512=524288bytes per cylinder which is divisible by 8

the available space of 8237408256 bytes gets broken down into cylinders of a defined size each.
so with that 512k alignment you're actually using 15711(cylinders)*524288(sectors per cylinder)=8237088768bytes of the capacity.

The remaining 319488 bytes (312k) do not fill a (512k) cylinder and therefore, i believe, simply get ignored.

There's a very informative blog post by theodore ts'o about this whole alignment thing.

Last edited by demian (2010-06-14 19:24:03)


no place like /home
github

Offline

#7 2010-06-13 19:27:20

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Great! That explains my concerns.. Would you kindly answer the first question as well:

Fine, so I'll just follow the step-by-step guide found on OCZ forums. Would that be OK if I made only 1 ~128GB partition for my whole /  on cylinder 2, and that's it?

Or do I need to create some dummy 1GB partition for /boot, for example, and then fine-tune the start and end of my second ~127GB partition for /?

If you do, I think I'll be ready to make my new not-so-shiny (thanks to matte cover I love so much) ThinkPad rock! big_smile

Last edited by warnec (2010-06-13 19:28:02)

Offline

#8 2010-06-13 19:40:06

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Cheers to ThinkPad.
If you only need one partition you can skip the whole alignment thing altogether and just create a filesystem on eg /dev/sda instead of /dev/sda1.
But it works just as well if you create one big partition and let it start at cylinder 2.

Personally, i prefer a seperate /boot and /home. This is what my partition table looks like:

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: 0x12e50e55

 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

Disk /dev/sda: 32 heads, 32 sectors, 152638 cylinders
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         32  143717344 83

Obviously i forgot to adjust the start sector of the logical partition hmm.


no place like /home
github

Offline

#9 2010-06-13 19:51:38

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Well, as long as it's possible, I'd prefer to avoid the hassle of manual adjusting. I thought it is inevitable if one wants a well-maintained SSD drive.
So, to make a partitionless drive would it be enough to just execute:

sudo fdisk -H 32 -S 32 /dev/sda
sudo mke2fs -t ext4 -E stripe-width=128 /dev/sda

?

And that's it? I can then log in back to GUI ubuntu installer and install / there, and it'll boot normally after install&reboot?

What's the catch? (Is there any?)

Will it work fast and won't it have a bad impact on the drive's write times over a period of time, just as if I were aligning partitions manually?

Is this only a matter of personal taste, whether one wants to have separate partitons playing certain roles or not?

PS.:
Besides, what does separate /boot help You with? I always had either 1 partiton for / or 2 for / and /home.

PPS.:
Siehst du das Fußballspiel? Die Deutschen haben die Australiens vernichtet, oder? wink 4:0...

Last edited by warnec (2010-06-13 20:27:47)

Offline

#10 2010-06-13 21:32:45

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Yeah, the game was surprisingly nice.

I haven't used a block device that wasn't a partition as mount point yet. I guess it wasn't my place to suggest it.
But I've read on several occasions that without a partition table you don't have to worry about misalignment. Makes sense to me.
Perhaps an optimized alignment beats no alignment so for now I'd choose to create partitions.

I keep a seperate boot for
a) btrfs (grub can't boot from btrfs)
b) encryption purposes (although i skipped it with BTRFS i'm using now)
c) my modified grub2-gfxmenu which i like to keep no matter what i do with /

I like to experiment and it really makes things easier if you have a seperate /boot, /home and /var.


no place like /home
github

Offline

#11 2010-06-14 18:10:40

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Ok, I made up my mind: I'll simply make one big 128GB partition.

I just need to be sure about one last thing:

Is

sudo fdisk -H 32 -S 32 /dev/sda (choose first cylinder as 2, end cylinder as the default one)
sudo mke2fs -t ext4 -E stripe-width=128 /dev/sda1

all I need?

And if I execute the above commands from a, let's say, Ubuntu's LiveCD in CLI (Ctrl+Alt+F1, AFAIR) and then come back to GUI and reach the partitioning part, what do I do?
Do I need to go into "advanced partitioning" and point the 128GB ext4 partition as /, and that's it?

Offline

#12 2010-06-14 19:00:08

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

I'm not familiar with the Ubuntu install routine but in Arch Linux you skip points 3.3.1.3.1 and 3.3.1.3.2 (auto-prepare hard drives and manually partition hard drives) and go straight to 3.3.1.3 (manually configure block devices, file systems and mountpoints).
you define the mount points and when you get asked if you want to format the partition / create the filesystem you politely decline.


no place like /home
github

Offline

#13 2010-06-14 19:07:45

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

So, all I need to do is to assign /dev/sda1 to /, and not format it?

and is this:

sudo fdisk -H 32 -S 32 /dev/sda (choose first cylinder as 2, end cylinder as the default one)
sudo mke2fs -t ext4 -E stripe-width=128 /dev/sda1

correct?

I'm asking for the third time now, and I am starting to believe you are trying to deliberately avoid this question wink

Last edited by warnec (2010-06-14 19:08:13)

Offline

#14 2010-06-14 19:16:20

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Yes, that's correct.
Except i'd also set a label and the stride size:
mkfs.ext4 -L root -E stride=128,stripe-width=128 /dev/sda1.


no place like /home
github

Offline

#15 2010-06-14 19:18:55

warnec
Member
From: Poland
Registered: 2009-06-22
Posts: 166

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Great, thanks! big_smile

Looks like I got all my questions answered! Hope this helps fellow Googlers in the future!

We can considered the case closed.

wink

Offline

#16 2010-06-25 04:25:42

TomB17
Member
Registered: 2009-09-02
Posts: 102

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

I just partitioned/formatted my SSD using the information in this thread but I have to wonder if this level of specificity is necessary and/or beneficial.

Offline

#17 2010-06-25 07:40:59

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

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

I know that some SSDs of the first generation would perform much better with proper alignment (or would sometimes even "stutter" with bad alignment). So, for those, you might even call it necessary.
Other than that correct alignment is theoretically always beneficial at least to reduce wear. I don't think there's a proper way of measuring the wear besides with some manufacturer tools so I doubt there's much practical experience on how much exactly the wear will be reduced resp. how much longer your SSD will last, if you've created the partitions with correct alignment.
When you summarize it, it's really not much effort to properly align the drive, so why not just do it? wink

Last edited by demian (2010-06-25 07:48:27)


no place like /home
github

Offline

#18 2010-06-25 16:46:32

TomB17
Member
Registered: 2009-09-02
Posts: 102

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Thanks, demian.  cool

Offline

#19 2012-12-29 01:36:39

Musikolo
Member
Registered: 2008-11-10
Posts: 35

Re: [SOLVED]A noob-proof way to properly align SSD [how?]

Hi guys:

I have found what may be an easier way to align your partitions, but what's for sure it is a visual way to make it:
- http://lifehacker.com/5837769/make-sure … erformance

I hope it helps!

Offline

Board footer

Powered by FluxBB