Re: Disk partition alignment

Marcos Felipe Rasia de Mello <[email protected]>
Newsgroups gmane.comp.security.ipcop.devel
Message-ID <[email protected]>
>> The right way to force the old aligment is parted's "-a cylinder"
>> option. With the option, start of the first partition can be
>> represented by 0% and parted will put it in sector 63.
>>
> Why not simply use the 2048 sector shift?

When you use "-a cylinder", parted use by default cylinder as unit.
There are various ways: 0%, 0 (partition will start at the first
cylinder, or sector 63), 63s. If you keep the beginning of the first
partition at sector 63, I think you should use "-a cylinder", so the
second partition will *also* be cylinder aligned.

Without "-a cylinder", the default unit is megabyte. To have the MiB
alignment in the first partition, sure you can use "2048s", "1MiB",
works too.
Today (parted 2.3), both MB and MiB units are treated the same way,
with parted rounding the start/end sectors based on the chosen
alignment. Future parted 2.4 will change that and IEC units will be
treated literally, with no rounding, no matter whether start/end
sectors agree with the alignment or not [1]. Consider - except for 1st
partition start - switching MiB to MB to avoid that when IPCop update
Parted to version 2.4 (still not released).

>
>> Maybe is a good idea IPcop fallow all major Linux distributions. All
>> of them use the MiB aligment now. Just replace "63s" by "0%" and it's
>> done. But there are reports of very broken BIOSes that refuses to boot
>> with the MiB alignment. Taking into account that IPcop can run very
>> well with old PCs (more likely to has buggy BIOS), can be dangerous..
>>
> Anyway, we should think aligment requirement with SSD in mind.
> That would mean we may require an advanced setting with aligment on erase
> block boudaries (that vary greatly with disk model). I don't know if we have
> a way to read the erase block size somewhere.

SSDs, regarding the partitioning, I think just need the MiB alignment
and nothing more. SSDs manufacturers focus on Windows, and what
Microsoft does since Vista is the same thing Parted does since version
2.2 by default with 'optimal' alignment (version 2.1 had 'optimal'
alignment, but it was not default yet).

Other kind of optimization IPCop can use is the recent "discard" mount
option in EXT filesystems (for EXT3 was added in kernel 2.6.38), which
send realtime ATA TRIM commands to the drive to mantain it, in theory,
always in good shape, with enough free sectors. However, firmware
implementation does not perform very well o some SSDs [2] and some
devices doesn't need trimming at all [3]. util-linux 2.19 has a new
tool called "fstrim" (requires kernel 2.6.36 or newer because FITRIM
ioctl) [4] to do a trim pass manually if desired. hdparm's wiper.sh
script appears to be a workarround for older kernels.

Cylinder alignment is pure legacy (quoting David Miller on old
IDE-subsystem kernel drivers).
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/3259
http://article.gmane.org/gmane.comp.gnu.parted.devel/3478

Too bad some BIOSes are evil...
http://article.gmane.org/gmane.linux.ide/45294
https://wiki.ubuntu.com/LucidLynx/ReleaseNotes#Partition%20alignment%20changes%20may%20break%20some%20systems

[1] http://git.debian.org/?p=parted/parted.git;a=commit;h=552805a03a79f7b6badaf26536d86db580360f98
[2] http://lwn.net/Articles/347511/
[3] http://article.gmane.org/gmane.comp.file-systems.ext4/19947
[4] http://article.gmane.org/gmane.linux.utilities.util-linux-ng/3695

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.