Skip to main content

Questions tagged [block-device]

A data storage device that supports reading/writing data in fixed-size blocks, sectors, or clusters.

Filter by
Sorted by
Tagged with
1 vote
1 answer
18 views

join files/devices in linear mode together in a linux system

In order to test joining 3 files linearly on my Linux system, I do: fallocate -l 100M file1.image fallocate -l 150M file2.image fallocate -l 50M file3.image and then I run losetup: losetup /dev/...
user447274's user avatar
3 votes
2 answers
1k views

How shall I find the device of a phone's storage so that I can mount it in Linux?

I plugged an Android (HarmonyOS 2.0.0) phone into a Linux laptop using USB connection. I want to mount the storage of the phone in Linux, so that I can transfer files between the phone and the laptop. ...
Tim's user avatar
  • 103k
0 votes
1 answer
35 views

Naming of SAS block devices under /dev/disk/by-id?

When one uses SATA SSDs or HDDs under Linux, they can be addressed in numerous ways, like for example: /dev/sda /dev/disk/by-id/ata-TOSHIBA_MG05ACA800E_78LBK8P7FUUD /dev/disk/by-id/wwn-...
T. Pluess's user avatar
  • 552
0 votes
0 answers
44 views

Writing a filesystem on top of block device in Linux

I have a custom file-system driver, which is a glorified tmpfs. I'd like to modify it to run on a zram block device, such that the underlying data is compressed. Unfortunately, I'm having a lot of ...
user11809993's user avatar
0 votes
0 answers
24 views

What happens if the block driver returns I/O error when handling addr fault for swap

If a block device was attached as a swap space, there can now be virtual addresses which require operation from the block driver to be read/written. When such address is accessed, a page fault is ...
melonfsck's user avatar
0 votes
1 answer
29 views

Does Linux Log Unreadable/Unrecoverable Sectors from Drives?

Occasionally a drive sector is so corrupted that even the controller cannot fix it, and the data is lost. It may then be marked as a bad sector. Does Linux make a log of such lost data in journald or ...
Sepero's user avatar
  • 1,619
6 votes
2 answers
191 views

EPERM when formatting block device on a FUSE filesystem

TL;DR Attempting to format a block device on my FUSE file system fails with EPERM at the open syscall. Permissions are set to 777 and the necessary ioctls are stubbed, but no logs are printed from ...
J-Cake's user avatar
  • 229
0 votes
0 answers
63 views

SAS drive read-only (write protect on)

I have never had any SAS drive until now and have recently purchased an Fusion-MPT 2 controller: 04:00.0 SCSI storage controller: Broadcom / LSI SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03) ...
Jonas Mechtheim's user avatar
0 votes
0 answers
52 views

How to set block device name using udev rules based on sdcard reader serial number

