Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [block-device]

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

2
votes
1answer
59 views

Short and long uuids under /dev/disk/by-uuid

There are several hard disk partitions on my system (Linux josDeb 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux). It is working with: bejo@josDeb:~$ ls -l /dev/disk/by-uuid ...
1
vote
0answers
19 views

dd command is initiating bios with read direction in device-mapper target

I setup a block level device-mapper target, and when I am writing to it using the following dd command: dd if=/dev/zero of=/dev/mapper/mytarget bs=4096 count=5 I have observed that there are a lot ...
1
vote
2answers
147 views

How to tell without knowing the mount point that a device UUID is mounted?

System: Linux Mint 19.1 Cinnamon 64-bit, based on Ubuntu 18.04 LTS. I would like to know if it is possible to get the following information: Is this UUID (of a block device) mounted or not? (without ...
0
votes
0answers
15 views

How do I do to detect both the disk (/dev/sd{x}) device and its sibling tty (/dev/ttyACM{y}) device when a composite USB ACM_MS device is inserted?

Suppose you have multiple embedded devices that enumerates as Composite ACM/Mass Storage devices (/dev/ttyACM0 <--> /dev/sdb, /dev/ttyACM1 <--> /dev/sdc, ...) when they get plugged to the ...
1
vote
1answer
24 views

lsblk lists a device, then says “not a device”

I'm seeing somewhat odd behaviour: % lsblk | grep sdb sdb 8:16 1 114.6G 0 disk └─sdb1 8:17 1 114.6G 0 part /run/media/...
0
votes
1answer
79 views

DRBD comes up after reboot with Connected Diskless/Diskless

After an unattented power loss, facing a major issue, every reboot the DBRB comes up with Connected Diskless/Diskless status. main problems: dump-md response: Found meta data is "unclean" ...
0
votes
0answers
17 views

Manually set MTD NAND oob (NAND oob geometry problem)

When mounting yaffs dmesg outputs: yaffs: NAND geometry problems: chunk size 512, type is yaffs, inband_tags 1 Reading I found some useful clues: This is caused by yaffs1 can not work with ...
0
votes
2answers
59 views

How to find the names of partitions of a given block device?

Given a block device (e.g, /dev/sda), how to determine the names of its partitions (if any) in a script (i.e. without user interaction)?
2
votes
2answers
51 views

Given a block device, how to detect if names of partitions must contain “p”?

I want to automatically partition a block device with sfdisk. This might be an SD card, a hard disk, SATA or NVME device. Initially I thought that sfdisk requires these names and thus I was looking ...
2
votes
1answer
76 views

Can ext4 filesystem withstand a bad sector (unreadable)?

If a hdd bad sector happens in the metadata for /home/user/me on an ext4 fs would that mean data loss for all subdirectories? Background: I know that many users are satisfied with the ext4 ...
1
vote
1answer
21 views

Can “parchive” be used for block devices?

As explained on wikipedia and Arch linux wiki "Parchive"s can be used to generate additional data for a file, that can be used in verification and even to some degree for repair/recovery of said file ...
2
votes
2answers
94 views

What do device type numbers mean?

file /dev/* prints the description of a bunch of files as "block special (M/N)" and "character special (M/N)", where M and N are numbers. For example: $ file /dev/null /dev/null: character special (1/...
0
votes
0answers
84 views

How to control order of disk devices during Ubuntu Linux installation?

I have an automated installation script (preseed file) for Ubuntu 18.04 which automatically partitions /dev/sda and /dev/sdb. I run this by booting from a USB drive, in "legacy BIOS" mode (so MBR is ...
0
votes
0answers
43 views

What are these Chromebook block devices?

I recently acquired an Asus Chromebook C201, which I am in the process of installing Linux on. I have installed Arch on an SD card, which is booting fine; however, the output of lsblk is different ...
1
vote
1answer
37 views

Is a block_device mapping a physical disk or a partition of the disk? [closed]

In the ULK(Understanding Linux Kernel) book, the author says each block device has its own driver. The question is, does the block device here represent a physical disk or just a partition of the disk?...
2
votes
0answers
15 views

Find the size of all relevant caches when doing I/O

So, I'm looking at the stats from iostat, which updates every few seconds, and I see that I/O to device happens in bulks, say, around 40M/s, once every half a minute or so. I'm debugging an ...
4
votes
1answer
504 views

What is good block size for file cache on Linux?

The device block size is usually 512 bytes while the filesystem block size is often 4096 bytes. Why are they different? Why are 512B and 4KB good choices for device and filesystem block sizes? What ...
0
votes
1answer
50 views

how to understand the dmesg

we have redhat machine version 7.2 and each machine have disks as sdb sdc sdd sde sdf in the dmesg report we get the following [873080.996700] Buffer I/O error on device sdf, logical block ...
3
votes
1answer
130 views

Adding Events to Udev Event Queue

One of my udev rules runs a script on removal of USB storage devices. This script performs some general cleanup and removes the mount point directory for the storage device. The issue is that I want ...
5
votes
0answers
96 views

Why does one kernel work, but the other doesn't, when they are identical to the byte? [closed]

I have a couple of scripts, that build Linux live CDs for me. I have a couple of kernels, that I built myself to use for these. Having built one such Live CD a couple of weeks back with a kernel, ...
0
votes
0answers
26 views

What are the contents in /sys/block when ubuntu is a virtual machine?

I am very confused to how /dev/dm-1 was being used as a swapspace by my Ubuntu guest Virtualbox VM. gparted doesn't show these drives. What is going on here? How does the same drive dm-1 have ...
0
votes
1answer
19 views

Can I redirect block storage devices to each other?

Obviously what I'm about to describe is better handled by rsync or cp, but... Say I have two drives on my computer. Could I make one a perfect image of the other with the following command? Would ...
0
votes
1answer
74 views

Creating Persistant Symbolic Link -Linux

I have a cloud server, where a block device (/dev/xvdb1 with filesystem ext3) is attached . I want to create a persistent symlink (/dev/test_link) which should always target to (/dev/xvdb1) using ...
0
votes
0answers
22 views

Lifespan of blocks in a UNIX block-cache

Recently, I've been getting into OS development and have been experimenting with writing my own small kernel. I've just begun to look understand and implement a block-cache, for caching data read from/...
2
votes
1answer
862 views

Permanently mounting loop device

I created a file touch /datastore/virtual/pseudoblock created a loop device with it sudo losetup /dev/loop0 /datastore/virtual/pseudoblock (although I got a warning about its size) and then ...
1
vote
1answer
61 views

Using command (dd if=/dev/mmcblk0p1 | sha1sum) while running from initramfs

I have an opensource airgapped raspberry pi project seen at the following link: www.privatekeyvault.com I have provided a method for installing LUKS full disk encryption seen at the following: https:/...
0
votes
2answers
330 views

How do I access an SD card via command line in Chrome OS?

I'm trying to use the command line in terminal to unzip a massive .zip archive on my SD card. My understanding is that normally, I would locate the SD card in /dev/, mount the card, and then I should ...
0
votes
0answers
26 views

Mapping part of a block device: dmsetup vs losetup

Suppose I want to create a virtual block device from an area on already existing block device. I can use either dmsetup (device mapper) or losetup for this purpose. What are practical differences ...
2
votes
2answers
41 views

Does output redirection to a block device overwrite bytes or whole blocks?

A comment on another question made me wonder: Assuming I redirect the output from a command to a block device, and the length of that output is less than the block size of the block device: % ...
0
votes
0answers
43 views

How can I get parent, children, siblings of a block device in Linux?

I need an algorithm, that can determine the possible children, parents and siblings for any given block device (virtual or physical). In the past I have solved that problem for multipath devices and ...
1
vote
0answers
31 views

Distributed Block Device Cache for Linux

Is there an open source software available for Linux that implements a new block device based on an underlying block device (DRBD or shared SAN) and a distributed memory cache ? What I'm looking for ...
11
votes
4answers
3k views

Why does one need a loop device at all?

I previously used to create image files using dd, set up a filesystem on them using mkfsand mount them to access them as mounted partitions. Later on, I have seen on the internet that many examples ...
0
votes
0answers
56 views

Broken links in /dev/disk/by-path

I work with a lot of low quality USB flash memory modules - some of them can even hang the USB controller and block all traffic until I remove them. I'm testing these drives using f3 and a custom ...
2
votes
0answers
25 views

Remove spaces from Auto-mount mountpoint

Is it possible to remove spaces from auto-mount mount point label? For example: If insert a thumb drive that has the name "Device Name With Spaces" it should auto-mount to /media/...
2
votes
1answer
168 views

Block device cache v.s. a filesystem

Block devices provide buffering. This means that write() on a block device can return success, before the kernel has written the data to the device. A program can wait for all the buffered writes by ...
3
votes
1answer
293 views

Is a device being a block or character device determined purely by hardware?

From https://unix.stackexchange.com/a/472920/674 A "character device" and "block device" are abstractions, usually used in Unix-style systems in classifying various devices. Is a device being a ...
-2
votes
1answer
80 views

Why is the transfer unit of block devices block not page?

Operating System Concepts says A character-stream device transfers bytes one by one, whereas a block device transfers a block of bytes as a unit. But I heard that the unit of transfer between main ...
0
votes
2answers
134 views

Do “serial ports” or “parallel ports” apply to character devices only, but not to block devices?

From http://haifux.org/lectures/86-sil/kernel-modules-drivers/node10.html A Character ('c') Device is one with which the Driver communicates by sending and receiving single characters (bytes, ...
-4
votes
1answer
53 views

Are there implications between block/character device and random/sequential access? [closed]

Operating System Concepts says: Devices vary on many dimensions, as illustrated in Figure 13.7. • Character-stream or block. A character-stream device transfers bytes one by one, whereas a ...
-1
votes
1answer
198 views

Can filesystems be created only on block devices, but not on character devices?

Can filesystems be created only on block devices, but not on character devices? Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)? My guess is ...
0
votes
0answers
31 views

policy justification for requiring that block devices use power-of-two block sizes?

This question applies to all unices, but I'm interested mainly in the Linux kernel -- unless there are unices that don't have this restriction. It seems like allowing non-power-of-two block sizes ...
0
votes
0answers
54 views

findmnt, mountinfo show non-existent partitions

I noticed findmnt -n -o SOURCE --target MOUNT_POINT was returning lines containing block devices that didn't exist on my system: TARGET SOURCE FSTYPE OPTIONS /home/...
2
votes
2answers
331 views

Why can I (or cannot) mount a mounted device again? What is happening?

Why can I (or cannot) mount a mounted device again? What is happening? For example: /tmp/test$ sudo mount /dev/sda5 ./1;echo ${?} 0 /tmp/test$ sudo mount /dev/sda5 ./2;echo ${?} 0 /tmp/test$ sudo ...
1
vote
1answer
52 views

For what purpose does a block device driver use minor numbers?

After reading the chapter about block device drivers in the book "Understanding the Linux Kernel" I am a bit confused about the usage of minor numbers. I have read before about major and minor numbers ...
3
votes
0answers
138 views

How does the Linux kernel decide if a block device gets the read-only flag set by default?

I have a USB stick which (for about 2 months) constantly gets mounted read-only. After a bit of research and testing I found out, that the block devices of the device itself (/dev/sdc) and one of the ...
1
vote
0answers
52 views

How can I xor two block devices together?

I'm looking for a way to create a virtual block device that when accessed returns the XOR of two block devices. I feel like dmsetup would be used here somewhere but I can't find anything related to ...
0
votes
1answer
589 views

Udev Rules Not Running

I'm playing with Udev Rules on OpenSuse Leap, and I'm trying to run a simple and small script once a USB device is plugged into my system. However, my script which I added in my keyword "RUN+=" does ...
0
votes
1answer
50 views

Given a block device file, how can I list all relevant partions?

Given a device file (ex: /dev/sda) how can I get a list of all relevant partitions? Expected input: /dev/sda Expected output: /dev/sda1 /dev/sda2 /dev/sda3 ... I know there are many ways to get ...
1
vote
1answer
590 views

USB drive not detected

I had an USB on a headless raspberry pi running debian, but after rebooting without unmounting (there were programs running on the mounted folder), I couldn't use the USB anymore. The following is the ...
2
votes
0answers
74 views

Find all blocks on device not used by the filesystem

How can I list all blocks on a device that are currently not being used by the filesystem? The filesystem in question is a btrfs RAID1 with two LUKS encrypted harddrives an Arch Linux. I have tried ...