From: Rod Speed on
Al wrote
> Franc Zabkar <fzab...(a)iinternode.on.net> wrote

>>> LBA = (C x 255 x 63) + (H x 63) + (S - 1)

> and test data:

> Al <bigal.nz(a)gmail.com> wrote:
>> Disk /dev/sda - 1000 GB / 931 GiB - CHS 121601 255 63
>> Current partition structure:
>> Partition Start End Size in sectors

>> 1 * Linux 0 1 1 121600 254 63 1953520002

> thus start LBA:

> LBA = (0 x 255 x 63) + (1 x 63) + (1 - 1)
> = 0 + 63 + 0
> = 63

> and end LBA:

> LBA = (121600 x 255 x 63) + (254 x 63) + (63 - 1)
> = 1953504000 + 16002 + 62
> = 1953520064

> 1) Are the units of LBA blocks?

Nope, sectors.

> And if so, does (LBAe - LBAs) * 512 = partition size?

Yes. But thats sectors, not blocks.

> 2) Should the C and H values in the calculation be 64 and 121601
> (because the numbering starts at 0?)

It doesnt with heads and cylinders, only with sectors.

> One of the commands I am dealing with is MOUNT and with the offset switch.

> Plenty of sites tell you to multiply the start (Cylinders) by 512 to
> get the offset value. Therefore what unit is the offset value in?



From: Franc Zabkar on
On Fri, 20 Nov 2009 00:07:24 -0800 (PST), Al <bigal.nz(a)gmail.com> put
finger to keyboard and composed:

>1) Are the units of LBA blocks? And if so, does (LBAe - LBAs) * 512 =
>partition size?

LBA = Logical Block Address

For a typical hard drive, 1 LBA = 1 sector = 512 bytes.

Partion size = (LBAe - LBAs + 1) * 512

For example, a partition consisting of two sectors, LBA 10 and LBA 11,
has a size of (11 - 10 + 1) * 512.

>2) Should the C and H values in the calculation be 64 and 121601
>(because the numbering starts at 0?)

Each cylinder has 255 heads (aka tracks), and each track has 63
sectors.

The very first sector is LBA 0 or CHS 0/0/1. We haven't completed a
full cylinder, nor a full track, so C=0 and H=0.

LBAs are assigned sequentially. Start at the first sector of the first
track under the first head, and then go around the track. This gives
you 63 sectors. Switch to the first track under the second head and
count the next 63 sectors. Then repeat this process until you go
around the first track under the 255th head. Now you have completed
one full cylinder. Return to the first head and go around the second
track. Keep switching heads until you complete the second cylinder and
then begin on the third cylinder. Etc, etc ...

>One of the commands I am dealing with is MOUNT and with the offset
>switch.
>
>Plenty of sites tell you to multiply the start (Cylinders) by 512 to
>get the offset value. Therefore what unit is the offset value in?

Sorry, that makes no sense to me. Perhaps a Linux user could help you?

- Franc Zabkar
--
Please remove one 'i' from my address when replying by email.
From: Al on
On Nov 21, 2:27 pm, Franc Zabkar <fzab...(a)iinternode.on.net> wrote:
> On Fri, 20 Nov 2009 00:07:24 -0800 (PST), Al <bigal...(a)gmail.com> put
> finger to keyboard and composed:
>
> >1) Are the units of LBA blocks? And if so, does (LBAe - LBAs) * 512 =
> >partition size?
>
> LBA = Logical Block Address
>
> For a typical hard drive, 1 LBA = 1 sector = 512 bytes.
>
> Partion size = (LBAe - LBAs + 1) * 512

Ok that makes good sense.
Does it follow that 1 LBA = 1 block = 512 bytes?

>
> For example, a partition consisting of two sectors, LBA 10 and LBA 11,
> has a size of (11 - 10 + 1) * 512.
>
> >2) Should the C and H values in the calculation be 64 and 121601
> >(because the numbering starts at 0?)

I think I confused myself there - S numbering starts at 1. (and CH at
0). The 63 is a S.
>
> Each cylinder has 255 heads (aka tracks), and each track has 63
> sectors.
>
> The very first sector is LBA 0 or CHS 0/0/1. We haven't completed a
> full cylinder, nor a full track, so C=0 and H=0.
>
> LBAs are assigned sequentially. Start at the first sector of the first
> track under the first head, and then go around the track. This gives
> you 63 sectors. Switch to the first track under the second head and
> count the next 63 sectors. Then repeat this process until you go
> around the first track under the 255th head. Now you have completed
> one full cylinder. Return to the first head and go around the second
> track. Keep switching heads until you complete the second cylinder and
> then begin on the third cylinder. Etc, etc ...
>
> >One of the commands I am dealing with is MOUNT and with the offset
> >switch.
>
> >Plenty of sites tell you to multiply the start (Cylinders) by 512 to
> >get the offset value. Therefore what unit is the offset value in?
>
> Sorry, that makes no sense to me. Perhaps a Linux user could help you?

