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.
Questions tagged [block-device]
139 questions
1
vote
1 answer
How does a linux block driver ensure all I/O has finished before unloading
A linux block device driver allocates a struct gendisk and any associated metdata, and provides a queue or some implementation of the submit_bio function to handle incoming I/O requests from the operating system.
When a disk is being removed, it…

Reinstate Monica
- 588
- 7
- 21
1
vote
1 answer
how to backup raw- / kvm-device directly over the network
I have setup some VMs on a Hypervisor. Each of which is using a raw LVM Volume as disk. This way I can use LVM Snapshots to prepare a backup. Up to this point that is working and the only missing piece of the puzzle boils down to:
How can/should I…

philipp
- 15,947
- 15
- 61
- 106
1
vote
1 answer
Getting 'Invalid argument' error when using IOCTL
My userspace program is like this(this is only part of code):
char path[SIZE];
printf( "Enter the path of the block device to add or remove: ");
fgets(path, SIZE, stdin);
path[strcspn(path, "\n")] = '\0';
int fd = open( path, O_RDWR );
if( fd < 0…

Sumit Patil
- 21
- 6
1
vote
1 answer
How to check block device supports `nowait` or not
I want to use async IO in my program. After some searching, I found nowait was added to avoid the blocking in aio. How can I check my system(block-device、plug, etc) supports nowait or not?
I am using ubuntu 22.04 with kernel version 6.2.6

YjyJeff
- 833
- 1
- 6
- 14
1
vote
0 answers
Read highmemory page address in a BPF program
Could someone provide a replacement for kmap_load_page(page) or kmap_atomic(page) so that page memory can be read with an offset, i.e. how can the following be done in the BPF program?
struct request *req;
struct bio *bio = req->bio;
struct bio_vec…

randomcoder
- 11
- 2
1
vote
2 answers
How to detect block devices on Linux?
With C++ on Linux, how does one detect block devices? Right now, I'm using this code:
for (const auto &entry : std::filesystem::directory_iterator("/dev/"))
{
std::string name = entry.path().filename().string();
if (name.find("sd") == 0 ||…

hanshenrik
- 19,904
- 4
- 43
- 89
1
vote
1 answer
How do you properly read/write a block device in C?
I know you can use regular I/O functions for block devices (/dev/sda etc), but can you just read some data of size n, or does it have to be divisible by 512? Is there any overheard to reading in smaller sizes? Some devices have blocks bigger than…

circl
- 121
- 8
1
vote
1 answer
AWS Cloudformation: Tagging block device from auto-scaling launch configuration
I have created an autoscaling group and its launch configuration via Cloudformation template.
The Autoscaling group has only one tag called 'name'.
There is a block device mapping for the ec2 instances in the launch configuration as…

Mahbub Rahman
- 1,295
- 1
- 24
- 44
1
vote
0 answers
Recording information about block IO writes performed by user processes
I am trying to collect some block layer information related to writes performed by some target processes on the block devices. Specifically, I want to find: (1) the starting sector that needs to be written to, (2) the number of sectors written and…

Tez_Nikka
- 115
- 7
1
vote
0 answers
Does setting read ahead parameter affect open files/ running processes?
Does setting the read ahead parameter using the blockdev command affects open files and running process?
Example: The default value for read ahead is 256.
Suppose I run the following:
sudo blockdev --setra 8 /dev/sdX
Will this instantly enter in…

Raphael Philipe
- 171
- 2
- 5
1
vote
0 answers
Device driver for SD card connected using a custom bus - Platform driver or block driver?
I have to write a driver for a custom chip, to interface it with an SD card using SD protocol, which will have filesystems on it.
Now the obvious answer is that, since its an SD card(a block device), I will have to go with Block device driver…

emb_linux17
- 21
- 6
1
vote
1 answer
How to start implementing a Linux ECC block device wrapper
Thinking about student projects to advise; I'm an OK C develepor and C++ developer/architect.
Not done much Linux kernel development beyond "write your first module".
The thing I want to rudimentarily implement (before advising students doing it…

Marcus Müller
- 34,677
- 4
- 53
- 94
1
vote
1 answer
iostats shows more writes for logical volume than for physical volume under it
I have a server where iostat shows weird numbers to me:
avg-cpu: %user %nice %system %iowait %steal %idle
22.5% 0.0% 0.8% 1.3% 0.0% 75.5%
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
loop0
…

Dmitry Maslennikov
- 66
- 2
1
vote
0 answers
Multi-Queue (MQ) in SCSI and iSCSI
I have a question regarding multi-queue (MQ) in SCSI layer and consequently iSCSI. Apparently there is good technical and scientific literature explaining multi-queue (MQ) on block layer level. But there is rarely any good explanation that how this…

BZKN
- 1,499
- 2
- 10
- 25
1
vote
1 answer
Default BlockDeviceMappings settings for AutoScaling::LaunchConfiguration
We are using CloudFormation to create an EC2 machine using AWS::AutoScaling::LaunchConfiguration, but we never really specified the BlockDeviceMapping to use:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
AssociatePublicIpAddress:…

Titulum
- 9,928
- 11
- 41
- 79