Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is a physical 'sector' boundary?

787 views
Skip to first unread message

Tinker Tanker

unread,
May 20, 2011, 7:15:46 PM5/20/11
to

I just replaced a 320gb drive in a netbook by a 500gb one. Since the old
drive had been partitioned with the old fdisk using cylinders and the
new version of fdisk uses only sectors I booted an old install cd and
invoked the old fdisk to more or less duplicate the the old partitions
with the extra space taken up by a large data partition. All partitions
begin on a new cylinder number and all occupy at least two cylinders,
most of them thousands of cylinders.

Now when I run the new fdisk against both drives they show partitions in
terms of sectors (as expected). But almost every one of 15 partitions on
the new drive also gets a warning (I presume it is a warning)

"Partition X does not start on physical sector boundary."

Should I just ignore them?


Using the NEW fdisk-l command
=============================

Script started on Fri May 20 18:28:17 2011
Rescue:/ # fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x7b1fe1b9

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2611 20972826 7 HPFS/NTFS
/dev/sda2 2612 5223 20980890 83 Linux
/dev/sda3 5224 7835 20980890 83 Linux
/dev/sda4 7836 60801 425449395 5 Extended
/dev/sda5 7836 8097 2104483+ 82 Linux swap / S
/dev/sda6 8098 10708 20972826 83 Linux
/dev/sda7 10709 13319 20972826 83 Linux
/dev/sda8 13320 15930 20972826 83 Linux
/dev/sda9 15931 18541 20972826 83 Linux
/dev/sda10 18542 21152 20972826 83 Linux
/dev/sda11 21153 21155 24066 83 Linux
/dev/sda12 21156 21158 24066 83 Linux
/dev/sda13 21159 21161 24066 83 Linux
/dev/sda14 21162 58000 295909236 83 Linux
/dev/sda15 58001 60801 22499001 83 Linux

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x88e4097c

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2611 20972826 7 HPFS/NTFS
/dev/sdb2 2612 5223 20980890 83 Linux
/dev/sdb3 5224 7835 20980890 83 Linux
/dev/sdb4 7836 38913 249634035 5 Extended
/dev/sdb5 7836 8097 2104483+ 82 Linux swap / So
/dev/sdb6 8098 10708 20972826 c W95 FAT32 (LBA)
/dev/sdb7 10709 13319 20972826 83 Linux
/dev/sdb8 13320 15930 20972826 83 Linux
/dev/sdb9 15931 18541 20972826 83 Linux
/dev/sdb10 18542 21152 20972826 83 Linux
/dev/sdb11 21153 21155 24066 83 Linux
/dev/sdb12 21156 21158 24066 83 Linux
/dev/sdb13 21159 21161 24066 83 Linux
/dev/sdb14 21162 36164 120511566 83 Linux
/dev/sdb15 36165 38913 22081311 83 Linux


Using the NEW fdisk-l command
=============================
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x7b1fe1b9

Device Boot Start End Blocks Id System
/dev/sda1 * 63 41945714 20972826 7 HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.

/dev/sda2 41945715 83907494 20980890 83 Linux

Partition 2 does not start on physical sector boundary.
/dev/sda3 83907495 125869274 20980890 83 Linux
Partition 3 does not start on physical sector boundary.

/dev/sda4 125869275 976768064 425449395 5 Extended
Partition 4 does not start on physical sector boundary.

/dev/sda5 125869338 130078304 2104483+ 82 Linux swap / So
Partition 5 does not start on physical sector boundary.

/dev/sda6 130078368 172024019 20972826 83 Linux

/dev/sda7 172024083 213969734 20972826 83 Linux
Partition 7 does not start on physical sector boundary.

/dev/sda8 213969798 255915449 20972826 83 Linux
Partition 8 does not start on physical sector boundary.

/dev/sda9 255915513 297861164 20972826 83 Linux
Partition 9 does not start on physical sector boundary.

/dev/sda10 297861228 339806879 20972826 83 Linux
Partition 10 does not start on physical sector boundary.

/dev/sda11 339806943 339855074 24066 83 Linux
Partition 11 does not start on physical sector boundary.

/dev/sda12 339855138 339903269 24066 83 Linux
Partition 12 does not start on physical sector boundary.

/dev/sda13 339903333 339951464 24066 83 Linux
Partition 13 does not start on physical sector boundary.

