"Misaligned partition" - Should I do repartition (how?)
Solution 1
There's two issues usually involved here. I think the main problem is that the physical sector size on the disk might be (say for example) 4096 bytes whereas the logical sector size is usually 512 bytes. Where the start of the partition is not at the beginning of the physical sector a discrepancy occurs with how the disk is read. This can mainly cause a performance problem on some machines with some drives. I don't believe it will actually cause any loss of data or similar problems, however I'm not a disk drive engineer.
The second issue is that Linux disk utilities and the ext file system in general seem to assume that partitions should line up with the cylinders on the hard drive. I've seen it written that if a cylinder extends past a cylinder boundary and the next partition starts in the same cylinder, data corruption could result. Sorry I've got no firm reference on this and google seems to be finding anything but information on cylinder alignment, but it had something to do with ext2/3/4 assuming that it could write to the end of a cylinder under certain circumstance.
Usually, I set up partitions with Gparted before I start the installation (gparted is on the LiveDVD) and then select how I want to use the partitions manually by selecting "do something else" when I get to that part of the installation. It's usually later that I realise that Gparted has left a few MB of unused space either at the end of the drive, or if I've set up the whole drive with Gparted, right at the end. Here's the exact example of the drive that I'm on at the moment. Note that I have two boot partitions of about 20Gb, with a the rest of the drive being an extended partition containing the swap partition and /home. Note the 2Mb of unallocated space right at the end of the extended partition. This was Gparted's doing, not mine. I've seen other disks that (for example) might have some unallocated space beteen the primary partitions or before the extended partition because the partitions were created at different times and with different programs.
Since it is only a few MB, and after reading the information about the potential problems, I usually let it be. If Gparted wants to take a belt and suspenders approach I'm quite happy to let it do so.
I suggest you boot off the LiveDVD/USB again and just resize the ext4 partition Ubuntu is on with Gparted. I think you'll find that Gparted will try to align the partition with the cylinders, and this should solve the problems for you. Don't bother re-installing unless the resize breaks the Linux boot in some way.
During my google searches I did find information about Gparted aligning to full MB figures, but this is not my experience. The amount of space left is more like a cylinder's worth, rather that something that denotes MB boundaries.
Solution 2
Fabricator4 is correct about the physical sectors of most modern disks being 4096 bytes in size, whereas logical sectors are 512 bytes in size. This can cause severe performance problems (but not data loss); see this article I wrote on the topic some time ago for details.
Old utilities aligned partitions on "cylinders" for reasons that were valid in the 1980s but that have no bearing today. Nonetheless, the practice continued in most Linux partitioning tools until a year or two ago. No filesystem should write outside the bounds of its containing partition, though, and AFAIK ext2/3/4 never had any sort of cylinder-alignment assumptions.
Today, some disk utilities produce false alarms about alignment problems under some circumstances, and I suspect that's what you're seeing. In particular, alignment of extended partitions is irrelevant. You need only be concerned about alignment of primary and logical partitions. To be 100% sure of what you've got, view your partition table with fdisk
(or parted
with sector-precise data, or gdisk
for GPT disks, which yours isn't). Check that all the primary and logical partitions begin on sector values that are multiples of 8. (The partition end values are irrelevant, as are the start values for extended partitions.) For instance:
$ sudo fdisk -lu /dev/sda
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x8e0cb6b5
Device Boot Start End Blocks Id System
/dev/sda1 63 20033054 10016496 27 Unknown
/dev/sda2 20033055 103699574 41833260 17 Hidden HPFS/NTFS
/dev/sda3 * 103699575 249907139 73103782+ 5 Extended
/dev/sda5 103699638 131781194 14040778+ 17 Hidden HPFS/NTFS
/dev/sda6 131781258 183992444 26105593+ b W95 FAT32
/dev/sda7 183992508 187076924 1542208+ 82 Linux swap / Solaris
/dev/sda8 * 187076988 187398224 160618+ 83 Linux
/dev/sda9 187398288 249907139 31254426 8e Linux LVM
This is an older disk that was partitioned with cylinder alignment, so you can see that a number of partitions do not begin on 8-sector multiples. This isn't a problem because it's an old disk that uses 512-byte physical sectors. If you see such a result, you should check with your disk's manufacturer to determine its status. Look for mention of Advanced Format, which is the marketing name for disks with 4096-byte physical sectors.
If you don't have an Advanced Format disk or if all your primary and logical partitions are properly aligned, you shouldn't worry about any complaints from Disk Utility.
Related videos on Youtube
Vipin Nair
Updated on September 18, 2022Comments
-
Vipin Nair over 1 year
My Excel sheet is as below:
Id Name Status 1 XYZ 2 ABC 3 BB 1 Yz
What I am trying to do is to write
Checked
in the status column whose Id is 1 from my C# application.I thought of doing this through Linq to Excel. But I am not getting anything positive in this direction.
Can anyone guide me properly.
Thanks.
-
Vipin Nair about 10 yearsThanks serv for your reply.I will look into other possibilites
-
Prasad Kanaparthi over 8 yearsWhy no submitchanges or save method available ?? Any alternatives for these please?