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
1
vote
0 answers

bio struct - bi_sector getting changed on write

I am trying to understand and modify the Linux network block device driver (/drivers/block/nbd.c). When the device gets a read request, I am logging the 'bi_sector' of the bio structs that is part of this request. For example, I am getting 7860224…
Ram
  • 23
  • 2
1
vote
1 answer

What's the usage of blk_queue_segment_boundary()

The book ldd says for the function blk_queue_segment_boundary() like this: Some devices cannot handle requests that cross a particular size memory bound- ary; if your device is one of those, use this function to tell the kernel about that…
levin li
  • 391
  • 3
  • 10
1
vote
1 answer

del_gendisk haging during cleanup of block device after media removal during IO

I have block driver for a hot-pluggable PCI storage device. if the device is removed during IO, I never seem to get a call to release (i.e. mydev_blk_release(struct gendisk *gd, fmode_t mode)), which I think is preventing del_gendisk() from…
1
vote
1 answer

Use SATA HDD as Block Device

I'm totally new to the Linux Kernel, so I probably mix things up. But any advice will help me ;) I have a SATA HDD connected via a PCIe SATA Card and I try to use read and write like on a block device. I also want the data power blackout save on the…
samuirai
  • 762
  • 1
  • 9
  • 25
1
vote
1 answer

Create a hard disk error on linux

I would like to create hard drive errors on my linux box - so that I can test that the application I'm writing performs correctly when there are uncorrectable errors. I have an application from a hard disk manufacturer that will create bad sectors…
time4tea
  • 2,169
  • 3
  • 16
  • 21
0
votes
1 answer

Correctly finding disk size on hosts on mixed setup of hosts

I am trying to find size on a large no. of different linux machines with various kind of FS arrangements. 1. plain JBOD setup (I can parse sfdisk -s) 2. Hardware raid setup ( again parse fdisk -s) 3. Software raid setup ( it seems like fdisk gives…
Sanjay
  • 3
  • 1
0
votes
0 answers

why does not btt in blktrace tool report any data

The btt report is as below: /ssd/blktrace/btt/btt -i parse.bin ==================== All Devices ==================== ALL MIN AVG MAX N --------------- ------------- ------------- -------------…
Jun
  • 1
  • 1
0
votes
1 answer

Replication mode Protocol C in LinBit DRBD

I found information about replication modes in the DRBD documentation. I was specifically interested in the C protocol. If you believe the documentation, then its essence lies in the fact that the recording procedure is considered completed when the…
Killa
  • 3
  • 1
0
votes
1 answer

GNU/Linux systemd/sd-device problems creating and filtering an sd_device_enumerator

Preface: I am not a good developer and am just getting started, the code below is part of a larger program I am building and has only been temporarily placed in the main cpp file. I am aware that the structure still needs improvement only I want to…
user21053811
0
votes
0 answers

Adapting old iomemory-vsl driver to a new Linux kernel

These are old fusion-io PCIe drives which otherwise are long lasting SLC/MLC available in great quantities for cheap but of course being old lack support. I was using few with older Linux kernel v5.10 but was forced to upgrade to v5.19 due WiFi…
mmx01
  • 1
  • 1
0
votes
1 answer

How to get a list of all of the block devices on a Linux system using OCaml's stdlib?

I'm doing some fairly low level work with OCaml and need to get a list of all of the block-level files that exist on a given Linux machine. My current attempt involves running the following and then parsing based on sd* from there. Sys.readdir…
Rawley Fowler
  • 1,366
  • 7
  • 15
0
votes
0 answers

Is block device IO buffered?

When interacting with block devices that have been mounted on the file system, the IO is buffered so reads and writes may not actually reach out to the backing hardware until some time in the future. I believe the same is also true for block devices…
0
votes
0 answers

Why du command is showing 501MiB?

I'm making a 500MiB binary file like this: $: dd if=/dev/zero of=mlinux.img bs=1048576 count=500 Then when I do: $: du -b mlinux.img It returns exactly 524288000 But when I do: $: du -BMiB mlinux.img It returns 501MiB Why not exactly 500MiB ?
Bey Réda
  • 57
  • 5
0
votes
1 answer

How to get the block device name for a file?

This is yak-shaving an X-Y problem So I shall start from the beginning. I wish to test the behaviour of a program which copies files from a source drive to a target drive which tries to be clever about whether the source directories are remote or…
Bruce Adams
  • 4,953
  • 4
  • 48
  • 111
0
votes
0 answers

Where to find the read data after a bio in the Linux kernel?

I'm trying to make my own device mapper, which first maps the bio (read) request onto another one. However, after completion of the remapped request, I want to access the data that was read. I've been looking at the important data structures, and…
Jasper
  • 302
  • 3
  • 11