[Gllug] Raw Partitions

Peter Grandi pg_gllug at gllug.for.sabi.co.UK
Wed Nov 16 16:01:12 UTC 2005


>>> On Wed, 16 Nov 2005 12:02:55 +0000, Steve Nelson
>>> <sanelson at gmail.com> said:

sanelson> Hi All, I need to simulate reading and writing to a
sanelson> raw partition on a test machine before I perform the
sanelson> same procedure on a live system, which appears to be
sanelson> crashing when the same happens.

This is not fully meaningful to me -- what do you mean by «raw
partition»? Is this related to Linux? For there are no such
things as those under Linux. There are partitions, block
devices, raw device access wrappers to block devices
(deperecated), and 'O_DIRECT' (allegedly).

Some links on these subjects:

  http://WWW.TLDP.org/HOWTO/SCSI-2.4-HOWTO/rawdev.html
  http://WWW.LLNL.gov/linux/ucrl-id-144213.html

sanelson> I've got hold of sg_dd for the read/writes, but need
sanelson> to create a raw partition for experimenation.

It is hard for me to see the relationship between 'sg_dd' and
«raw partition»s... 'sg_dd' operations on ''generic'' SCSI
character devices, and operates sort of like a user-mode driver.

Its apparent relationship to 'raw'(8) wrapper devices may be
that it does align buffers. But there are versions of regular
'dd' that do that, for example, from the DVD+RW tools home page:

  http://FY.Chalmers.SE/~appro/LD_*-gallery/index.html?aligned_io#aligned_io

or:

  http://WWW.Teaser.FR/~amajorel/misc/dd.c

and recent versions of the standard 'dd'(1) itself, as well as
GNU 'ddrescue':

  http://WWW.GNU.org/software/ddrescue/ddrescue.html

and Schilling's 'sdd' does that too:

  ftp://FTP.BerliOS.DE/pub/sdd/

sanelson> I'm not especially keen on repartitioning my test
sanelson> machine so I can create a raw device. Is it possible
sanelson> to create a rawdevice 'within' a current partition.

It is impossible either way. Unlike most other UNIX like
kernels, Linux does not really have ''raw devices'', those
described in 'raw'(8) are just sort of wrappers.

Also, the 'raw' command and raw device wrappers are deprecated,
depending on the kernel release (and did not seem to have much
of an effect when I tried them, and seem to be little tested).

sanelson> I am thinking along the lines of the mkswap or
sanelson> mkinitrd commands - can I use dd or some other tool
sanelson> to create a 100M file which I then bind using raw?

The man page 'raw'(8) says «raw is used to bind a Linux raw
character device to a block device» so first you have to turn
the file into a block device using 'losetup'(8). But I would be
rather wary of stacking things this way, because it might now
have the intended effects, and/or be not reliable...

sanelson> Or am I barking up completely the wrong tree [ ... ]

Seems to me that is likely the case, because 'sg_dd', and the
various non-block-device techniques, are a bit subtle and
mysterious and easy to misunderstand (and not that reliable).

So the talk about «sg_dd», «raw partition», «raw device» and so
on sounds very strange to me.

In case it may help, for various futile attempts to bypass the
Linux page cache or mitigate its performance problems when doing
large amounts of streaming IO consider reading the 'team' source
here: <URL:http://WWW.sabi.co.UK/#almostSources>.

As usual, perhaps it would be helpful if you gave some context
for your question, like the purpose behind the question and the
configuration of the system (e.g. kernel version etc.).

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list