Jump to content
Corsair Community

Dual Boot Linux/Windows 7 SSD Alignment Confusion


jasn

Recommended Posts

I have been trying to align the partitions on my SSD for a dual boot (Linux/Windows 7) configuration, and I keep running into a disk geometry corruption problem. I started with Theodore Ts'o's blog post on aligning SSDs, and I figured if I simply followed Ted's suggestions to start fdisk with the -H 224 -S 56 geometry parameters, (so I can align on 128k boundaries for my Corsair P256 SSD), and then create all of my Linux and Windows partitions, that I would be set. I don't want to use LVM. I just want to partition the drive statically for both OSes, (like I've done in the past). So I created the following partitions;

 

/dev/sda1 - 32M for /boot

/dev/sda2 - 35G for my Windows 7 OS

/dev/sda3 - 55G for my Windows 7 Data

/dev/sda4 - (rest of drive for extended partition)

/dev/sda5 - 4G for my Linux swap partition

/dev/sda6 - rest of drive for my Linux root partition

 

Creating the partitions using fdisk works fine, and if I do a fdisk -l right after I'm done, I see the geometry reported correctly as 224 heads, and 56 sectors. I even do all of my mkfs/mkntfs/mkswap steps, from the SystemRescueCD, after partitioning, and fdisk -l still reports the geometry and partitions correctly. My problem is that when I reboot to do my directed Windows 7 install to /dev/sda2, (no partitioning and no formatting), after I reboot to the SystemRescueCD again, to begin my Linux install, I find that the disk geometry has been corrupted by the Windows installation. When I look at the disk again with fdisk -l, it reports that the drive geometry is now the default 255 heads and 63 sectors, and that partitions do not end on cylinder boundaries. Like this;

root@sysresccd /root % fdisk -l

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf7c8e09a

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           4       31332   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2   *           4        4574    36703744    7  HPFS/NTFS
/dev/sda3            4574       11754    57677312    7  HPFS/NTFS
Partition 3 does not end on cylinder boundary.
/dev/sda4           11754       31131   155645952    5  Extended
Partition 4 does not end on cylinder boundary.
/dev/sda5           11754       12277     4202212   82  Linux swap / Solaris
/dev/sda6           12277       31131   151443684   83  Linux

When I look at the drive with the original fdisk geometry parameters, it shows up as;

root@sysresccd /root % fdisk -H 224 -S 56 -l   

Disk /dev/sda: 256.1 GB, 256060514304 bytes
224 heads, 56 sectors/track, 39869 cylinders
Units = cylinders of 12544 * 512 = 6422528 bytes
Disk identifier: 0xf7c8e09a

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           5       31332   83  Linux
/dev/sda2   *           6        5857    36703744    7  HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3            5858       15053    57677312    7  HPFS/NTFS
/dev/sda4           15054       39869   155645952    5  Extended
/dev/sda5           15054       15723     4202212   82  Linux swap / Solaris
/dev/sda6           15724       39869   151443684   83  Linux

This is happening exactly the same way on two different P256 SSDs in two different laptops. So after having manually partitioned the drive under Linux with fdisk, and then simply installed Windows 7, not only is the drive not reporting the correct geometry, it now reports that one, (or several), of the partitions do not end on cylinder boundaries. This is strangely reminiscent of the 2005 bug in Fedora Core 2 that caused the hard disk geometry as reported in the partition table to be altered during Linux installation, for dual boot (Fedora/XP) systems.

 

I also tried doing this from Windows. I booted the Windows 7 install disc, and then created all the same partitions as above with the Windows command line disk partition tool, diskpart.exe, (which defaults to a 1024K offset for the first partition). I then installed Windows 7, and then rebooted with the SystemRescueCD to install Linux, and fdisk -l again showed a geometry of 255 heads, 63 sectors, (which may or may not have been correct. I don't know how to check the geometry from diskpart), but also partition 1 not ending on a cylinder boundary. I've read this Microsoft Technet forum post that suggest that some Windows 7 users having problems with formatting floppy disks, because of Windows 7 corrupting the disk geometry. I don't know if this is related to that or not. Has anyone else seen anything like this?

 

BTW, the only way I was able to get through an SSD partition -> installation of Windows 7 -> and then an installation of Linux, without fdisk reporting corrupted disk geometries, was to start all over with fdisk, and partition the SSD with the default disk geometry parameters only, fdisk /dev/sda. In other words, run fdisk without any additional drive parameters.

 

Thanks..

Link to comment
Share on other sites

I already tried using the Windows 7 setup Customized Installation tool to set up my partitions, and it resulted in the same behavior I outlined in my post above. Regardless, I'm not asking for help in setting up my system. I believe that the Windows 7 installer is corrupting "non-standard" partition layouts, and I was curious if anyone has noticed this behavior as well. In my case, the Windows 7 installer clearly changed my custom partition setup of 224 heads and 56 sectors back to the default 255 heads and 63 sectors, which corrupted the existing partitions and the data in those partitions.

 

As I stated, the only way I could set up my dual boot system correctly was to boot with my SystemRescueCD and use Linux fdisk, to setup the partitions, and then install Windows 7 on its partition, followed by installing Linux on its partition. I could only do this by running fdisk without customized geometry thereby NOT aligning the partitions. Finally, what I mean by "setup correctly" is that when I run a partition tool like fdisk now, it doesn't burp out any warnings, and more importantly, I don't have any corrupted data in any partition.

 

If anyone has noticed these kinds of irregularities, or even successfully aligned their SSD partitions for a dual boot Linux/Windows setup, please feel free to share your experience.

 

Thanks..

Link to comment
Share on other sites

  • 4 months later...

In case anyone searching, finds this thread..

 

I was finally able to solve this issue, with information provided by the author, "Chuckula", at the blog posting here. My goal was to install both Gentoo Linux (64bit), as well as Windows 7 Pro, on a single SSD in my laptop, in a dual boot configuration, with the following partition layout;

 

/dev/sda1 - 32M for /boot

/dev/sda2 - 100G for my Windows 7 OS and Data

/dev/sda3 - (rest of drive for extended partition)

/dev/sda5 - 4G for my Linux swap partition

/dev/sda6 - rest of drive for my Linux root partition

 

Since I was upgrading my SSD, I decided to revisit this issue, and see if I could again figure out how to align the partitions correctly. So after reading the blog post, I started fdisk with;

fdisk -uc /dev/sda

and by using the "c" switch to switch off DOS-compatible mode, my first partition automatically started at sector 2048, and every subsequent starting partition offset sector number was divisible by 2048, just as mentioned in the blog post. Now the partitions are aligned correctly, and I was able to install both Windows 7 and Gentoo Linux 2.6.33 64-bit, on this single SSD, in a dual boot configuration, without issue. Now when printing out the partition map with fdisk using the "c" switch, like;

fdisk -ucl /dev/sda

it will print out the correct partition map as;

Disk /dev/sda: 512.1 GB, 512110190592 bytes
255 heads, 63 sectors/track, 62260 cylinders, total 1000215216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20139a42

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048       67583       32768   83  Linux
/dev/sda2   *       67584   209782783   104857600    7  HPFS/NTFS
/dev/sda3       209782784  1000215215   395216216    5  Extended
/dev/sda5       209784832   218173439     4194304   82  Linux swap / Solaris
/dev/sda6       218175488  1000215215   391019864   83  Linux

If I print the partition map with fdisk without the c switch, similar cylinder boundary error messages appear, as before;

Disk /dev/sda: 512.1 GB, 512110190592 bytes
255 heads, 63 sectors/track, 62260 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20139a42

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           5       32768   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2   *           5       13059   104857600    7  HPFS/NTFS
/dev/sda3           13059       62261   395216216    5  Extended
Partition 3 does not end on cylinder boundary.
/dev/sda5           13059       13581     4194304   82  Linux swap / Solaris
/dev/sda6           13581       62261   391019864   83  Linux

I just completed the initial installation, and I can boot to Linux or Windows without issue. I also haven't had any data corruption issues, and I've verified that TRIM is working under both Windows 7 and Linux 2.6.33 with the ext4 file system. It will still take me a few days to complete the entire configuration of DE, applications and tweaks, so if any additional issues crop up, I'll make sure to follow up with the thread, but so far it looks good.

 

Finally, something interesting is that when I went back and tried to use the Windows utility, diskpart, to partition the drive, the first partition also started at sector 2048. I'm currently using fdisk version 2.17.2 from the SystemRescue CD 1.5.2 now, and I think that what may have been happening here was more to do with fdisk, than the Windows OS. Maybe Windows was trying to align the partitions, but corrupting thingsand getting hung up with the fact that there was no more partition/space on the drive. "Chuckula" seemed to have some suggestions for Linux devs, towards the end of the blog, along the lines of making the Linux tools for SSD partition alignment friendly, so we'll see.

 

BTW, I did verify that my original dual boot SSD installation used unaligned partitions, which worked fine, except I was curious what kind of performance penalty I might be incurring. So I performed some benchmark testing on both aligned and unaligned NTFS partitions, on the same SSD, under Windows 7, with the AS SSD Benchmark utility, and although the aligned partition performed better, the differences in scores between aligned and unaligned partitions, were small. Here's an example;

Aligned Partition
AS SSD Benchmark 1.5.3753.27631
------------------------------
Name: CORSAIR CMFSSD-256GBG2D ATA Device
Firmware: VBM19C1Q
Controller: msahci
Offset: 1024 K - OK
Size: 238.47 GB
Date: 4/21/2010 9:33:43 PM
------------------------------
Sequential:
------------------------------
Read: 222.71 MB/s
Write: 164.00 MB/s
------------------------------
4K:
------------------------------
Read: 14.76 MB/s
Write: 5.81 MB/s
------------------------------
4K-64Threads:
------------------------------
Read: 28.73 MB/s
Write: 2.98 MB/s
------------------------------
Access Times:
------------------------------
Read: 0.370 ms
Write: 0.668 ms
------------------------------
Score:
------------------------------
Read: 66
Write: 25
Total: 128
------------------------------

Unaligned Partition
AS SSD Benchmark 1.5.3753.27631
------------------------------
Name: CORSAIR CMFSSD-256GBG2D ATA Device
Firmware: VBM19C1Q
Controller: msahci
Offset: 40162 K - BAD
Size: 238.47 GB
Date: 4/21/2010 10:00:53 PM
------------------------------
Sequential:
------------------------------
Read: 205.43 MB/s
Write: 107.90 MB/s
------------------------------
4K:
------------------------------
Read: 13.48 MB/s
Write: 5.01 MB/s
------------------------------
4K-64Threads:
------------------------------
Read: 24.51 MB/s
Write: 3.45 MB/s
------------------------------
Access Times:
------------------------------
Read: 0.278 ms
Write: 0.778 ms
------------------------------
Score:
------------------------------
Read: 59
Write: 19
Total: 109
------------------------------

These tests were run with a completely stock Windows 7 system, and these numbers are similar to the Samsung (MLC) numbers, (which is the Corsair P256 drive OEM), posted to the AS SSD Benchmark author's site, here, (scroll towards the bottom for the Samsung results).

 

Good Luck..

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...