Questions tagged [block-device]

A block device is a computer data storage device. It organizes data into fixed sized blocks that are typically 512 or 4096 bytes long. Data is indexed by a logical block address. Block storage devices are widely available, including spinning hard drives or solid-state devices. They may be used directly by applications or may have a filesystem or other data structure layered on top of them.

139 questions
4
votes
1 answer

What kernel module function gets called, when I say "cat myfile > /dev/sda"

I've skimmed through the Linux Kernel Module Programming guide, but can't figure out: When I say cat image.iso > /dev/sda, will it cause the write function of file_operations structure to be executed by the sda device driver? Or is the file…
Boris Burkov
  • 13,420
  • 17
  • 74
  • 109
4
votes
0 answers

Linux block driver merge bio's

I have a block device driver which is working, after a fashion. It is for a PCIe device, and I am handling the bios directly with a make_request_fn rather than use a request queue, as the device has no seek time. However, it still has transaction…
3
votes
1 answer

mapping between list of ec2 block device mappings and windows drives

How does the mapping between list of ec2 block device mappings and windows drives happen? For eg, if i specify -b "/dev/sdb=snap-XXXXXXX" -b "/dev/sdc=ephemeral0" while launching a windows instance, it maps D:\ to the EBS volume snapshot and E:\ to…
Satish
  • 95
  • 2
  • 10
3
votes
1 answer

Unaligned writes on block devices

I've read that write of block of unaligned size can induce extra reads.I mean writes on block devices in Linux. Why? How can I see it?
Gilgamesz
  • 4,727
  • 3
  • 28
  • 63
3
votes
1 answer

What exactly set_bh_page does for a given buffer head in page cache?

I was diving into the kernel source code and I noticed this function set_bh_page(). However, I could not understand clearly what it does. I could only find this comment in the fs/buffer.c file: /* Link the buffer to its page */ set_bh_page(bh,…
3
votes
2 answers

Programming a loopback-device consisting of several files in Linux

Hej, it is relatively easy to use a file for emulating a block-device using losetup in Linux: http://www.walkernews.net/2007/07/01/create-linux-loopback-file-system-on-disk-file/ Can anyone please give me a hint on what to look for in case I want…
dubbaluga
  • 2,223
  • 5
  • 29
  • 38
3
votes
1 answer

Create a filesystem on block device directly, without a partition?

I was under the impression that a block device is listed under /dev, so for example /dev/xvdf and that file systems live on a partition which is listed with a number behind the block device the partition is on, like /dev/xvdf1 and that all file…
Tom
  • 122
  • 2
  • 9
3
votes
2 answers

vfsstream: file_get_contents() failed to open stream: stream_open call failed

I have set up a vfsstream block device and I'm trying to call file_get_contents() on it. However the call to vfsStreamWrapper::stream_open fails and therefore the stream cannot be opened. Here is my code: $this->root =…
Conor Wright
  • 41
  • 1
  • 3
3
votes
1 answer

How can I duplicate special files using Python like pipes or block devices?

My task is to copy a massive amount of files using Python. Currently I've everything set and copying whole dir trees works fine. But I got stuck at duplicating pipe and block files. How can I duplicate such a file using Python only? Is it even…
3
votes
1 answer

User processes in D-state leads to a watchdog reset using Linux 2.6.24 and arm processor

Most of the user space processes are ending up in D-state after the unit runs for around 3-4 days, the unit is running on ARM processor. From the top o/p we can see that processes that are in D-state are waiting on system calls "page_fault" and…
3
votes
1 answer

OSX Userspace Device FIle

Is there any way to create a block device via user space in OSX (10.8+), without 3rd party libraries (FUSE, etc)? I am trying to create a userspace tool. The idea is the user supplies a file to the tool and the tool creates a virtual interface.…
Ethan Reesor
  • 2,090
  • 1
  • 23
  • 40
3
votes
2 answers

Reading block_device from kernel (3.7) module: segfault in submit_bio, bd_disk is missing

Hello stackoverflow. Wondering what I got wrong trying to access a block-device directly from a kernel module. (Kernel 3.7 on amd64) I get the (struct gendisk*) of the device using get_gendisk(). Next, create a bio with bio_map_kern(), add the…
3
votes
2 answers

User buffer after doing 'write' to file opened with O_DIRECT

I'm using the O_DIRECT flag to write to the disk directly from the user buffer. But as far as I understand, Linux doesn't guarantee that after this call, the data is written. It just writes directly from the user buffer to the physical device using…
3
votes
0 answers

Memory mapping in block IO device in Linux

I was going through device driver development in Linux. I've come across memory mapping of device driver in Linux. I was trying to develop a RAM Disk block device driver (which creates virtual disk out of RAM). But I coudln't figure out how to use…
viji
  • 2,706
  • 5
  • 28
  • 34
3
votes
2 answers

read() from a HDD with O_DIRECT fails with 22 (EINVAL, Invalid Argument)

I want to make a basic read() from a SATA HDD /dev/sdd. A write() seems to work. Also read() and write() works without the O_DIRECT Flag. I've read, that it has to be aligned to the blocksize. So I used this to get the blocksize: root$ blockdev…
samuirai
  • 762
  • 1
  • 9
  • 25
1 2
3
9 10