- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- how to find the raw device file in linux
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 05:35 AM
тАО04-01-2009 05:35 AM
In HP-UX, There is two files available for each disk
1) block device file "/dev/dsk/c0t5d0"
2) raw device file "/dev/rdsk/c0t5d0"
But in linux only one file available for each disk
1) block device file "/dev/sda1"
I want answer for following questions.
1) is raw device file available defaultly in linux for all disks?
2) if yes, where it is available.
3) if not, how to create that file.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 05:47 AM
тАО04-01-2009 05:47 AM
Re: how to find the raw device file in linux
No.
>> 3) if not, how to create that file.
http://magazine.redhat.com/2008/09/17/tips-and-tricks-how-do-i-add-raw-device-mapping-in-red-hat-enterprise-linux-5/
http://youngcow.net/doc/oracle10g/install.102/b14203/storage.htm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 09:29 AM
тАО04-01-2009 09:29 AM
Re: how to find the raw device file in linux
The new, recommended way to access disks in raw mode is to open the regular device file using the O_DIRECT option. This is something that must be done in the source code of the application.
In this sense, the answer for your question 1) is "yes".
For your question 2) we can say that a raw device file for e.g. /dev/sda1 is /dev/sda1.
If, for some reason, you need to use the old /dev/raw/raw* interface, Ivan's first link had instructions for that.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 10:40 AM
тАО04-01-2009 10:40 AM
Re: how to find the raw device file in linux
I disagree partially with this. /dev/sda1 in this case is a block device. RAW devices are character devices. The access pattern is different and I had different results when doing performance tests with block and raw devices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2009 10:18 PM
тАО04-01-2009 10:18 PM
Re: how to find the raw device file in linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-02-2009 01:05 AM
тАО04-02-2009 01:05 AM
Re: how to find the raw device file in linux
As far as I see, there are at least three possible definitions:
1.) - bypassing all OS buffering and accessing the disk blocks as directly as possible
In this case, you have to observe the hardware-imposed limitations (mainly alignment requirements for DMA operations).
In Linux 2.6.* kernels, O_DIRECT on a disk device does exactly this.
2.) - accessing a block device like a character device or a fixed-size file
In this case, you cannot always skip all buffering: a proper character device has no block size or data alignment requirements, but if the hardware has them, the OS must hide the restrictions by using a buffer at some level.
I don't know how (or *if*) this can be done in Linux.
3.) - giving raw SCSI commands to a disk device
In Linux 2.6.* kernels, this is possible using the standard block device file, using the correct ioctls. Of course, this often requires special privileges (= being root, usually).
-----
And if you think /dev/raw/raw* is somehow different from or more raw than using O_DIRECT with a block device, please let me invite you to examine the source code.
The driver for /dev/raw devices is located in linux-
The very first function in that file is the one that handles opening and closing the /dev/raw/raw* devices. I think the comments speak for themselves:
/*
* Open/close code for raw IO.
*
* We just rewrite the i_mapping for the /dev/raw/rawN file descriptor to
* point at the blockdev's address_space and set the file handle to use
* O_DIRECT.
*
* Set the device's soft blocksize to the minimum possible. This gives the
* finest possible alignment and has no adverse impact on performance.
*/
static int raw_open(struct inode *inode, struct file *filp)
If you are talking about ioctls, a bit later there is another function raw_ioctl() which just forwards any ioctls to the underlying block device.
So *everything* you can achieve by using /dev/raw/raw*, you can also achieve by using O_DIRECT on a block device, because /dev/raw is implemented by using O_DIRECT on a block device.
Note: in older kernels, this was implemented in a very different way.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-02-2009 02:30 AM
тАО04-02-2009 02:30 AM
Re: how to find the raw device file in linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-02-2009 05:00 AM
тАО04-02-2009 05:00 AM
Re: how to find the raw device file in linux
O_DIRECT is not a command. It is an option flag you must set in the system call you use to open the disk device. You must edit the source code of your program to use it.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2009 01:29 AM