* locking sectors of raw disk (raw read-write test of mounted disk)
@ 2006-11-15 20:06 Yakov Lerner
2006-11-15 21:41 ` Phillip Susi
0 siblings, 1 reply; 5+ messages in thread
From: Yakov Lerner @ 2006-11-15 20:06 UTC (permalink / raw)
To: Kernel
I'd like to make read-write test of the raw disk, and disk has
mounted partitions. Is it possible to lock range of sectors
of the raw device so that any kernel code that wants to write
to this range will sleep ? (so that test
{ lock range; read /dev/hda->buf; write buf->/dev/hda; unlock }
won't corrupt the filesysyem ?)
Thanks
Yakov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: locking sectors of raw disk (raw read-write test of mounted disk)
2006-11-15 20:06 locking sectors of raw disk (raw read-write test of mounted disk) Yakov Lerner
@ 2006-11-15 21:41 ` Phillip Susi
2006-11-15 22:03 ` linux-os (Dick Johnson)
2006-11-16 10:15 ` Yakov Lerner
0 siblings, 2 replies; 5+ messages in thread
From: Phillip Susi @ 2006-11-15 21:41 UTC (permalink / raw)
To: Yakov Lerner; +Cc: Kernel
No, you can not tamper with the underlying data while the kernel has it
mounted.
Yakov Lerner wrote:
> I'd like to make read-write test of the raw disk, and disk has
> mounted partitions. Is it possible to lock range of sectors
> of the raw device so that any kernel code that wants to write
> to this range will sleep ? (so that test
> { lock range; read /dev/hda->buf; write buf->/dev/hda; unlock }
> won't corrupt the filesysyem ?)
>
> Thanks
> Yakov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: locking sectors of raw disk (raw read-write test of mounted disk)
2006-11-15 21:41 ` Phillip Susi
@ 2006-11-15 22:03 ` linux-os (Dick Johnson)
2006-11-16 10:15 ` Yakov Lerner
1 sibling, 0 replies; 5+ messages in thread
From: linux-os (Dick Johnson) @ 2006-11-15 22:03 UTC (permalink / raw)
To: Phillip Susi; +Cc: Yakov Lerner, Kernel
On Wed, 15 Nov 2006, Phillip Susi wrote:
> No, you can not tamper with the underlying data while the kernel has it
> mounted.
>
> Yakov Lerner wrote:
>> I'd like to make read-write test of the raw disk, and disk has
>> mounted partitions. Is it possible to lock range of sectors
>> of the raw device so that any kernel code that wants to write
>> to this range will sleep ? (so that test
>> { lock range; read /dev/hda->buf; write buf->/dev/hda; unlock }
>> won't corrupt the filesysyem ?)
>>
>> Thanks
>> Yakov
>
Well certainly if the low-level driver was modified, or a new one
created, so that one could lock/unlock a range of sectors, then that
would be possible. You would need to save (somewhere) the original
sector data, then put it back before unlocking that range. You couldn't
save the original data in a file on the disk, because that file-data
may (someday) extend into the locked region and you have a deadlock.
In the "good old days" when a SCSI format block command actually
worked, we could repair bad sectors by doing just that. We would
lock the block, save whatever data was readable in that block,
format that block, write the data back, then release the lock.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.72 BogoMips).
New book: http://www.AbominableFirebug.com/
_
\x1a\x04
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: locking sectors of raw disk (raw read-write test of mounted disk)
2006-11-15 21:41 ` Phillip Susi
2006-11-15 22:03 ` linux-os (Dick Johnson)
@ 2006-11-16 10:15 ` Yakov Lerner
2006-11-16 15:28 ` Phillip Susi
1 sibling, 1 reply; 5+ messages in thread
From: Yakov Lerner @ 2006-11-16 10:15 UTC (permalink / raw)
To: Phillip Susi; +Cc: Kernel
On 11/15/06, Phillip Susi <psusi@cfl.rr.com> wrote:
> No, you can not tamper with the underlying data while the kernel has it
> mounted.
I don't want to tamper wuith data. I want to raw write back exacty
same raw data that I read in. I only want to make sure that kernel
doesn't write modified data between in between my read-write pair.
Yakov
> Yakov Lerner wrote:
> > I'd like to make read-write test of the raw disk, and disk has
> > mounted partitions. Is it possible to lock range of sectors
> > of the raw device so that any kernel code that wants to write
> > to this range will sleep ? (so that test
> > { lock range; read /dev/hda->buf; write buf->/dev/hda; unlock }
> > won't corrupt the filesysyem ?)
> >
> > Thanks
> > Yakov
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: locking sectors of raw disk (raw read-write test of mounted disk)
2006-11-16 10:15 ` Yakov Lerner
@ 2006-11-16 15:28 ` Phillip Susi
0 siblings, 0 replies; 5+ messages in thread
From: Phillip Susi @ 2006-11-16 15:28 UTC (permalink / raw)
To: Yakov Lerner; +Cc: Kernel
Yakov Lerner wrote:
> I don't want to tamper wuith data. I want to raw write back exacty
> same raw data that I read in. I only want to make sure that kernel
> doesn't write modified data between in between my read-write pair.
Ahh, in that case you might be able to do this using the device mapper.
You could keep the filesystem mounted on the device mapper with a
mapping to the underlying disk device. Then change that mapping on the
fly to mark a section of the device as mapped to a ramdisk and copy (
while that section is suspended ) the original data there. Then resume
the section, tamper with the underlying disk, then suspend the ramdisk
mapping, copy it back to the underlying disk, then change the mapping
back to normal. You might also use a snapshot dm target instead of a
ramdisk.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-11-16 15:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-15 20:06 locking sectors of raw disk (raw read-write test of mounted disk) Yakov Lerner
2006-11-15 21:41 ` Phillip Susi
2006-11-15 22:03 ` linux-os (Dick Johnson)
2006-11-16 10:15 ` Yakov Lerner
2006-11-16 15:28 ` Phillip Susi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).