/dev/sda14 339951528 931769999 295909236 83 Linux

/dev/sda15 931770063 976768064 22499001 83 Linux
Partition 15 does not start on physical sector boundary.


Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x88e4097c

Device Boot Start End Blocks Id System
/dev/sdb1 * 63 41945714 20972826 7 HPFS/NTFS/exFAT
/dev/sdb2 41945715 83907494 20980890 83 Linux
/dev/sdb3 83907495 125869274 20980890 83 Linux
/dev/sdb4 125869275 625137344 249634035 5 Extended
/dev/sdb5 125869338 130078304 2104483+ 82 Linux swap / So
/dev/sdb6 130078368 172024019 20972826 c W95 FAT32 (LBA)
/dev/sdb7 172024083 213969734 20972826 83 Linux
/dev/sdb8 213969798 255915449 20972826 83 Linux
/dev/sdb9 255915513 297861164 20972826 83 Linux
/dev/sdb10 297861228 339806879 20972826 83 Linux
/dev/sdb11 339806943 339855074 24066 83 Linux
/dev/sdb12 339855138 339903269 24066 83 Linux
/dev/sdb13 339903333 339951464 24066 83 Linux
/dev/sdb14 339951528 580974659 120511566 83 Linux
/dev/sdb15 580974723 625137344 22081311 83 Linux

David W. Hodgins

unread,
May 20, 2011, 7:42:34 PM5/20/11
to
On Fri, 20 May 2011 19:15:46 -0400, Tinker Tanker <nosuch@_invalid_no.gov> wrote:

>
> I just replaced a 320gb drive in a netbook by a 500gb one. Since the old

> Using the NEW fdisk-l command
> =============================
> Disk /dev/sda: 500.1 GB, 500107862016 bytes
> 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 4096 bytes

Note the drive is telling the os it uses a 4k sector size.
Is this a solid state drive?

> I/O size (minimum/optimal): 4096 bytes / 4096 bytes

If the partitions are not aligned on a 4k boundary, you'll find
very poor write speed.

When the os goes to write a 4k block, and it overlaps two sectors
on the drive, the drive's firmware has to read both sectors, merge
the changes, and then write both sectors.

If the drive is a solid state drive, you have to find out what
the "Erase Block Size" is, and align based on that size, or 4k,
whichever is larger. See
http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux

You should use a partitioning tool that allows you to align the
partitions properly, and ignore the old cylinder/track stuff that
is obsolete.

I haven't had access to any drives that report a 4k sector size,
so can't say for sure, exactly how to do that.

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)

Tinker Tanker

unread,
May 21, 2011, 4:37:49 PM5/21/11
to
On 05/20/2011 07:42 PM, David W. Hodgins wrote:
> On Fri, 20 May 2011 19:15:46 -0400, Tinker Tanker
> <nosuch@_invalid_no.gov> wrote:
>
>>
>> I just replaced a 320gb drive in a netbook by a 500gb one. Since
>> the old Using the NEW fdisk-l command
>> ============================= Disk /dev/sda: 500.1 GB, 500107862016
>> bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168
>> sectors Units = sectors of 1 * 512 = 512 bytes Sector size
>> (logical/physical): 512 bytes / 4096 bytes
>
> Note the drive is telling the os it uses a 4k sector size. Is this a
> solid state drive?

Dang, I should have picked up the old thread under Advanced Disk Format.


No, it's a magnetic 2.5" laptop drive. I should have read the decal on
the drive, it's now very deep inside the eepc ;-) It probably said
Advanced Format on it and I think it's a WD5000BPKT that I already had
when DanC suggested I just lose the lot ;-)

> You should use a partitioning tool that allows you to align the
> partitions properly, and ignore the old cylinder/track stuff that is
> obsolete. I haven't had access to any drives that report a 4k sector
> size, so can't say for sure, exactly how to do that.

I'll need to do whatever needs doing manually because I need as many
partitions as possible of one exact same size. Did that with fdisk until
now without a problem and never had any use for utils that don't give
precise levels of control like starting & ending or exact block size.


There's a lot of reading to do. For now I tried to set sector size to
4096. Why bother with 512 if the real one is 4096? But doing

fdisk -b 4096 gives

fdisk: unable to seek on /dev/sda: Invalid argument

