I have managed to get Gentoo running on both my laptop and desktop successfully (woo!) and am feeling confident enough to make myself an internal file/ssh/svn/git/web server. I've started ordering computer parts and just got my 2 kernel RAID-1 destined hard drives.

I ended up purchasing the Western Digital 1.5 Green drives (WD15EARS) which came with this lovely sticker warning that if you use XP, you need to run some utility because they're Advanced Format Drives. I did some research and this is a new shiny 4 KiB sector drive. Some additional links of interest:

The pitfall with the WD15EARS is that it does not report its nature to the OS, so it looks like a normal 512byte sector disk. hence the partitioning tools and mkfs do not automatically use 4k alignment - you have to take care of that manually. You have to verify that every layer you put on the disk (in my case GPT -> cryptsetup/LUKS -> LVM -> XFS/reiserfs/ext23) uses 4k sectors. Not just during install but every time you change something too. The kernel does not help you there at all yet (I even tried 2.6.34-rc6), I guess their improved 4k support means on a block driver level and probably also only for disks that report themselves as 4k disks too...

Assuming I'm doing a kernel RAID-1 and EXT 2/4, what steps am I going to have to make sure I don't mess up?

How do I make fdisk work sectors and not cylinders?
EDIT: Looks like -u might be what I want
I don't think I need/want cryptsetup/LUKS
Is there anything during the RAID-1 setup? I'm looking over the handbook and it doesn't seem to mention sectors. I also don't think I need LVM.
Is there anything to be mindful of during formatting with EXT2 and EXT4?
EDIT: -b 4096 I think will do it

just for my curiosity, are those disks really cheaper ? because except for price i don't get the point of using green disks that are slower than "normal" disks (not sure i read some users saying that, and it seems also logic, slower disk = less energy...), specially to build a raid-1.
I mean if you need speed, why choose slow disks?

And i don't take the green consideration in case, how can someone buy "green" disks to save the world and using gentoo that might be (i says might, but i think IS) the worst os to save the planet

The WD15EARS when I bought it, was the cheapest disk by WD (50€/TB whereas the cheapest blue is already 70€/TB). Pitfalls aside, it also fits my needs perfectly - regarding speed, my bottleneck is encryption anyways, but I'm not unhappy with the drive's speed, quite the opposite... I have another older 1TB green as external backup disk, which is slower...

parted align doesn't really work... at least it didn't for me for this drive.

I'm not sure whether you have to do anything special for RAID, since I'm not using RAID on the drive, sorry... for mkfs, for most filesystems you can specify the block size with an option (read the manpage), for partitioning, you can print the partition layout in 512b sectors and make sure that every partition starts at a 4k boundary.

just for my curiosity, are those disks really cheaper ? because except for price i don't get the point of using green disks that are slower than "normal" disks (not sure i read some users saying that, and it seems also logic, slower disk = less energy...), specially to build a raid-1.
I mean if you need speed, why choose slow disks?

And i don't take the green consideration in case, how can someone buy "green" disks to save the world and using gentoo that might be (i says might, but i think IS) the worst os to save the planet

Must have something i didn't get or some weird choice there.

The disks are relatively cheap, $90 for 1.5 TB but I was honestly going for lower power. Also I'm just streaming media to about 3-5 machines on my home network.. nothing too intense. Also, RAID-1 is mirrored, I think you're getting confused with RAID-0

With stable smartmontools-5.42 there was no line like Family and pointing to (AF) but now with the latest smartmontools-6.0. The reported logical/physical sectores are 512 anyway and likely to be wrong.
I had problem with that 2,5" drive inside an old Dreambox 7020S (some 2.6.9 kernel) using some SATA-PATA converter. When I/O was increasing or even about after 30 minutes playback the kernel had I/O-errors and no response anymore. So idea was that alignment could be bad for the AF.

So how should these drives be partitioned today? I repartitioned and formatted (ext3) the drive from my Gentoo box. Old partition table showed from fdisk -lu /dev/sdb: Start=1 End=1953520064, so probably not aligned.
So I read these links and tried the common tools fdisk, cfdisk and parted:

http://linuxconfig.org/linux-wd-ears-advanced-format
But using fdisk I can't choose starting sector 1, out of range. Same about 64. 2048 is possible but this would cost some unused space for bootloader I don't need on that drive. cfdisk starts from 63 or in maximizing mode 1. Both are not aligned to 8, so 'start MOD 8' is not 0. Finally I got it starting from 8 with fdisk expert menu, and moving "start of data" to 8.

http://johannes-bauer.com/linux/wdc/?menuid=3
What about the end? Some guides about AF say this should also be divisible by 8, but there it is said that at least for fdisk it should give MOD 8 = 7 because of the inclusive notation of end sector in fdisk.
Finally I have now this partition on fdisk:
Start 8 end 1953525167
..while cfdisk shows this as:
First Sector 0
Last Sector 1953525167
Offset 8
Length 1953525168