I have sdcard reader and I want to set block device names to /dev/sdcard2 and their partitions will be named /dev/sdcard2p1 /dev/sdcard2p2 /dev/sdcard2p3 ... (based on partition count of specific card ...
T0maas's user avatar
  • 113
11 votes
2 answers
1k views

Differences Between `/dev/null` and Devices Under `null_blk` Driver

I recently encountered the Linux Null Block device driver, null_blk, while I benchmarking the I/O stack instead of on a specific block device. I found the devices created under this driver (let's use ...
JGL's user avatar
  • 147
0 votes
0 answers
35 views

Block size output from lsblk and blockdev don't match

Why the output of LOG-SEC column and --getbsz in the following don't match? Are these values of different quantities? How to find actual values? And is the output of following stat command always ...
Porcupine's user avatar
  • 2,056
0 votes
1 answer
76 views

turn on/off an external usb hdd with UHUBCTL

I need to turn on/off an external usb hdd on my Proxmox VE 8 zimaboard832 (Debian 12 Bookworm) automatically. It's possibile with uhubctl? If it is, how can i make a turn_on/off bash script safely?
Alessandro's user avatar
1 vote
1 answer
42 views

Is it safe to write to file's extents directly while the FS is r/w?

Given any file on an ext4 filesystem, it is possible (using filefrag -v) to get the list of real offsets+lengths where that file is located on the underlying block device. Is it safe to open the ...
melonfsck's user avatar
4 votes
1 answer
477 views

Why a filesystem is unmounted but still in use?

I was using ext4 filesystems for a long time, and it's the first time I see a weird behavior of ext4 filesystem. There is ext4 filesystem in /dev/dm-2 An I/O error happened in the underlying device, ...
melonfsck's user avatar
2 votes
2 answers
307 views

Finding offset of a filesystem in LVM relative to beginning of a drive

Finding offset of a filesystem that resides directly on a partition is easy: check the partition start sector, multiply by sector size, done. What if the filesystem lives inside LVM? I could scan the ...
gronostaj's user avatar
  • 708
0 votes
1 answer
54 views

Create symbolic links to block devices by partition table UUID

Within /dev/disk, there are the folders by-id, by-label, by-partlabel, by-partuuid, by-path, and by-uuid. Is there a way to make what software responsible for this create a directory called by-ptuuid ...
Melab's user avatar
  • 4,148
7 votes
2 answers
2k views

How does EXT4 handle sudden lack of space in the underlying storage?

Usually, block device drivers report correct size of the device, and it is possible to actually use all the "available" blocks. So, the filesystem knows how much it can write to such device ...
melonfsck's user avatar
0 votes
1 answer
60 views

How are block devices physically addressed in a file system

In this book, the following is mentioned about filesystem addressing: A file system does not need to concern itself with where on the physical media a block should be put, that is the job of the ...
user1234234's user avatar
8 votes
5 answers
1k views

How to programattically determine the device name/basename of the root partition?

Ref: The following question Drive name? What is the correct term for the "sda" part of "/dev/sda"? Given: I have a system, (in this case a Raspberry Pi, but this could be relevant ...
Jim JR Harris's user avatar
1 vote
1 answer
112 views

Get /dev entry for USB on a Mac

I have never used a Mac before and have no idea what I'm doing. I need to run dd on a USB device to copy data off. I plug the device in, and it shows up in system_profiler SPUSBDataType. How do I ...
Nate's user avatar
  • 154
3 votes
1 answer
59 views

Loop partitions disappear on rebind

When I create a 400MB file called /tmp/foo, then call losetup -f /tmp/foo, this creates a loop device /dev/loop15. If I then partition the loopdevice and format it to contain ext4,ntfs, and fat32 ...
mo FEAR's user avatar
  • 192
0 votes
0 answers
56 views

How to make a loopback device appear and behave as a (removable) block device?

If I create a loopback device, I can mount it manually, but it doesn't show up in Plasma "Disks & Devices" as a newly attached Storage Volume (Removable Media), nor does it appear as an ...
mo FEAR's user avatar
  • 192
1 vote
0 answers
30 views

Why doesn't accessing /dev/loopX raw update correctly (in real-time) when contents are modified?

If I create a file, such as /tmp/vdev (400KB in size and formatted to ext4) then map it to /dev/loop18, and then mount the /dev/loop18 to /tmp/mnt, and then create a text file under /tmp/mnt and write ...
mo FEAR's user avatar
  • 192
1 vote
1 answer
115 views

What is the difference between "filesystem readahead" and "readahead"?

From man 8 blockdev: The utility blockdev allows one to call block device ioctls from the command line. My question is about the following options: --getfra Get filesystem readahead in 512-byte ...
Kamil Maciorowski's user avatar
2 votes
1 answer
39 views

Why do /dev/ramX devices have all 0's in /proc/diskstats?

Is there away way to turn on IO accounting for /dev/ramX block devices in Linux? I already tried echo 1 > /sys/block/ram1/queue/iostat but it did not work. Notice that all devices have stats except ...
KJ7LNW's user avatar
  • 495
3 votes
2 answers
1k views

Are there any benefits in setting a HDD's logical sector size to 4Kn?

Modern HDDs all are "Advanced Format" ones, e.g. by default they report a logical/physical sector size of 512/4096. By default, most Linux formatting tools use a block size of 4096 bytes (at ...
ChennyStar's user avatar
  • 1,795
0 votes
1 answer
724 views

/var/lib/snapd/snaps/*.snap: can't open blockdev errors keep coming back despite several tries to remove totally snap

I'm running Ubuntu 23.10 on a I9 cpu + Nvidia Geforce RTX 2080 ti and the driver 545 right now. Everything works great,but not snap. I've tried to remove it as soon as I have installed Ubuntu from ...
Marietto's user avatar
  • 549
0 votes
0 answers
81 views

how to check if the IO was hanging

Are there any method I could use in centos to check if the block device under the IO was hanged? I tried to check the /proc/diskstats, but it is not obvious enough to show if there is an hang there. ...
lei wang's user avatar
1 vote
0 answers
49 views

Can I invalidate the buffer cache of a block device?

I have a system which is a USB gadget. It exposes one of its partitions over USB using functionfs to allow the host to provide update files: set -e CONFIGFS_ROOT=/dev/gadget CONFIGFS_DEV=$...
Toby Speight's user avatar
  • 8,770
0 votes
0 answers
49 views

Searching a 1T block device for a specific byte sequence at a specified offset

I'm performing data recovery after an accident with dd. In the longer term, I'll need to use some recovery tools to try and repair the file system In the meantime, there's an image on the system that ...
user587941's user avatar
0 votes
1 answer
122 views

Question on tuning file system cache in Linux UBIFS on MTD

I am working on an embedded Linux system, where kernel is 5.10.24, and UBIFS on MTD is used. The testing team had a test, which writes a disk file (open, write, close in order), then powers system off....
wangt13's user avatar
  • 443
0 votes
1 answer
35 views

Schedule IO problem via udev by-id

As the title, i'm trying to set the scheduler from boot by inserting the various disks using the udev rules. The problem is that indicating the disk by id (/dev/disk/by-id) in the udev rules (in the ...
vincenzogianfelice's user avatar
0 votes
2 answers
99 views

How can I find the device file for a phone, so that I can mount it on my Linux?

I connect a phone to my Linux laptop using USB. I click File Transfer option in the pop-up window on the phone. In order to mount the phone on my Linux, I have to find the block device on my Linux. I ...
Tim's user avatar
  • 103k
1 vote
0 answers
107 views

How do I write a kernel driver for a custom partition table format?

I have a number of hard disks that use a proprietary partitioning system. The disks don't contain partition tables themselves, but each have a known number of partitions at fixed positions with fixed ...
User's user avatar
  • 111
0 votes
1 answer
392 views

What is the difference between these two blockdev declarations?

In Debian bullseye, I am starting virtual machines using QEMU / KVM by command line (i.e., without virsh or other helpers / wrappers). One of those VMs starts from a block device that is declared as ...
Binarus's user avatar
  • 3,420
1 vote
1 answer
144 views

Partial fsyncs when writing to block device

I'm writing my own data store directly on top of a block device. To ensure durability I want to sync to disk. But here's the thing: I want to sync only part of it. I'm keeping a journal for crash ...
Jille Timmermans's user avatar
0 votes
2 answers
243 views

Problem with block devices for virtual machines

I have two block devices in my host that I am trying to pass to a VM guest. One works perfectly while the other does not. The only difference is one is a logical volume on an internal drive while the ...
StrongBad's user avatar
  • 5,301
2 votes
1 answer
1k views

Is there any tool in Linux to track the amount of read/write requests to a block device in the past hour?

I am conducting a performance experiment for a Linux program that takes input data, processes it, and writes data to a block device Even though I know how much data the input is (for example, 1GB), I ...
Dachuan Huang's user avatar
1 vote
1 answer
3k views

Can't disconnect nbd device

I made an .qcow2 image and mounted it as described here: https://bytefreaks.net/gnulinux/how-to-mount-a-qcow2-disk-image-that-does-not-contain-an-ubuntu-lvm-installation But I have a problem with the ...
MijatTomić's user avatar
1 vote
2 answers
75 views

zsh completion: complete block devices in /dev

for my script, I need to complete block devices in /dev, so that when I do my_script.sh <TAB> it will complete /dev/ and offer me all disks that are listed in /dev (not in subdirectories). So ...
Martin Vegter's user avatar
0 votes
0 answers
36 views

Conflict with multiple SDcard readers of the same brand connected at the same time

I have some Lexar UHS-II card readers (I believe the model is LRWM05U-7000), and when I connect more than one I realize some operations read/write from/to the wrong reader. Some apps do not even ...
TonyStacker's user avatar
31 votes
11 answers
4k views

How can I protect /dev/sdX against accidental formatting?

I am very often dealing with formatting USB drives, that are registered as /dev/sdX. This includes executing mkfs and fdisk and mount and other commands usually executed as root. However, I fear that ...
KamilCuk's user avatar
  • 870
1 vote
1 answer
432 views

Why is the size of a block device always zero?

Why is the size of /dev/sda always zero? You have to run commands like: blockdev --getsize64 /dev/sda or cat /sys/class/block/sda/size to get the size. You cannot use ls. What is the reason for that?...
zomega's user avatar
  • 972
2 votes
0 answers
73 views

Can systemd be used to dynamically set a system-wide write bandwidth limit for a block device?

I would like to dynamically set a system-wide limit on the write bandwidth for certain block devices. The devices are pluggable and managed by our own service. Currently the service sets/removes the ...
starblue's user avatar
  • 636
3 votes
1 answer
1k views

Why is DM-Integrity so slow compared to BTRFS?

I want to detect silent corruption of block devices similar to how BTRFS does that for files. I'd even like to do that below BTRFS (and disable BTRFS's native checksumming) so that I can tweak more ...
ATLief's user avatar
  • 318
1 vote
1 answer
1k views

What is the impact of different Linux I/O APIs on performance benchmarking of NVMe SSDs? (libaio vs SPDK vs io_uring)

I am benchmarking NVMe SSDs on my Linux server, with the aim to achieve the IOPS, BW and Latency values as mentioned in the product specifications. I'm using FIO as workload generator, and used libaio ...
Jaideep Khare's user avatar
0 votes
1 answer
243 views

iSCSI target implementation is User Space

I want to write my own implementation of iSCSI target where in I want to interrupt read/write calls to block device and serve them from my custom storage implementation. Is there any default library(...
Uday Swami's user avatar
0 votes
1 answer
69 views

Is there any OS-level caching for bare block devices? If so, how do I bypass it?

If I read and write directly to a block device (e.g. /dev/sda1), is there any OS-level caching involved on Linux? If so, how do I bypass it, is opening with O_DIRECT enough? I'm writing a simple ...
JanKanis's user avatar
  • 1,131
2 votes
0 answers
388 views

Is it safe to change read ahead setting on a live server

After going through Elasticsearch's documentation I realised that the recommended read ahead value is 128KiB while I am currently using 256KiB on a live server. It is only indexing data and not ...
Nick Garlis's user avatar
0 votes
0 answers
782 views

How can I order /dev/sdX block devices names by hardware path on Linux?

I know about persistent block device naming, using /dev/disk/by-{id,path,uuid,...} and how it is best practice to use those persistent names in system config (fstab, scripts) instead of /dev/sda for ...
Totor's user avatar
  • 20.3k

1
2 3 4 5
10