What gives here? I'm telling fdisk to use a sector size equal to the
real sector size and it bombs?

On with the show, so I put that aside and tried to duplicate the
previous partitions using sectors instead of cylinders.

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 41947699 20972826 7 HPFS/NTFS/exFAT
/dev/sda2 41949184 83894835 20972826 83 Linux
/dev/sda3 83896320 125841971 20972826 83 Linux
/dev/sda4 125843456 976773167 425464856 5 Extended
/dev/sda5 125845504 130039807 2097152 82 Linux swap /
/dev/sda6 130041856 171987507 20972826 83 Linux
/dev/sda7 171991040 213936691 20972826 83 Linux
/dev/sda8 213940224 255885875 20972826 83 Linux
/dev/sda9 255889408 297835059 20972826 83 Linux
/dev/sda10 297838592 339784243 20972826 83 Linux
/dev/sda11 339787776 339789823 1024 83 Linux
/dev/sda12 339791872 339793919 1024 83 Linux
/dev/sda13 339795968 339798015 1024 83 Linux
/dev/sda14 339800064 934823959 297511948 83 Linux
/dev/sda15 934826008 976773167 20973580 83 Linux

That introduced an added benefit of being able to create more partitions
of one size than before (the small ones are just jacks to get to the #
of 14 which I need in many scripts). I haven't shown all this to cfdisk
or an older version of fdisk, I suspect there would be noises.

The latest fdisk will let me start partitions on the next sector but the
default it offers is like in the above. I suspect there may be some
alignment in there but can't really finger out the rationale, anyway
that would be needed only for SSD's, the speed issue is a derived
problem not a causal one.

One thing I'll have to devise is a bash cron to patrol and regularly
wipe all the unused sectors. There are so many of those that I really
fail to see the claimed space-saving feature of AdvancedFormat at all
with this going on, AND there now seems to be a countryside full of
places for malware to hide in!

Nor do I have any idea about the size of the offsets between the end of
partitions and the beginning of the next ones. These numbers are all
over the place fromm 1485 sectors to 3533. Most peculiar is the
difference between the start of the extended partition and the start of
the first logical which should coincide bang on the money but don't.


Tinker Tanker

unread,
May 21, 2011, 11:58:37 PM5/21/11
to
Here's a writ on AdvancedFormat @ WD:

http://wdc.custhelp.com/app/answers/detail/a_id/5655/~/how-to-install-a-wd-advanced-format-drive-on-a-non-windows-operating-system

According to the above I should make sure that all starting sectors and
partition sizes are divisible by 8 (partitions are expressed in 1k
blocks so those numbers should be divisible by 4).

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 46002047 23000000 7 HPFS/NTFS/exFAT
/dev/sda2 46002048 86002047 20000000 83 Linux
/dev/sda3 86002048 126002047 20000000 83 Linux
/dev/sda4 126002048 976773167 425385560 5 Extended
/dev/sda5 126004096 130198399 2097152 82 Linux swap
/dev/sda6 130200448 170200447 20000000 c W95 FAT32 (LBA)
/dev/sda7 170202496 210202495 20000000 83 Linux
/dev/sda8 210204544 250204543 20000000 83 Linux
/dev/sda9 250206592 290206591 20000000 83 Linux
/dev/sda10 290208640 330208639 20000000 83 Linux
/dev/sda11 330210688 330210695 4 83 Linux
/dev/sda12 330212744 330212751 4 83 Linux
/dev/sda13 330214800 330214807 4 83 Linux
/dev/sda14 330216856 934196631 301989888 83 Linux
/dev/sda15 934198680 976773167 21287244 83 Linux

Note that the primaries start on the next sector but logicals seem to
start with a 2048 offset each. Logicals starting on next sectors would
also be divisible by 8 in this case but fdisk will not let such values
be used (for some reason).

David W. Hodgins

unread,
May 22, 2011, 2:44:13 AM5/22/11
to
On Sat, 21 May 2011 23:58:37 -0400, Tinker Tanker <nosuch@_invalid_no.gov> wrote:

> Note that the primaries start on the next sector but logicals seem to
> start with a 2048 offset each. Logicals starting on next sectors would
> also be divisible by 8 in this case but fdisk will not let such values
> be used (for some reason).