Is this aligned or not?
No matter I had the same crashes again after installing the drive into Dreambox 7020S again. This could also be a damaged SATA-PATA adapter. but the drive is working fine connected to my Gentoo box via USB->SATA->S-/P-ATA-adaptor->drive, so integrating the adapter into chain when copying back the 100G back after re-partitioning.

After all is this AF thing also part of the kernel? Do correctly aligned partitions work with old kernels? Do not-aligned partitions have problems with every kernel, not matter if recent or old?
AFAIK the recent libblkid only helps when using fdisk to make it align correctly. But how should libblkid do so if the device does not report sector size correctly but 512? At least recent smartmontools do know about the AF familiy by some database...

EDIT: Then what about raw formatting without partition table at all? If I have no need for more then one partition I usually even don't use partition table at all. But then there is no way to do alignment. The filesystem (here ext3) is of course already advised to have 4096 block size, but if it is not aligned to the physical ones there is no way like moving the partition to start at 8._________________ppc:PowerBook5,8 15"(1440)-G4/1.67,2G Ram|amd64:HP EliteBook 8560w,i7-2620M,16G Ram|amd64:Acer Z5610 (Core2QuadQ8200),8G Ram|amd64-prefix:OpenSuse
Lila-Theme

The issues are basically the same as they've been since Advanced Format disks first appeared. Software tends to use saner defaults today, though.

Quote:

I got a SAMSUNG SpinPoint M8:

I can't comment on that model specifically. Check with the manufacturer to learn if it's an Advanced Format model. If there are any doubts in your mind, though, you should assume that it is such a disk.

Quote:

I had problem with that 2,5" drive inside an old Dreambox 7020S (some 2.6.9 kernel) using some SATA-PATA converter. When I/O was increasing or even about after 30 minutes playback the kernel had I/O-errors and no response anymore. So idea was that alignment could be bad for the AF.

Misalignment on an Advanced Format drive is likely to result in consistently bad performance, not changes in performance over time. That said, I can't rule out the possibility that misalignment was at least part of your problem.

Quote:

So how should these drives be partitioned today?

Ensure that every partition begins on a sector that's a multiple of 8. That's it. Really.

Quote:

I repartitioned and formatted (ext3) the drive from my Gentoo box. Old partition table showed from fdisk -lu /dev/sdb: Start=1 End=1953520064, so probably not aligned.

If fdisk is showing a start sector of 1, then that's suspicious. Normally, the start sector of the first partition will be 63 or 2048. Other values are legal, but unusual. A start sector of 1 is most commonly associated with a GPT disk's protective MBR partition, which has a type of 0xEE. If that's what you're seeing, you should not use fdisk, since it doesn't support GPT. (Not yet, anyhow; apparently GPT support has been added to the development version, but AFAIK it's not yet been released.) Instead, use gdisk or parted on a GPT disk.

I disagree with that article. libblkid is not a panacea. Programs can link to libblkid for any number of reasons, and are not obligated to use any partition-alignment advice that the library makes. What's more, the last I checked, libblkid relied on the hard disk to tell the truth about its characteristics, and many disks lie about that, so it's not really reliable. As proof that it's possible to mess things up even with a tool that uses libblkid, consider this:

Now I've created a partition, switched back to sector display, and viewed the results: A partition that begins on sector 63, which is not properly aligned, despite the fact that fdisk uses libblkid.

Now, granted, in this example I had to jump through some hoops to get the program to do the wrong thing. It's not always that hard, though. For instance, fdisk only aligns its first partition automatically. If you start with a disk that already has one misaligned partition, subsequent partitions are likely to be misaligned, too.

[*]http://linuxconfig.org/linux-wd-ears-advanced-format
But using fdisk I can't choose starting sector 1, out of range. Same about 64. 2048 is possible but this would cost some unused space for bootloader I don't need on that drive. cfdisk starts from 63 or in maximizing mode 1. Both are not aligned to 8, so 'start MOD 8' is not 0. Finally I got it starting from 8 with fdisk expert menu, and moving "start of data" to 8.[/quote]

I don't see a date on the article to which you linked, and that's important, since the relevant Linux tools have changed since Advanced Format disks have arrived on the scene. Recent versions of fdisk start the first partition at sector 2048. Do not get hung up on the "lost" 1MiB of space! That amount of disk space is puny by today's standards. On your disk, for instance, it's 0.0001% of your available disk space! GRUB will also use at least some of that space, at least if the disk is bootable via the BIOS version of GRUB.

The last I heard, cfdisk was the last holdout for the old-style cylinder alignment, which is likely to create problems. Don't use it.

Quote:

What about the end? Some guides about AF say this should also be divisible by 8, but there it is said that at least for fdisk it should give MOD 8 = 7 because of the inclusive notation of end sector in fdisk.

