As of May 31, 2023, we have updated our Code of Conduct.

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
0 votes
1 answer
15 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,041
0 votes
1 answer
31 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
0 votes
1 answer
49 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
45 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 ...
400 the Cat's user avatar
0 votes
0 answers
20 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
30 votes
10 answers
3k 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
  • 844
0 votes
0 answers
13 views

debugfs mi output shows different block count than the number of block references!

I have a file for which the the mi (modify inode) option gives different block count and block references : debugfs: mi <4762313> Mode [0100644] ...
Sam's user avatar
  • 1
0 votes
1 answer
84 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
  • 811
2 votes
0 answers
25 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
  • 596
1 vote
0 answers
398 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
  • 270
1 vote
1 answer
388 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
100 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
28 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
  • 989
1 vote
0 answers
133 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
197 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
  • 19k
0 votes
2 answers
303 views

Can device numbers change after reboot?

I'm building a service that checks for file uniqueness on block devices. File uniqueness on a system appears that it can be guaranteed through the pair (st_dev, st_ino), where st_dev is the device ...
dlq's user avatar
  • 111
1 vote
0 answers
122 views

udev - nr_requests on block device not applying on boot but all other rules run correctly

My Rules KERNEL=="sd*",ACTION=="add|change",ATTRS{model}=="PERC_H755N_Front",\ ATTR{queue/nomerges}="2",\ ATTR{queue/nr_requests}="...
Grant Curell's user avatar
0 votes
2 answers
135 views

How do I find out what is the hard disk for OS in Linux

in our bash scripts , we have many places in the code that need to capture only the disk that related to OS ( operation linux/RHEL system ) we are using Linux versions as 7.2/7.5/7.6/7.9 , and on most ...
yael's user avatar
  • 12.4k
0 votes
1 answer
72 views

ioctl problem with partition

There is a path to the file, I make a write disk cache request via ioctl - ioctl(fd, SG_IO, &ioHdr). printk: sending ioctl 2285 to a partition!? how to find out which block device a partition ...
unite101010's user avatar
0 votes
0 answers
115 views

udev not generating /dev/disk directory in yocto linux build

I have built a yocto linux image for a SAMA5 board. After I booted, udev did not generate the /dev/disk/ directory and related symlinks. I already have udev and systemd in the system. $ udevadm --...
Arun Cheriyan's user avatar
1 vote
1 answer
618 views

On Linux, is it possible to know if disk size was changed without rescanning the disk?

After changing a disk size in VMware (for example increasing it by 10 more GB), the next step is to rescan it in Linux so that kernel identifies this size change. For this we use this command: echo 1&...
yael's user avatar
  • 12.4k
0 votes
0 answers
66 views

How to increase the Max Data Transfer size for the mmc driver via ioctl

I am using the mmc driver in the kernel and using the IOCTL to transfer data using CMD25 and CMD18. As per the IOCTL, the max data transfer size for read write is 1024 Blocks of 512 Bytes each. But ...
nishad kamdar's user avatar
0 votes
0 answers
52 views

How can I trace file system access from a block device?

I'm trying to analyze the activity on a block device with a vfat file system (USB, to be specific, I'm emulating a USB drive with g_mass_storage with a Pi Zero). The device accessing it is out of ...
Thorsten's user avatar
0 votes
1 answer
228 views

is mount option "sync" valid for all filesystems

I want to have an script that automatically mounts all USB drives on insert (granted they have a block/filesystem that is a valid partition). My questiosn is: is sync an option that can be applied to ...
DEKKER's user avatar
  • 764
0 votes
0 answers
184 views

Getting "erase_size" related error when mounting a jffs2 rootfs into a block device

Trying to mount a jffs2 image into a virtual block device, following this guide The steps are as follows, summarized: sudo mknod /tmp/mtdblock0 b 31 0 sudo modprobe mtdblock sudo modprobe mtdram ...
DummyBeginner's user avatar
0 votes
0 answers
406 views

iostat returns disk utilization greater than 100% while profiling a Beaglebone Black board

I need to profile the performance of software running on a BeagleBone Black (BBB). The BBB has an ARM Cortex-A8 up to 1GHz frequency, 512MB RAM, and 4GB eMMC onboard flash storage. You can find more ...
vnzstc's user avatar
  • 1
0 votes
1 answer
116 views

Mount filesystem with DAX enabled on RAM

I am trying to mount a filesystem with DAX feature on RAM. I used this answer to load brd module and get /dev/ram0. Then I tried all 3 filesystems that support DAX: ext2, ext4 and xfs. However, when I ...
Ana Khorguani's user avatar
20 votes
4 answers
4k views

What is `/dev/sda0`? Is it a standard thing?

While trying to understand this other question, I encountered /dev/sda0 being mentioned. I have some experience in Linux and I'm used to this scheme where sda, sdb, … are devices and sda1, sda2, … , ...
Kamil Maciorowski's user avatar
1 vote
1 answer
518 views

Backup created with rsync takes up more space on external drive than on source

I am using rsync to make a backup of Ubuntu running on a Raspberry Pi. I exclude all the usual directories whose contents are only created after boot up anyway. The rsync writes to a backup image that ...
FlexMcMurphy's user avatar
0 votes
2 answers
338 views

USB connection from display detected as storage device

I have an MSI Optix MAG245R 23.8" display. It features USB connections. When I start up my Debian-based machine (BunsenLabs), I get warnings that say: May 4 19:41:51 localname kernel: [ 240....
Kit's user avatar
  • 1,023
1 vote
2 answers
423 views

How to check if a LUKS device is unlocked, without sudo permissions?