FWIW This guy shows how simple it is. He multiples the C start by 512
to get the offset value.

http://darkdust.net/writings/diskimagesminihowto#Mountingthediskimage

I am picking that you can multiple the C * 512 to get the offset in
bytes?

-Al


From: Rod Speed on
Al wrote
> Franc Zabkar <fzab...(a)iinternode.on.net> wrote
>> Al <bigal...(a)gmail.com> wrote

>>> 1) Are the units of LBA blocks? And if so, does (LBAe - LBAs) * 512 = partition size?

>> LBA = Logical Block Address

>> For a typical hard drive, 1 LBA = 1 sector = 512 bytes.

>> Partion size = (LBAe - LBAs + 1) * 512

> Ok that makes good sense.

> Does it follow that 1 LBA = 1 block = 512 bytes?

Like he said FOR A TYPICAL HARD DRIVE.

>> For example, a partition consisting of two sectors,
>> LBA 10 and LBA 11, has a size of (11 - 10 + 1) * 512.

>>> 2) Should the C and H values in the calculation be 64 and 121601
>>> (because the numbering starts at 0?)

> I think I confused myself there - S numbering starts at 1. (and CH at 0). The 63 is a S.

>> Each cylinder has 255 heads (aka tracks), and each track has 63
>> sectors.
>>
>> The very first sector is LBA 0 or CHS 0/0/1. We haven't completed a
>> full cylinder, nor a full track, so C=0 and H=0.
>>
>> LBAs are assigned sequentially. Start at the first sector of the
>> first track under the first head, and then go around the track. This
>> gives you 63 sectors. Switch to the first track under the second
>> head and count the next 63 sectors. Then repeat this process until
>> you go around the first track under the 255th head. Now you have
>> completed one full cylinder. Return to the first head and go around
>> the second track. Keep switching heads until you complete the second
>> cylinder and then begin on the third cylinder. Etc, etc ...
>>
>>> One of the commands I am dealing with is MOUNT and with the offset
>>> switch.
>>
>>> Plenty of sites tell you to multiply the start (Cylinders) by 512 to
>>> get the offset value. Therefore what unit is the offset value in?
>>
>> Sorry, that makes no sense to me. Perhaps a Linux user could help
>> you?
>
> FWIW This guy shows how simple it is. He multiples the C start by 512
> to get the offset value.
>
> http://darkdust.net/writings/diskimagesminihowto#Mountingthediskimage
>
> I am picking that you can multiple the C * 512 to get the offset in
> bytes?
>
> -Al


From: Franc Zabkar on
On Fri, 20 Nov 2009 23:54:21 -0800 (PST), Al <bigal.nz(a)gmail.com> put
finger to keyboard and composed:

>On Nov 21, 2:27�pm, Franc Zabkar <fzab...(a)iinternode.on.net> wrote:
>> On Fri, 20 Nov 2009 00:07:24 -0800 (PST), Al <bigal...(a)gmail.com> put
>> finger to keyboard and composed:
>>
>> >1) Are the units of LBA blocks? And if so, does (LBAe - LBAs) * 512 =
>> >partition size?
>>
>> LBA = Logical Block Address
>>
>> For a typical hard drive, 1 LBA = 1 sector = 512 bytes.
>>
>> Partion size = (LBAe - LBAs + 1) * 512
>
>Ok that makes good sense.
>Does it follow that 1 LBA = 1 block = 512 bytes?

All the hard drives you are likely to encounter have block sizes equal
to the sector size, ie 512 bytes (= 256 words).

However, the ATA-8 specification allows for other sizes.

See words 106 and 117-118 of the Identify Device data block, as
described in the following document.

Working Draft AT Attachment 8 - ATA/ATAPI Command Set (ATA8-ACS):
http://www.t13.org/Documents/UploadedDocuments/docs2008/D1699r6a-ATA8-ACS.pdf

>FWIW This guy shows how simple it is. He multiples the C start by 512
>to get the offset value.
>
>http://darkdust.net/writings/diskimagesminihowto#Mountingthediskimage
>
>I am picking that you can multiple the C * 512 to get the offset in
>bytes?
>
>-Al

The author of that tutorial is multiplying the start LBA by 512 to get
the offset in bytes into the disc image.

- Franc Zabkar
--
Please remove one 'i' from my address when replying by email.