My guess is that you've forgotten that each extended partition has one
"track" reserved for the partition table. You have to tell fdisk or
whatever partitioning program you're using, to use a track size of
4kb or a multiple of that (or the erase block size for ssd drives).

Go back to
http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux
where it tells you to use "fdisk -S 32 -H 32 /dev/sda". I don't agree
with the numbers mentioned there. As I don't have access to such a
drive, I can't confirm it works, but I'd try "fdisk -S 56 -H 224 /dev/sda",
as that results in a tracksize that is a multiple of 4096, yet keeps the
number of cylinders low enough for the mbr partition table.

A better alternative would be to switch to a guid partition table,
rather then a dos style partition table.
http://en.wikipedia.org/wiki/GUID_Partition_Table
For that, avoid fdisk, and use parted/gparted.

Tinker Tanker

unread,
May 22, 2011, 12:36:54 PM5/22/11
to
On 05/22/2011 02:44 AM, David W. Hodgins wrote:
> On Sat, 21 May 2011 23:58:37 -0400, Tinker Tanker
> <nosuch@_invalid_no.gov> wrote:
>
>> Note that the primaries start on the next sector but logicals seem to
>> start with a 2048 offset each. Logicals starting on next sectors would
>> also be divisible by 8 in this case but fdisk will not let such values
>> be used (for some reason).
>
> My guess is that you've forgotten that each extended partition has one
> "track" reserved for the partition table. You have to tell fdisk or
> whatever partitioning program you're using, to use a track size of
> 4kb or a multiple of that (or the erase block size for ssd drives).

Thanks for the detailed input, I didn't forget, I just never knew.
In the back of my mind there was some notion that part of the partition
table was parked there in the logical root but I always figured it was a
matter of maybe a single inline sector, something like for dos
partitions :-)

> Go back to
> http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux
> where it tells you to use "fdisk -S 32 -H 32 /dev/sda". I don't agree
> with the numbers mentioned there. As I don't have access to such a
> drive, I can't confirm it works, but I'd try "fdisk -S 56 -H 224 /dev/sda",
> as that results in a tracksize that is a multiple of 4096, yet keeps the
> number of cylinders low enough for the mbr partition table.
>

It's over my head!

