Premium
Datum registracije: Nov 2005
Lokacija: NA
Postovi: 2,620
|
ma zapravo stvar za krajnjeg korisnika je super jednostavna:
Citiraj:
This guide will show you how to set up general alignment for use with Linux.
Tweaking some of the values used will yield different results.
Background information
SSDs work fastest if partitions are properly aligned. For the
Vertex drive, an alignment size of 64KB (128 sectors) has
been proposed in this forum.
On the other hand, since write operations to an SSD
always affect a whole erase block, it makes sense to
align to the erase block size, which is 512KB for OCZ Vertex.
Note that a 512KB aligned drive is also 64KB aligned,
because 512KB is a multiple of 64KB.
In the following, I will therefore assume that you want
a 512KB alignment; other possible alignment sizes
are discussed later.
Since the first partition cannot start at 0, minimal loss
of capacity is obtained if the first partition starts at the
first 512K position instead.
To achieve this, 512KB must be a multiple of the cylinder size
(at least if the partition is to start at a cylinder boundary,
which is probably a good idea).
It is convenient to use 512KB directly for the cylinder size
- then all partitions except for the first one are automatically
512KB aligned (with other sizes you might have to calculate).
We obtain cylinders with 512KB size by using 32 heads and
32 sectors/track (see table below).
The first partition needs special treatment because it is
automatically shifted by one track if you do not intervene.
This can be done in fdisk expert mode, but I have noticed that
you obtain the same effect if you simply let the first partition
start at cylinder 2 instead of cylinder 1. You do not need the
expert mode in this case, so I adopt this method for simplicity.
Step-by-step guide
In the following I will show the necessary steps for creating
a linux partition (type 83) with 512KB alignment using fdisk.
If you have no Linux system installed yet, start from a Live CD
or use the "rescue system" option that comes with some
distributions to get a Linux command prompt.
The following commands are prefixed by sudo because they
require superuser privileges.
Code:
$ 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.
Basically, fdisk is started with correct -H and -S options. Then "o"
creates a new partition table, "n" creates the partition, "t" sets the
partition type, and "w" writes everything to disk.
Verify result
Let's first check if the intended geometry is stored correctly:
Code:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 8237 MB, 8237408256 bytes
32 heads, 32 sectors/track, 15711 cylinders
Units = cylinders of 1024 * 512 = 524288 bytes
Disk identifier: 0x8cb3d286
Device Boot Start End Blocks Id System
/dev/sda1 2 15711 8043520 83 Linux
As you can see, the geometry (32 heads, 32 sectors/track) has been stored as intended.
The cylinders also have the intended size (1024 * 512 Bytes = 512KB).
Now let's check the alignment:
Code:
$ 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
If you call fdisk with the -u option, positions are shown in sectors.
Each sector has 512 byte. You can see from the output of fdisk -lu
that the first partition is indeed 512KB aligned (1024 * 512 Byte = 512KB).
Moreover, only 512KB at the beginning of the drive are wasted.
Other alignment sizes
It is not necessarily so that you get best performance with a 512KB
alignment. If you want to align to a 64 KB (128 sectors) alignment size
instead (as suggested in this forum for Windows), then using
fdisk -H 8 -S 16 /dev/sda will result in the 64KB cylinder size appropriate
for 64KB alignment. For other alignment sizes, you can look up suitable
-H and -S values for fdisk in b2bde4's Cylinder alignment table.
Apart from the different options for fdisk, stick to the above description.
|
i tablica koja ce vam pomoci da odaberete broj glava(heads) i sektora/traci (sectors/track) koji odgovaraju vasemu disku:
Code:
1024K (x2)
-S 16 -H 128
-S 32 -H 64
512K (x1)
-S 8 -H 128
-S 16 -H 64
-S 32 -H 32
256K (x0.5)
-S 4 -H 128
-S 8 -H 64
-S 16 -H 32
-S 32 -H 16
128K (x0.25)
-S 2 -H 128
-S 4 -H 64
-S 8 -H 32
-S 16 -H 16
-S 32 -H 8
dakle iz tablice odaberete S i H vrijednosti i koristite gornji vodič DOSLOVNO.
ako odaberete da vam erase block(ovo ovisi o vasemu ssd-u) bude jednak veličini cilindra (128k...512K itd) iz gornje tablice onda je doslovno NEMOGUCE dobiti disk koji ce biti neporavnat. Naravno VRLO VAZNO je da se prvi cilindar ostavi prazan jer on sadrzi prvi sektor koji je MBR kod diskova koji ga sadrze (vjerojatno ga svi imate jer svi koriste SSD za boot). ovim postupkom se izgubi samo 512K prostora na disku, ali je za uzvrat SVAKA particija poravnata bez obzira kojim alatom i kako je kreirate dok god se postuje pravilo da particija pocinje na pocetku cilindra (round to cylinders).
SVE ISPRAVKE SU DOBRODOŠLE
P.S. kako ce uvijek biti SW koji pravi sranje preporucio bi da ipak napravite i malu particiju od 1 cilindra na cilindru 2 da slucajno neki program ne pokusa ustediti prostor i krenuti s cilindrom 1. (naravno moze i bez ovoga, ali prva particija NESMIJE POČETI NA 1. cilindru)
dakle:
|cilindar1(sadrzi MBR(512B)na 1. sektoru) |cilindar2(da osiguramo poravnanje) |cilindar3...n(sve ostalo savrseno poravnato)
EDIT: zaboravio sam izvor  (post #97 i #98)
Zadnje izmijenjeno od: danij3l. 16.04.2010. u 16:09.
|