Three months later I showed just what a non-story the whole thing was when I bought one of the new advanced format drives and correctly installed and used it under Windows XP. It took me a total of 10 seconds to ensure maximum performance of the drive by using the manufacturers tool to correctly align the partitions. Well it may have been a complete non-story but I seem to keep finding things to blog about it. So here is part III of the story.
I recently re-installed my machine and switched away from Windows to Ubuntu Linux. During the switch I moved all my data around to allow me to reformat all my drives to use ext4 rather than Microsoft's proprietary NTFS filesystem. For speed reasons I created the new partitions using the graphical Palimpsest utility and didn't really think about aligning the partitions manually. Palimpsest will correctly align partitions on advanced format drives but it assumes that the drive metadata will correctly report the physical sector size. Unfortunately the Western Digital Caviar Green drive that I have reports that it uses 512B clusters even though it actually uses 4K clusters. So Palimpsest used the information it was given and created badly aligned partitions. While annoying it turns out that manually creating aligned partitions is easy. The downside is that I couldn't find an easy way of doing it which didn't require a full format, so I had to empty the disk of data first.
So partly to continue the tale and partly as a reference so I don't have to figure this out again in the future here are the steps to create a single aligned partition on an advanced format drive.
WARNING: THESE INSTRUCTIONS WILL COMPLETELY DESTROY ANY DATA ON THE DISK.
Firstly you need to determine which device the disk you want to partition is available as. Palimpsest will tell you this or you could drop to a terminal and use
sudo fdisk -lto list information about all the drives connected to the machine. My drive was
/dev/sddso that is what appears in the following. Make sure you replace that with the correct device information for your machine or you may end up formatting the wrong drive -- you have been warned.
Now you have the device id we can use GNU Parted to create the actual partitions. I'm assuming that the drive is currently blank with no partitions. If this isn't the case then you may need to delete the existing partitions first. I'd originally hoped I could do all this with a single command but I kept having problems with Parted not liking some of the sector offsets unless I entered them in the interactive mode. So here is a record of the Parted session, I've made the commands I entered bold to make things easier to read.
If you don't understand what this does then you probably shouldn't be trying it yourself, but one number does need a little explaining. I set the start sector to 2048 based on the information from Western Digital about formatting these advanced format drives.user@machine:/$ sudo parted /dev/sdd GNU Parted 2.3 Using /dev/sdd Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) unit s (parted) mklabel msdos (parted) mkpart Partition type? primary/extended? primary File system type? [ext2]? Start? 2048 End? -1 (parted) print Model: ATA WDC WD15EARS-00M (scsi) Disk /dev/sdd: 2930277168s Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 2048s 2930277167s 2930275120s primary (parted) align-check optimal 1 1 aligned (parted) quit
Once you have a valid partition then it is easy to format it as follows...
So there you have it. Not quite as easy as using the Windows tool, but I think you will still agree a complete non-story from start to (hopefully) finish.user@machine:/$ sudo mkfs.ext4 /dev/sdd1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 91578368 inodes, 366284390 blocks 18314219 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 11179 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 37 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.