"Linux' fdisk, however, still uses a virtual C-H-S system where you can
define any number of heads and sectors yourself (the cylinders are
calculated automatically from the drive's capacity), with partitions
always starting and ending at intervals of heads x cylinders. Thus, you
need to choose a number of heads and sectors of which the SSD's erase
block size is a multiple."

CHS is dead (or so I hear) so I think of the disk as of a tape. What
does it matter if a partition does or does not start on a virtual
cylinder since it's only virtual anyway? Isn't the only thing that
matters that the sector numbers be multiples of 8 (to get 4k sectors)
and that the theoretical 'pitchfork' size be the ssd erase block size?
These real requirements can be satisfied by juggling the starting and
ending sector numbers to arrive at whatever desired partition size.

Or do I have all this all wrong (wouldn't be a first time). Is the
purpose of tweaking the chs (fake) numbers to be able to partition
easily by using cylinders instead of humongous sector numbers? In other
words is the result something that just makes it a little easier?

What is a 4k 'boundary'? I thought boundaries were dividing lines that
cannot have any size.


I'll be happy to try things and report back but at this point I don't
understand what or how inputting those fdisk arguments is going to
change anything in my ability to get what I want as well as optimized
disk speed. This is not an ssd but I do need to apply the Advanced
Format approach to get just 'normal' speed out of it, otherwise it's
slower than a dead dog.

With just fdisk /dev/sda I get


255 heads, 63 sectors/track, 60801 cylinders

With fdisk -S 56 -H 224 /dev/sda it becomes
224 heads, 56 sectors/track, 77867 cylinders

I see no difference other than this. So next I ask for a partition and
it defaults to starting it at 2048. Next I input an ending sector of
46,002,047 to get (for lack of another need) exactly 23,000,000 blocks.
I end up with

/dev/sda1 * 2048 46002047 23000000

same as before. That seems like an acceptable partition because it
starts on a sector that is a multiple of 8 and the size is also a
multiple of 8. The next primary will start on the next sector, same as
before with no arguments.

David W. Hodgins

unread,
May 22, 2011, 1:58:24 PM5/22/11
to
On Sun, 22 May 2011 12:36:54 -0400, Tinker Tanker <nosuch@_invalid_no.gov> wrote:

> CHS is dead (or so I hear) so I think of the disk as of a tape. What
> does it matter if a partition does or does not start on a virtual
> cylinder since it's only virtual anyway? Isn't the only thing that

It's due to the dos style partitioning "standard".

The master boot record, occupies the first sector of the first track.
It contains the boot loader, and the primary partition table.

The rest of the first track is not used in dos/windows systems. With
grub, it uses (IIRC) the first 20 sectors after the mbr, with the
rest of the track left blank.

Each primary partition starts on a track.

The "extended partition defined in the primary partition table will
occupy one track.

Each logical partition has one track that contains a partition table
in it's first sector (same layout as the mbr), and has the actual
file system starting on the next tract. The partition table on the
first logical partition has two entries. The first points to the
filesystem on the next track (and contains the filesystem type),
while the second entry points to the next logical (extended)
partition (0 if this is the last logical partition).

If you run "sfdisk -l -uS -x /dev/sda", it'll show you all of the
logical partition tables.

While CHS is no longer used in the disk i/o, if you're using the
dos style partitioning, the "virtual track size" is still used
to figure out where to put/find the partitions.

With GUID partitioning, the dos style mbr record still exists
for compatibility, and it will show a single partition of 2TB,
so that dos style partitioning programs will not see any free
space. The GUID partition table only uses sector addresses,
and doesn't care about track sizes.

David W. Hodgins

unread,
May 22, 2011, 2:07:28 PM5/22/11
to
On Sun, 22 May 2011 12:36:54 -0400, Tinker Tanker <nosuch@_invalid_no.gov> wrote:

> What is a 4k 'boundary'? I thought boundaries were dividing lines that
> cannot have any size.

Sorry, forgot to answer this part in my prior reply.

What makes the tweaking necessary, is that for some reason I'm
not clear on, linux is still using a logical sector size of 512 bytes,
even though it knows the drive is using a 4kb physical sector size.

Since dos style mbr partitioning uses the so called "track size"
to decide where to put partitions, and given that each partition
table takes one track, the track size has to be 4kb, or a multiple
of that size, in order to guarantee that each filesystem will start
at the beginning of a physical sector.

If you can figure out how to get linux to use a logical sector size
of 4kb, then all of these problems go away. As I've never had access
to such a drive, I don't know how to do that.

Richard Kettlewell

unread,
May 22, 2011, 2:52:15 PM5/22/11
to
Tinker Tanker <nosuch@_INVALID_no.gov> writes:
> On 05/22/2011 02:44 AM, David W. Hodgins wrote:

>> Go back to
>> http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux
>> where it tells you to use "fdisk -S 32 -H 32 /dev/sda". I don't agree
>> with the numbers mentioned there. As I don't have access to such a
>> drive, I can't confirm it works, but I'd try "fdisk -S 56 -H 224 /dev/sda",
>> as that results in a tracksize that is a multiple of 4096, yet keeps the
>> number of cylinders low enough for the mbr partition table.

That's a ridiculous approach. Just use sector numbers, and (on this
kind of drive) make sure they're all multiples of 8.

> It's over my head!
>
> "Linux' fdisk, however, still uses a virtual C-H-S system where you
> can define any number of heads and sectors yourself (the cylinders are
> calculated automatically from the drive's capacity), with partitions
> always starting and ending at intervals of heads x cylinders. Thus,
> you need to choose a number of heads and sectors of which the SSD's
> erase block size is a multiple."
>
> CHS is dead (or so I hear) so I think of the disk as of a tape. What
> does it matter if a partition does or does not start on a virtual
> cylinder since it's only virtual anyway? Isn't the only thing that
> matters that the sector numbers be multiples of 8 (to get 4k sectors)
> and that the theoretical 'pitchfork' size be the ssd erase block size?
> These real requirements can be satisfied by juggling the starting and
> ending sector numbers to arrive at whatever desired partition size.

The quoted text is wrong, fdisk has not insisted upon CHS for many
years.

# fdisk -u /dev/vda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c').

Command (m for help): p

Disk /dev/vda: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 cylinders, total 8192000 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: 0x000ee2b8

Device Boot Start End Blocks Id System

/dev/vda1 * 63 7711199 3855568+ 83 Linux
/dev/vda2 7711200 8177084 232942+ 5 Extended
/dev/vda5 7711263 8177084 232911 82 Linux swap / Solaris

Command (m for help):

This is much more sensible than using -S and -H.

--
http://www.greenend.org.uk/rjk/

Tinker Tanker

unread,
May 22, 2011, 3:36:51 PM5/22/11
to
On 05/22/2011 02:52 PM, Richard Kettlewell wrote:
> Tinker Tanker<nosuch@_INVALID_no.gov> writes:
>> On 05/22/2011 02:44 AM, David W. Hodgins wrote:
>
>>> Go back to
>>> http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux
>>> where it tells you to use "fdisk -S 32 -H 32 /dev/sda". I don't agree
>>> with the numbers mentioned there. As I don't have access to such a
>>> drive, I can't confirm it works, but I'd try "fdisk -S 56 -H 224 /dev/sda",
>>> as that results in a tracksize that is a multiple of 4096, yet keeps the
>>> number of cylinders low enough for the mbr partition table.
>
> That's a ridiculous approach. Just use sector numbers, and (on this
> kind of drive) make sure they're all multiples of 8.

So the table in the previous post should work ok. This is what I'm
interested in cause I need to re-populate this drive and having screwed
it up once already I want to nail the thing down before doing it all
over again.

>> It's over my head!
>>
>> "Linux' fdisk, however, still uses a virtual C-H-S system where you
>> can define any number of heads and sectors yourself (the cylinders are
>> calculated automatically from the drive's capacity), with partitions
>> always starting and ending at intervals of heads x cylinders. Thus,
>> you need to choose a number of heads and sectors of which the SSD's
>> erase block size is a multiple."
>>
>> CHS is dead (or so I hear) so I think of the disk as of a tape. What
>> does it matter if a partition does or does not start on a virtual
>> cylinder since it's only virtual anyway? Isn't the only thing that
>> matters that the sector numbers be multiples of 8 (to get 4k sectors)
>> and that the theoretical 'pitchfork' size be the ssd erase block size?
>> These real requirements can be satisfied by juggling the starting and
>> ending sector numbers to arrive at whatever desired partition size.
>
> The quoted text is wrong, fdisk has not insisted upon CHS for many
> years.

That was my understanding, it lets you use CHS but I don't see why
because the disk itself doesn't want to hear from the using interface
except in terms of LBA i.e. a flat tape layout where sector numbers are
the only meaningful markers.

> # fdisk -u /dev/vda
>
> WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
> switch off the mode (command 'c').
>
> Command (m for help): p
>
> Disk /dev/vda: 4194 MB, 4194304000 bytes
> 255 heads, 63 sectors/track, 509 cylinders, total 8192000 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: 0x000ee2b8
>
> Device Boot Start End Blocks Id System
> /dev/vda1 * 63 7711199 3855568+ 83 Linux
> /dev/vda2 7711200 8177084 232942+ 5 Extended
> /dev/vda5 7711263 8177084 232911 82 Linux swap / Solaris
>
> Command (m for help):
>
> This is much more sensible than using -S and -H.

For my off-topic bit here, if you ended the first partition on 7711198
or 7711200 that little + sign would vanish. In the above case the
partition ends with a half used block leaving a sector that is not part
of any filesystem; malware couldn't ask for a better stashpad ;-) I
would want to see every sector of a disk either used by a filesystem
meaning a dynamic an unsurvivable environment or be part of proformat
predictable adminspace that can be rewritten to known specs anytime to
clear it of clingons. I could be all wrong too :-)


Aragorn

unread,
May 22, 2011, 3:42:46 PM5/22/11
to
On Sunday 22 May 2011 21:36 in alt.os.linux, somebody identifying as
Tinker Tanker wrote...

> [...] to clear it of clingons. I could be all wrong too :-)

