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
1 answer

How to retrieve underlying block device IO error

Consider a device in the system, something under /dev/hdd[sg][nvme]xx Open the device, get the file descriptor and start working with it (read(v)/write(v)/lseek, etc), at some point you may get EIO. How do you retrieve the underlying error reported…
kreuzerkrieg
  • 3,009
  • 3
  • 28
  • 59
1
vote
0 answers

Block device - Get a struct device without using probe function

I'm currently learning linux device driver programming and I would like to control a hardware device using a block device driver. My hardware device uses three pins to communicate with environment Clock - output --> The data clock Data -…
Arkaik
  • 852
  • 2
  • 19
  • 39
1
vote
2 answers

qemu environment, two VMs write data to same block device

In linux qemu environment, one host server runs two virtual machines. I want to let two VMs write data into the same block device on host. Thus, I run the following two commands to expose host block device to two VMs. sudo virsh attach-disk VM1…
1
vote
1 answer

Why bdev_get_queue return NULL?

I developing a "filter" for block device (Linux, Ubuntu 16), during initialization of the filter-driver I have tried to the queue pointer for the backend (existen device), a body of the bdev_get_queue macro show cool comment "this never NULL", but…
1
vote
1 answer

Can't open physical disk device in macOS 10.13

I'm developing some low-level system tools that need to read the physical storage device. Prior to macOS 10.13, I was able to open /dev/disk0, /dev/disk1, etc. and read raw data from the device. But after upgrading, I'm no longer able to open these…
Dmitry Brant
  • 7,612
  • 2
  • 29
  • 47
1
vote
1 answer

Android: mount different userdata partition at boot

On my Samsung Note 10.1, I would like to be able to mount a different userdata partition. My goal is to achieve this at boot by modifying the init.rc script, since this seems to be setting up all file systems and mounting the partitions userdata,…
drZaius
  • 129
  • 2
  • 13
1
vote
2 answers

Linux kernel: How to get dev_t of whole disk from partitioned disk?

I want to retrieve the dev_t structure for a whole disk, given that of a partition on the disk. This is for for a blkext driver, like nvme. Something like: dev_t part_disk; dev_t whole_disk = get_whole_disk_dev_t(part_disk); I would like my the…
1
vote
1 answer

Sending FUA requests using libaio on Linux

I'm trying to access a block device (say /dev/sdb) using libaio. I works correctly, but I was wondering how to perform FUA (Force Unit Access) using the API of libaio. I must say the documentation I found on the subject is quite poor, hope one of…
OznOg
  • 4,440
  • 2
  • 26
  • 35
1
vote
2 answers

How to check if a Raw(unmounted) Windows Drive exists in Python

How would I check if a raw(Windows) drive exists in python? i.e. "\\.\PhysicalDriveN" where N in the disk number Right now I can check if a raw drive exists(as admin) by opening and immediately closing it. If there is an exception, then the raw…
Bryce Guinta
  • 3,456
  • 1
  • 35
  • 36
1
vote
1 answer

why just after initializing the zram read is issued before write?

I am newbie to Linux kernel and just started to know how zram works. Initial testing, I am seeing that READ is issued before WRITE just after the zram is being initialized. But I am just eager to know, why this is so ? As an activity I took the…
1
vote
1 answer

How is a process state updated to blocked state (TASK_INTERRUPTIBLE)?

When a process is waiting for I/O, how is the task state updated to TASK_INTERRUPTIBLE (that is, blocked)? Imagine this case, a process issues an I/O request to a block device. According to my previous thread, the process finally invokes…
Junji Zhi
  • 1,382
  • 1
  • 14
  • 22
1
vote
1 answer

AWS Block Devices name doesn't match with CentOS SoftLink

On AWS EC2 Block Device is identified as /dev/sda, /dev/sdf and /dev/sdg, but inside EC2 CentOS instance when I do ll /dev/sd* it gives following: lrwxrwxrwx. 1 root root 4 Feb 17 03:10 /dev/sda -> xvde lrwxrwxrwx. 1 root root 4 Feb 17 03:10…
1
vote
0 answers

Linux Circular Video Buffer

I have a 5MP 2592×1944 pixel camera that writes to GPU via DMA or to a YUV4:2:2 data file. As this is quite non standard nearly all camera viewing applications can not handle this data and I would only be able to analyze the data after recording. I…
uMinded
  • 595
  • 1
  • 9
  • 21
1
vote
1 answer

Redirect all output of stopped and resumed command to file or block device

How do I redirect the output of a process run in bash (4.2.45(1)-release (x86_64-pc-linux-gnu)) stopped with SIGSTOP (usually sent with Strg+Z on Debian based and possibly other systems) and resumed with fg or bg. Consider the following example with…
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
1
vote
0 answers

Listing block devices inside a Kernel module

I am writing a kernel module that lists block devices and their corresponding dev_t which I will use for tracing. The following is the structure block_device struct block_device { dev_t bd_dev; /* not a kdev_t - it's a search key…