Don't worry about partition end points. The speed problems of misalignment are due to filesystem data structures being placed inoptimally relative to the physical sector sizes, and filesystem data structures are laid out relative to the start points of partitions. The end points are relevant only in determining the filesystem size. The worst that will happen if you set partition end points "incorrectly" is that the filesystem will be slightly smaller than the partition and you'll have a small gap between partitions. To minimize both these factors, set the partition end point to one sector less than the optimal start point for the next partition. This is easily done in most tools by specifying a partition size that's a multiple of 8 sectors. Using notation like "+200G" in fdisk will do this, since that means 200GiB, which of course is a multiple of 8 sectors (4KiB).

Quote:

Finally I have now this partition on fdisk:
Start 8 end 1953525167
..while cfdisk shows this as:
First Sector 0
Last Sector 1953525167
Offset 8
Length 1953525168
Is this aligned or not?

The fdisk output suggests that it is, but the cfdisk output is less clear. I'd be inclined to trust fdisk rather than cfdisk. OTOH, starting the partition at sector 8 means that you probably won't be able to install BIOS-mode GRUB on the disk, which may be undesirable. I recommend changing the layout to start at sector 2048 instead, which is the default. This also has the advantage that you're not doing weird things with fdisk to override its defaults, which are sane, at least when you start a new partition table on the disk. Note that I (deliberately) created a non-optimal layout by overriding those defaults.

Quote:

After all is this AF thing also part of the kernel?

Not really. Alignment is a hardware issue within the hard disk, and is independent of kernels and OSes. You need to worry about it when using partitioning software -- a fact that disk manufacturers gloss over in favor of inaccurate generalities like "it's all OK if you use Windows Vista or later."

Quote:

Do correctly aligned partitions work with old kernels? Do ot-aligned partitions have problems with every kernel, not matter if recent or old?

The answer to both questions is "yes"; however, it's conceivable that a kernel might include features to minimize the problems associated with mis-aligned partitions. I don't know offhand if any Linux kernel includes such features, though.

Quote:

AFAIK the recent libblkid only helps when using fdisk to make it align correctly. But how should libblkid do so if the device does not report sector size correctly but 512? At least recent smartmontools do know about the AF familiy by some database...

If the disk lies, then there are only two ways libblkid or any software can deal with it: By incorporating a mammoth disk device database or by assuming that all disks are Advanced Format disks. As I said earlier, too, you should not assume that something using libblkid will handle things right in all cases. On the flip side, you shouldn't assume that something that does not use libblkid will do the wrong thing. My own gdisk program, for instance, doesn't use libblkid, but it aligns to 2048-sector multiples by default, and for all partitions. (There are exceptions in gdisk involving small disks with existing partition tables that use different alignment, though.) I looked into libblkid some time ago, and I just didn't see anything that was really beneficial to gdisk.

Quote:

EDIT: Then what about raw formatting without partition table at all? If I have no need for more then one partition I usually even don't use partition table at all. But then there is no way to do alignment. The filesystem (here ext3) is of course already advised to have 4096 block size, but if it is not aligned to the physical ones there is no way like moving the partition to start at 8.

If you put a filesystem directly on the disk device, then it is effectively the same as using a partition that begins at sector 0, which is properly aligned. That said, I don't recommend using a disk in that way; it's non-standard, and a badly-written disk utility might become confused and do something Really Bad. I can't cite a specific example of such problems right now, but the mere possibility is enough for me to advise against this use, since using a standard MBR or GPT partitioning scheme is easy, and aligning partitions for same is easy. If you can divide by 8 and check for a remainder, you can do it.

The bottom line is this: Ensure that every partition (with the exception of any extended partition you might create) begins on a sector value that's a multiple of 8. Ignore libblkid. Ignore the end sector value. Don't jump through a lot of hoops to override the partitioning software's defaults unless those default violate the one important rule (multiple-of-8 start points) -- and if a program does violate that rule, you should upgrade it or ditch it. Your quest for knowledge is admirable, but you're over-analyzing the problem. It's really not that hard.

The pitfall with the WD15EARS is that it does not report its nature to the OS, so it looks like a normal 512byte sector disk. hence the partitioning tools and mkfs do not automatically use 4k alignment - you have to take care of that manually. You have to verify that every layer you put on the disk (in my case GPT -> cryptsetup/LUKS -> LVM -> XFS/reiserfs/ext23) uses 4k sectors. Not just during install but every time you change something too. The kernel does not help you there at all yet (I even tried 2.6.34-rc6), I guess their improved 4k support means on a block driver level and probably also only for disks that report themselves as 4k disks too...

So next question... Do the WD Caviar Red drives properly report that they're Advanced Partition drives?
If they report properly, it sounds like the tools will "Just Work (TM)"?
Is one partitioning tool safer to use than others? I seem to get here a descending Advanced Partition reliability order of parted, fdisk, cfdisk._________________.sigs waste space and bandwidth

So next question... Do the WD Caviar Red drives properly report that they're Advanced Partition drives?
If they report properly, it sounds like the tools will "Just Work (TM)"?
Is one partitioning tool safer to use than others? I seem to get here a descending Advanced Partition reliability order of parted, fdisk, cfdisk.

Just do the math! Dividing a sector number by 8 with a pocket calculator (or desktop app equivalent) is not hard!