Is there any way to check if a LUKS device is unlocked, without having sudo permissions? I'm aware of two questions, but all the answers require sudo. It seems that I've found an indirect way (...
Marcus's user avatar
  • 859
1 vote
0 answers
1k views

Partition detected as in use even after successful unmount?

I'm having a USB disk which I unmount and want to perform some actions on it (i.e. do a file system check). Even though the disk was unmounted the system complains that it's still in used. The OS in ...
TheMeaningfulEngineer's user avatar
1 vote
0 answers
28 views

Why are loop0 and ram1 getting mixed up?

I've been rolling my own "minimal" linux system under WMware based on the 5.15.x kernel. I don't use an initramfs but do include support for the default max 16 ramdrives in the kernel build ...
Okhariatane's user avatar
0 votes
1 answer
207 views

"stat /etc" size mismatch: 24 blocks, size 8192 instead of 12288

My stat /etc command shows that the number of blocks is 24. I understand that a block here means 512 bytes. So the total size is 24 × 512 which makes it 12288 bytes. But it shows 8192 bytes instead, ...
TheRoguePrince's user avatar
0 votes
1 answer
43 views

Shrink partitionless filesystem

I have data on a disk that I want to encrypt by cloning the full filesystem of that disk (source) to a virtual block device (devicemapper/cryptsetup) based on an additional disk (target) of identical ...
user236012's user avatar
  • 2,095
-1 votes
1 answer
628 views

fdisk prints nothing and devices are not mounted

I am quite new to Linux, and I need to mount some devices, using the lsblk command and more. lsblk presents the devices (internal, I don't have external ones) the output is: # lsblk NAME ...
ayala's user avatar
  • 1
3 votes
3 answers
1k views

ls -ls output shows larger number of blocks than the file size

As far as i know the ls command with the "-s" option print the file size in blocks , ls uses the 1024 as block size , but i noticed something weird . For better understanding consider the ...
Colin Jack's user avatar
0 votes
1 answer
2k views

What does command do: `badblocks -svn /dev/sda`? does it just report the bad blocks?

This command: badblocks -svn /dev/sda What does it do? Does it just report the bad blocks? Or does it somehow handle the bad blocks so that I don't need to be worried about them? I read the manual by ...
user3405291's user avatar
  • 1,477
1 vote
1 answer
733 views

How to disconnect/disable MMC SD card

I have non USB MMC/SD reader slot . If a user inserts SD card, I want to be able to disconnect the SD card, or Disable the reader. (in case I detect malicious card). How can I do this? With umount, I ...
jivangilad's user avatar
0 votes
0 answers
65 views

How to block all wireless non-bluetooth devices using udev

How to block all wireless non-bluetooth devices in udev (that require an USB adapter to attach to computer) ? I want to block permanently all wireless HID devices such as wireless mice or keyboard .
Bob's user avatar
  • 23
0 votes
1 answer
37 views

How safe it is to list /dev/block for non virtual drives to determine hard disks on the system?

How safe it is to determine hard disks on the system by using the following approach (I am particularly obstinate in avoiding non-kernel utilities/programs): ls -l /sys/block | grep -v "/virtual&...
Veverke's user avatar
  • 328
0 votes
0 answers
658 views

How to access files in USB in linux

I'm using Ubuntu 20.04, recently (almost a week ago) I upgraded my kernel from 5.11.0 to 5.14.0 and after that I can't access any USB drivers. The system recognises my USBs since when I run lsusb it ...
Adeeb HS's user avatar
1 vote
1 answer
228 views

how can I dd ONLY last portion of drive that hasn't already been dev/zero'd

I regularly dd a drive to erase them for ZFS resilver, when something goes awry with read/write or checksum error, to put the drive back into service. Frequently, removing the partition table at the ...
Brian Thomas's user avatar
0 votes
1 answer
230 views

What happens when an SD card gets connected to a Linux computer

I'm still quite confused as to how this works exactly. When we connect an SD card to a computer running a Linux system, this is my understanding (Please feel free to correct on the smallest of details ...
Engineer999's user avatar
  • 1,111
1 vote
1 answer
210 views

The `file` command correctly identifies my LUKS device but the kernel doesn't see it

I recently created a LUKS2 device with a native --offset of 4MiB. The file command correctly identifies the device and lists its UUID, but it is neither auto-opened at boot nor visible in /dev/disk/by-...
ATLief's user avatar
  • 270
3 votes
2 answers
769 views

Does Linux update the size of a block device?

In the light of emmc wearout monitoring I'm wondering about the size as displayed inside a running Linux OS. An emmc chip has an internal manager which keeps track of the usage intensity of all the ...
Whois_me's user avatar
0 votes
1 answer
151 views

Linux gaslighting me by pretending to write to USB

When I boot my Linux and start writing to a USB-backed block device, everything goes fine for the first few times. Afterwards, if I write to it once more, dd reports absurdly huge transfer rates (2.9 ...
Poopoo's user avatar
  • 17
0 votes
0 answers
324 views

Who is causing Device or resource busy when mounting a block device?

I have plugged a HDD with some partitions to a Linux box, but when I try to mount them it fails: [root@il ~]# mount -oro /dev/sdb1 /media/sdb1 fuse: mount failed: Device or resource busy It's not ...
basin's user avatar
  • 1,881
0 votes
0 answers
135 views

Are direct writes to block devices buffered? How do I ensure it's written to disk before removing it?

Say I do something like dd if=file of=/dev/sdc (simplified for illustration), is this buffered? Can I sync it like I would any other filesystem write, or do I need to do something else to make sure ...
Daffy's user avatar
  • 345
0 votes
1 answer
28 views

Partition not resized despite empty space on device

It seems that the device /dev/sda has plenty of space available root@Vanuatu:~# sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL | grep -v loop NAME FSTYPE SIZE MOUNTPOINT ...
pkaramol's user avatar
  • 2,475

1
2 3 4 5
9