On behalf of the Klingon Empire, I must warn you that any such action
will be considered a declaration of war. Q'apla!

<grin>

--
*Aragorn*
(registered GNU/Linux user #223157)

Tinker Tanker

unread,
May 22, 2011, 3:45:21 PM5/22/11
to
On 05/22/2011 02:07 PM, David W. Hodgins wrote:
> On Sun, 22 May 2011 12:36:54 -0400, Tinker Tanker
> <nosuch@_invalid_no.gov> wrote:
>
>> What is a 4k 'boundary'? I thought boundaries were dividing lines that
>> cannot have any size.
>
> Sorry, forgot to answer this part in my prior reply.
>
> What makes the tweaking necessary, is that for some reason I'm
> not clear on, linux is still using a logical sector size of 512 bytes,
> even though it knows the drive is using a 4kb physical sector size.

It used to be (maybe still is) that a 512 byte sector is the smallest
readable/writable unit. I'll defer this to the house gurus, I don't see
any need for it to even appear in userworld either.

> Since dos style mbr partitioning uses the so called "track size"
> to decide where to put partitions, and given that each partition
> table takes one track, the track size has to be 4kb, or a multiple
> of that size, in order to guarantee that each filesystem will start
> at the beginning of a physical sector.
>
> If you can figure out how to get linux to use a logical sector size
> of 4kb, then all of these problems go away. As I've never had access
> to such a drive, I don't know how to do that.
>
> Regards, Dave Hodgins
>

Now I'm gettin' closer. In other words CHS is a carryover to now be just
a tool to get the right sector numbers but to the extent that you can
get the right numbers otherwise you don't really need it. Say I
partition a disk and I don't use any CHS but in another invocation of a
terminal I run another fdisk just to get my numbers straight and use
those sector numbers in the real fdisk session?


Tinker Tanker

unread,
May 22, 2011, 3:53:49 PM5/22/11
to
On 05/22/2011 01:58 PM, David W. Hodgins wrote:
> On Sun, 22 May 2011 12:36:54 -0400, Tinker Tanker
> <nosuch@_invalid_no.gov> wrote:
>
>> CHS is dead (or so I hear) so I think of the disk as of a tape. What
>> does it matter if a partition does or does not start on a virtual
>> cylinder since it's only virtual anyway? Isn't the only thing that
>
> It's due to the dos style partitioning "standard".
>
> The master boot record, occupies the first sector of the first track.
> It contains the boot loader, and the primary partition table.
>
> The rest of the first track is not used in dos/windows systems. With
> grub, it uses (IIRC) the first 20 sectors after the mbr, with the
> rest of the track left blank.

I'm with you thus far but that's a choice made and no longer a physical
requirement. Nothing would prevent the rest of the track from being
used and grub does use it too (and who knows who else).

> Each primary partition starts on a track.
>
> The "extended partition defined in the primary partition table will
> occupy one track.
>
> Each logical partition has one track that contains a partition table
> in it's first sector (same layout as the mbr), and has the actual
> file system starting on the next tract. The partition table on the
> first logical partition has two entries. The first points to the
> filesystem on the next track (and contains the filesystem type),
> while the second entry points to the next logical (extended)
> partition (0 if this is the last logical partition).
>
> If you run "sfdisk -l -uS -x /dev/sda", it'll show you all of the
> logical partition tables.
>
> While CHS is no longer used in the disk i/o, if you're using the
> dos style partitioning, the "virtual track size" is still used
> to figure out where to put/find the partitions.
>
> With GUID partitioning, the dos style mbr record still exists
> for compatibility, and it will show a single partition of 2TB,
> so that dos style partitioning programs will not see any free
> space. The GUID partition table only uses sector addresses,
> and doesn't care about track sizes.
>
> Regards, Dave Hodgins
>

Thanks, I saw that. I'll put GPT on hold for my own use pending clearing
of the dust on the issue. There are a lot of folk steadfast against it.
Grub2 provides for it but that's all I really know about it. The wiki
is godawful complex for me at this point.


Tinker Tanker

unread,
May 22, 2011, 4:47:53 PM5/22/11
to
On 05/22/2011 03:42 PM, Aragorn wrote:
> On Sunday 22 May 2011 21:36 in alt.os.linux, somebody identifying as
> Tinker Tanker wrote...
>
>> [...] to clear it of clingons. I could be all wrong too :-)
>
> On behalf of the Klingon Empire, I must warn you that any such action
> will be considered a declaration of war. Q'apla!
>
> <grin>
>

