Re: Writing onto disk sector

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 20, 2008 at 3:51 AM, Akhil <akhilesh.noida@xxxxxxxxx> wrote:
> I am not sure whether this is a relevant question...please ignore if
> it seems nonsense....
>
> Is it possible in linux (2.6 or 2.4) to write/read directly onto a
> particular disk sector? If yes , how?

If this is a userspace question, with /dev/sg you can do a lot of
direct disk activity.  (ie. The kernel does its best to stay out of
the way when using /dev/sg.)

I believe the most recent versions of hdparm even use /dev/sg to allow
you to artificially create bad sectors and in turn to repair them.
You can use strace to verify which kernel API is used by hdparm for
its new features.

sample hdparm commands that should work if you have a new enough
release of hdparm:

1) Prep drive for error handling tests

hdparm --make-bad-sector nnnnnnnn /dev/sdb ## corrup a sector
hdparm --read-sector nnnnnnnn /dev/sdb ## verify that it is now bad

2) test your device driver's error handling etc..

3) Repair your drive

hdparm --repair-sector nnnnnnn /dev/sdb ## fix the bad sector
hdparm --read-sector nnnnnnn /dev/sdb ## verify that it is now fixed


FYI: I don't know if 2.4 supports /dev/sg.

Greg
-- 
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com



-- 
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux