All of lore.kernel.org
 help / color / mirror / Atom feed
* How can I get the sector count in kernel?
@ 2013-11-10 12:26 韩磊
  2013-11-10 12:37 ` 韩磊
  2013-11-10 21:45 ` Andreas Mohr
  0 siblings, 2 replies; 3+ messages in thread
From: 韩磊 @ 2013-11-10 12:26 UTC (permalink / raw)
  To: Linux Kernel Mailing List

I need the count of sector,but I don't know how to get it.
Could you give me some favour?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How can I get the sector count in kernel?
  2013-11-10 12:26 How can I get the sector count in kernel? 韩磊
@ 2013-11-10 12:37 ` 韩磊
  2013-11-10 21:45 ` Andreas Mohr
  1 sibling, 0 replies; 3+ messages in thread
From: 韩磊 @ 2013-11-10 12:37 UTC (permalink / raw)
  To: Linux Kernel Mailing List

The disk sector


2013/11/10 韩磊 <bonben1989@gmail.com>:
> I need the count of sector,but I don't know how to get it.
> Could you give me some favour?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How can I get the sector count in kernel?
  2013-11-10 12:26 How can I get the sector count in kernel? 韩磊
  2013-11-10 12:37 ` 韩磊
@ 2013-11-10 21:45 ` Andreas Mohr
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Mohr @ 2013-11-10 21:45 UTC (permalink / raw)
  To: =?GB2312?B?uqvA2g==?=; +Cc: Linux Kernel Mailing List

Hi again :)

> I need the count of sector,but I don't know how to get it.
> Could you give me some favour?

First, you should ask yourself whether you really need this
drive-specific information.


Such information can (more or less) be gathered via the HDIO_GETGEO
ioctl. But be advised that this ioctl is known to be
unreliable/undesirable and will be handled differently
(and with differing reliability!!!) by various I/O layers.
E.g. this will be handled by a callback, which in the case of libata
will return values that are hard-coded for *LBA-specific* disk geometry
(255 heads).
Good luck if your disk happens to be using CHS or ECHS, where this value
likely is NOT the proper one. Especially in the case of ntfsclone /
partclone.ntfsfixboot combo this is a major nuisance (and you'll
probably end up having to manually specify the actually correct values
in order to finally get that f***in' thing to boot properly).

Also, you should make sure to be using the EDD BIOS service (see modinfo edd),
for the kernel to be able to forward actual BIOS-side drive geometry
information.

Another way to be gathering a geometry is by parsing geometry output
of fdisk / cfdisk.

HTH,

Andreas Mohr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-10 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10 12:26 How can I get the sector count in kernel? 韩磊
2013-11-10 12:37 ` 韩磊
2013-11-10 21:45 ` Andreas Mohr

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.