oops, which 'sector' did YOU come from ??


Aragorn

unread,
May 22, 2011, 5:10:03 PM5/22/11
to
On Sunday 22 May 2011 22:47 in alt.os.linux, somebody identifying as
Tinker Tanker wrote...

> On 05/22/2011 03:42 PM, Aragorn wrote:
>
>> On Sunday 22 May 2011 21:36 in alt.os.linux, somebody identifying as
>> Tinker Tanker wrote...
>>
>>> [...] to clear it of clingons. I could be all wrong too :-)
>>
>> On behalf of the Klingon Empire, I must warn you that any such action
>> will be considered a declaration of war. Q'apla!
>>
>> <grin>
>>
>
> oops, which 'sector' did YOU come from ??

Hah! You did not see us coming, because our Bird Of Prey is cloaked!

However, all you need to know is that we have been following you for a
while and have intercepted your transmissions with the F'Disk. We have
relayed these messages to the Klingon High Council. The Chancellor was
not pleased, I can tell you that!

:p

Tinker Tanker

unread,
May 22, 2011, 5:22:16 PM5/22/11
to

'scuse me while I check me pulse and lack of need for viagra, this will
be scottsman's work. Meanwhile get ready for dd /dev/zero and teary eyes!

David W. Hodgins

unread,
May 23, 2011, 2:42:03 AM5/23/11
to
On Sun, 22 May 2011 15:45:21 -0400, Tinker Tanker <nosuch@_invalid_no.gov> wrote:

