Questions tagged [blkid]
17 questions
4
votes
3 answers
How to get disk name programmatically in Linux(Like "/dev/sda" or "/dev/sdb")?
I am trying out to find information related to Disk and partitions.
Following are my code. But problem is that, I am passing disk name through command line by querying disk name from "/proc/partitions". Is there any api which can give me disk name…

Ravi Bhushan
- 253
- 3
- 17
3
votes
1 answer
libblkid only works with root and after running as root
This is the weirdest thing that I've ever seen (actually, it has a nice explanation).
I created a C code to list partitions and its own types:
char *get_luks_partition(void) {
blkid_dev dev;
blkid_cache cache;
blkid_dev_iterate iter;
…

jcfaracco
- 853
- 2
- 6
- 21
3
votes
0 answers
Linux driver kthreads and blkid task
I'm currently creating a Linux driver for block devices. This has been going on for some time, and I just recently changed the driver design from bio-mode to request-mode (I used to handle struct bio but now I'm operating on struct request) and it…

ubermensch
- 363
- 2
- 12
2
votes
0 answers
blkid on docker container
I am working on a legacy C++ project which uses functions from blkid/blkid.h to access files on the local hard disk.
Since the project is quite big and hard to compile/run, I thought it would be a good idea to run it in a container. Creating the…

Arnaud Potier
- 1,750
- 16
- 28
1
vote
1 answer
Bash cannot store info from blkid into a variable
I am trying to store the output of my parsed string into a variable. When I run the command like this I get the correct output on the terminal output:
$ blkid | grep -oP '(?<=LABEL=").+?(?=")'
MYUSB_NAME
However, when I try to store it in a…

tiger_groove
- 956
- 2
- 17
- 46
1
vote
2 answers
Regex to list blkid Labels
Apols but sure someone can provide this as regex just dont compute with me.
So say if I had this output from blkid if I wanted the UUID portion of the matching LABEL="Usb3Ext"
/dev/sda1: UUID="f2134523-0628-f8bd-359d-4f19069e2b6e"…

Stuart Naylor
- 43
- 6
1
vote
1 answer
command blkid don't show my partitions UUID
I'm using Ubuntu. command blkid or blk /dev/sda2 in LPIC-1 module 104.3 (mounting and unmounting). but these commands don't show me the expected results. blkid is installed and also I can see man blkid !!!
Could you guide me to fix this?

user2517728
- 57
- 2
- 6
1
vote
3 answers
how to get uuid of filesystem given a path?
I am handed a path of a directory ( sometimes path of a file ).
Which utility / shell script will reliably give me the UUID of the filesystem on which is this directory ( or file ) located / stored ?
( by UUID of filesystems I mean the "UUID=..."…

linfan
- 11
- 1
- 2
1
vote
1 answer
blkid_get_cache seems to leak memory
I am doing some linux programming and I encountered a situation where a library function from the blkid library leaks some memory... There is not too much documentation about it…

Ferenc Deak
- 34,348
- 17
- 99
- 167
0
votes
0 answers
How safe is it to use blkid for determining unformatted disks and formatting those?
For an automatic volume mount Ansible script, I use https://docs.ansible.com/ansible/latest/collections/community/general/filesystem_module.html to detect and format unformatted disks to allow mounting. That Ansible module again relies on blkid for…

Natan
- 728
- 1
- 7
- 23
0
votes
1 answer
How to fetch only the UUID by passing in the size of the disk?
I am trying to mount a disk using ansible automatically using the following command:
fdisk -l | grep "64G" | grep -Eo "/dev/sd."
This outputs /dev/sda1 and I am adding that to the /etc/fstab/. But I want to add the UUID instead.
Is there a method…

veeresh
- 61
- 2
- 11
0
votes
1 answer
Yocto - how to add blkid.h file to rootfs
I would like to add to some Yocto Linux distribution my own application that includes blkid.h file. In the .manifest file I found libblkid1 library and util-linux-blkid package but in the rootfs I have no such a file. Which package or library I…

tomi7654
- 15
- 4
0
votes
0 answers
How to decode a USB device label
I am trying to get a USB device label from the udev library. But I have a problem when the label is not in UTF8 encoding.
The USB device was previously formatted on Windows and has the FAT32 file system. The USB name is “РФПАЦУ” (I used Cyrillic for…
0
votes
1 answer
Can't mount /mnt/x after reboot
After rebooting my server, I saw through nagios that my /mnt/gimli was only reachable on read-only mode. But I need it to be writable because some backups go there.
To have in in rw mode, I tried unmounting and remounting /mnt/gimli, but got the…

Ethwall
- 9
- 3
0
votes
1 answer
How are BLKID 's Assigned?
Suppose I have a situation like I have installed /etc and /boot in two separate partition which belongs to an USB device , and the rest of the system / and /home in the HDD. Now my question is I need to statically route the USB device in my fstab ,…

Genocide_Hoax
- 843
- 2
- 18
- 42