[opensuse] Re: Disk Drive Technology and partition alignment [WAS: ]Re: 12.3 + ntfs + ext4 + USB3 + different copying speeds
I do computer forensics for a living. I see lots of real world drives, but mostly windows. The first partition on most of them starts at sector 63 or 2048. 63 is from partitioning tools that try to align the first partition and believe the lie that the CHS data provides. Windows xp does that.
My drives were last formatted on linux to be win compatible, as I thought I might need the compat for some reason or another.
The larger drives weren't weren't setup for win compat and parted on suse chose 34 sectors -- not optimal.
I note that it now has 4 settings for alignment you can choose when creating a partition -- it doesn't say which is the default.
But options are 'none', 'min', 'optimal' and 'cylinder'.
So I wonder how optimal would differ from a cylinder -- but also how one optimizes RAID layouts in light of 'optimal' being a different (and not necessarily equal or not-equal) option from 'cylinder'.
2048 is what newer computers typically have. They no longer worry about tracks and just align to 1 MB boundaries. Vista and win7 do that.
--- Just looked at my Winbox... I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xf19ce566
Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT /dev/sda2 206848 1573070847 786432000 7 HPFS/NTFS/exFAT /dev/sda3 1573070848 1707288575 67108864 7 HPFS/NTFS/exFAT
------ I'd have to be in agreeance with you on that point -- with a conditional. The above is a 4 disk SSD-based RAID.... so it wouldn't have any cylinders to align on.
Linux partitioning tools in general got updated a couple years ago to default to MB alignment.
Likely right after my last partitioning. But they don't do the same thing as Windows -- at least not fdisk (not going to try with parted -- it does things in real-time on disk if I remember correctly... owie!)
My favorite tool for listing partition setups is mmls (it only outputs info since it is a reporting only tool). (Install sleuthkit it you want to use mmls).
--- Will have to check it out...
Thus it is clear that whatever default openSUSE partitioner is used during install does 1 MB alignment.
I'm nearly always the type that doesn't choose default.
I'm too particular (though many believe there there is no art, only 'e' with the 'i' coming laterl C`est la vie)
The rest of your email I'm going to ignore because it seems to be about how the tools report partitions, not how they create them.
--- Well .. those exact same tools were the ones that created them...
fdisk for the smaller stuff, parted for large and gpt partitions...
Now this is interesting... my current HD formatted by fdisk..the one that shows: /dev/sdc1 63 25398764 12699351 83 Linux /dev/sdc2 25398765 42009974 8305605 83 Linux /dev/sdc3 * 42009975 44130554 1060290 83 Linux /dev/sdc4 44130555 284687864 120278655 5 Extended /dev/sdc5 44130618 60918479 8393931 82 Linux swap / Solaris /dev/sdc6 60918543 92389814 15735636 83 Linux /dev/sdc7 92389878 113370704 10490413+ 83 Linux /dev/sdc8 115475283 283242014 83883366 83 Linux
For the last partitions, I used some random GUI -- dunno which, but I first tried deleting sdc8 and recreating -- it wanted to put the new partition at 113372753 -- 13*19*109*4211 (WT*?) must be a cylinder boundary...
well put back /sdc8 the way it was and then tried 'n' again... then it said no more room.
then I toggled the dos-compat flag to 'yes', was able to create 3 more partitions .. I re-ordered the partition table to match physical layout (I didn't save this to disk). But now it showed: /dev/sdc1 63 25398764 12699351 83 Linux /dev/sdc2 25398765 42009974 8305605 83 Linux /dev/sdc3 * 42009975 44130554 1060290 83 Linux /dev/sdc4 44130555 284687864 120278655 5 Extended /dev/sdc5 44130618 60918479 8393931 82 Linux swap / Solaris /dev/sdc6 60918543 92389814 15735636 83 Linux /dev/sdc7 92389878 113370704 10490413+ 83 Linux /dev/sdc8 113370768 113372752 992+ 83 Linux /dev/sdc9 113372753 115473234 1050241 83 Linux /dev/sdc10 115473298 115475282 992+ 83 Linux /dev/sdc11 115475283 283242014 83883366 83 Linux /dev/sdc12 283242078 283244062 992+ 83 Linux /dev/sdc13 283244063 284687864 721901 83 Linux ----
1) when I created a default sector in fdisk, it skipped 992 sectors to create a partition it called 1GiB that it really rounded up by 1665 sectors.
2) next default was #13. at 721901 then it claimed no more space I set dos compat (now marked as deprecated) and I was able to create the 3 partitions 8 10 12 above...
So in non-dos compat (default mode), fdisk now looks like it defaults to cylinder alignment.
I installed the sleuthtools -- they don't like gpt partitions it seems: --- DOS Partition Table Offset Sector: 0 Units are in 512-byte sectors
Slot Start End Length Size Description 00: Meta 0000000000 0000000000 0000000001 0512B Primary Table (#0) 01: ----- 0000000000 0000000000 0000000001 0512B Unallocated 02: 00:03 0000000001 0000000001 0000000001 0512B GPT Safety Partition (0xee) 03: ----- 0000000002 0000000033 0000000032 0016K Unallocated 04: 00:00 0000000034 4294967328 4294967295 0001T Linux (0x83) 05: ----- 4294967329 23435673599 19140706271 0008T Unallocated ---- But look at how it shows that disk above I was exploring with fdisk:
DOS Partition Table Offset Sector: 0 Units are in 512-byte sectors
Slot Start End Length Size Description 00: Meta 0000000000 0000000000 0000000001 0512B Primary Table (#0) 01: ----- 0000000000 0000000062 0000000063 0031K Unallocated 02: 00:00 0000000063 0025398764 0025398702 0012G Linux (0x83) 03: 00:01 0025398765 0042009974 0016611210 0007G Linux (0x83) 04: 00:02 0042009975 0044130554 0002120580 0001G Linux (0x83) 05: Meta 0044130555 0284687864 0240557310 0114G DOS Extended (0x05) 06: Meta 0044130555 0044130555 0000000001 0512B Extended Table (#1) 07: ----- 0044130555 0044130617 0000000063 0031K Unallocated 08: 01:00 0044130618 0060918479 0016787862 0008G Linux Swap / Solaris x86 (0x82) 09: Meta 0060918480 0092389814 0031471335 0015G DOS Extended (0x05) 10: Meta 0060918480 0060918480 0000000001 0512B Extended Table (#2) 11: ----- 0060918480 0060918542 0000000063 0031K Unallocated 12: 02:00 0060918543 0092389814 0031471272 0015G Linux (0x83) 13: Meta 0092389815 0113370704 0020980890 0010G DOS Extended (0x05) 14: Meta 0092389815 0092389815 0000000001 0512B Extended Table (#3) 15: ----- 0092389815 0092389877 0000000063 0031K Unallocated 16: 03:00 0092389878 0113370704 0020980827 0010G Linux (0x83) 17: ----- 0113370705 0115475282 0002104578 0001G Unallocated 18: Meta 0115475220 0283242014 0167766795 0079G DOS Extended (0x05) 19: Meta 0115475220 0115475220 0000000001 0512B Extended Table (#4) 20: 04:00 0115475283 0283242014 0167766732 0079G Linux (0x83) 21: ----- 0283242015 0284688383 0001446369 0706M Unallocated
--------------------
Lots of unallocated 'holes' used to line things up on what appear to be cylinder boundaries... but that's really just a guess... sure ain't based on integer values of MB GB or such...
If you want me to test any particular partitioner, just ask. That 1.5 TB external is a scratch drive. I can use dd to wipe the partition table and then use whatever tiool you want to create new partitions. I don't know which have been updated to default to 1 MB alignment, but I hope most have by now.
-----
Well -- the standard one's I use are fdisk and parted... I'd be curious about those whenever... ;-)
Per the NEWS file in /usr/share/doc/packages/parted: == * Noteworthy changes in release 2.2 (2010-02-26) [stable] ** Changes in behavior The default alignment (--align option) for newly created partitions has been changed to optimal. == What it doesn't say is what "optimal" means.
Though I must say, with parted, it says you can choose 'optimal', which lets the disk tell you where to put things... so maybe the disks are telling SW 1MB?
No, 1MB is the default unless there is a specific reason not to use it. (see below for full detail).
you might try parted w/the different alloc mechanisms -- if you are interested as well, that is... otherwise, I'll find out next time I do partitioning... ;-)
parted -a none => 0% start gives sector 1 as starting sector parted -a min => 0% start gives sector 1 as starting sector parted -a opt => 0% start gives sector 2048 as starting sector parted -a cyl => 0% start gives sector 63 as starting sector Per hdparm the drive is reporting: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63 So a modern parted only uses the sectors/track info if you specifically tell it to via "-a cyl". And what I'm very positive about is a modern 100+ GB rotating drive has more than 63 sectors/track. My calculation shows it is actually much closer to 2000 sectors per track. The only reason the drive returns the above CHS values is the spec for reporting CHS values was laid out in the 1980's and the above numbers are the maximum counts they can report. That is why I say cylinder alignment in 2013 is a figment of your imagination for rotating disks. As to what "parted -a opt" does I think you said you're a c programmer, so I grabbed the source and it tries to use PED_DEFAULT_ALIGNMENT unless there is a reason not to and PED_DEFAULT_ALIGNMENT is 1MB. In particular it looks to see if 1MB is a multiple of both min_io and optimal_io. If so it uses 1MB. If not it uses other logic. optimal_io for a raid array can be a stride I believe. So I agree with you that for a raid array that has optimal_io set, 1MB is not the default, but for single drives whether they be rotating or SSD I'm pretty sure 1MB will be used. The key source code is (note the first comment): include/parted/parted.h:#define PED_DEFAULT_ALIGNMENT (1024 * 1024) and == static PedAlignment* linux_get_optimum_alignment(const PedDevice *dev) { blkid_topology tp = LINUX_SPECIFIC(dev)->topology; if (!tp) return NULL; /* When PED_DEFAULT_ALIGNMENT is divisible by the *_io_size or there are no *_io_size values, use the PED_DEFAULT_ALIGNMENT If one or the other will not divide evenly, fall through to previous logic. */ unsigned long optimal_io = blkid_topology_get_optimal_io_size(tp); unsigned long minimum_io = blkid_topology_get_minimum_io_size(tp); if ( (!optimal_io && !minimum_io) || (optimal_io && PED_DEFAULT_ALIGNMENT % optimal_io == 0 && minimum_io && PED_DEFAULT_ALIGNMENT % minimum_io == 0) || (!minimum_io && optimal_io && PED_DEFAULT_ALIGNMENT % optimal_io == 0) || (!optimal_io && minimum_io && PED_DEFAULT_ALIGNMENT % minimum_io == 0) ) { /* DASD needs to use minimum alignment */ if (dev->type == PED_DEVICE_DASD) return linux_get_minimum_alignment(dev); return ped_alignment_new( blkid_topology_get_alignment_offset(tp) / dev->sector_size, PED_DEFAULT_ALIGNMENT / dev->sector_size); } /* If optimal_io_size is 0 and we don't meet the other criteria for using the device.c default, return the minimum alignment. */ if (blkid_topology_get_optimal_io_size(tp) == 0) return linux_get_minimum_alignment(dev); return ped_alignment_new( blkid_topology_get_alignment_offset(tp) / dev->sector_size, blkid_topology_get_optimal_io_size(tp) / dev->sector_size); } #endif ======== Hope you find the above convincing, Greg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, 2013-04-04 at 17:43 -0400, Greg Freemyer wrote:
Per hdparm the drive is reporting: Logical max current cylinders 16383 16383 heads 16 16 sectors/track 63 63
It obviously does not have 16 heads, because that's something you can see instantly if you open up a disk. The manufacturer specs say the actual number of platers the disc has (some disks may have a side of a plater unused: that's how they change disk sizes for models of the same series). I have seen 1 or 2, perhaps 4. But 8 in a an enclosure 1 inch thick, impossible. So those numbers above are made up, as you say. If the head count is false, so are the rest. They are just made up so that the multiplication gets the right number of sectors, for obsolete software that require them. - -- Cheers, Carlos E. R. (from 12.1 x86_64 "Asparagus" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAlFeO+EACgkQtTMYHG2NR9WAxgCbBXeX9rG7nyCoNJw4JRi1AF0s 0hEAnRkqd3Y/Xaqa7YAdT4WF56QuMrvf =mdtq -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Carlos E. R.
-
Greg Freemyer