> On 05/22/2011 02:07 PM, David W. Hodgins wrote:
>> What makes the tweaking necessary, is that for some reason I'm
>> not clear on, linux is still using a logical sector size of 512 bytes,
>> even though it knows the drive is using a 4kb physical sector size.

> It used to be (maybe still is) that a 512 byte sector is the smallest
> readable/writable unit. I'll defer this to the house gurus, I don't see
> any need for it to even appear in userworld either.

Found an answer at
http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/

The drive's firmware will still only allow 512 byte logigcal sector
size, in order to be compatible with older (aka windows/dos) operating
systems.

> Now I'm gettin' closer. In other words CHS is a carryover to now be just
> a tool to get the right sector numbers but to the extent that you can
> get the right numbers otherwise you don't really need it. Say I

Correct. The track size used by dos style partitioning must be a
multiple of the physical sector size, in order to ensure partitioning
software will align partitions starting on physical sectors.

If you use partitioning software that allows you to specify the start
sector, it's up to you to ensure the partitions start on physical sector
boundaries.

If you use dos style partitioning, you must take into account the "track"
used by the logical partition's partition table so the actual partition
that the extended partition table points to will be on the start of a
physical sector.

David W. Hodgins

unread,
May 23, 2011, 3:11:45 AM5/23/11
to
On Sun, 22 May 2011 14:52:15 -0400, Richard Kettlewell <r...@greenend.org.uk> wrote:

> That's a ridiculous approach. Just use sector numbers, and (on this
> kind of drive) make sure they're all multiples of 8.

If you are using dos style partitioning, you have to take into account
the "track size", as each logical partition has a "track" used for the
partition table, followed by the actual filesystem starting on the next
track.

If you fail to take that into account, you will have ridiculous write
performance on a drive that uses a physical sector size of 4KB.

Tinker Tanker

unread,
May 23, 2011, 10:58:58 AM5/23/11
to

I found one where your earlier suggested 224/56 spec is confirmed:

http://linuxconfig.org/linux-wd-ears-advanced-format

" fdisk -H 224 -S 56
..Then create your partitions as per usual, however the drawback is that
your first partition will not be aligned. Similar to Microsoft adopted
scheme of:
fdisk -H 240 -S 63
"

This issue is getting rather complicated, I'm going to restart a little
later with a new OP.


Richard Kettlewell

unread,
May 25, 2011, 4:20:14 AM5/25/11
to
"David W. Hodgins" <dwho...@nomail.afraid.org> writes:
> Richard Kettlewell <r...@greenend.org.uk> wrote:

>> That's a ridiculous approach. Just use sector numbers, and (on this
>> kind of drive) make sure they're all multiples of 8.
>
> If you are using dos style partitioning, you have to take into account
> the "track size", as each logical partition has a "track" used for the
> partition table, followed by the actual filesystem starting on the next
> track.

I don't have a 512e drive to test on (and have better things to do than
fake one) but AFAICT current fdisk will default to 1Mb boundaries for
all partitions.

If you insist on typing in exact sector numbers yourself, obviously
you're on your own.

--
http://www.greenend.org.uk/rjk/

0 new messages