Is there an easy way to determine the hexadecimal ID of the filesystem for a given partition? Say, I have a /dev/sda1 partition which is of "Linux" type having the filesystem ID of 83 (as shown by fdisk for example). I need to get this number from a bash script without parsing the output of fdisk/sfdisk.
Get filesystem hex ID of a block device as shown by e.g. "fdisk"
1.5k views Asked by azerIO At
1
There are 1 answers
Related Questions in BASH
- When does Bash read heredocs?
- Why `set -o pipefail` gives different output even though the pipe is not failing
- Run an external command within jq to manipulate each values of a particular key
- API key 401 error in .env.development file
- How to "Enable mobile data" on a Huawei E3372 4G USB dongle using a bash script in Windows
- ImageMagick / Bash : pipe ignored(?) when filename format variable used
- MacOS Bash-Script: while read p and echo
- Parse command line arguments and write useful usage message without additional code
- JQ JSON - Values to Array
- why variable substitution is so different?
- postbank_pdf2csv: how to setup with Cygwin in Windows?
- Custom Bash functions & custom statements - Need some advice
- unexpected operator == in square brackets when trying to use gum lib
- How to disable a bash builtin inside a docker container
- Use sed or rename find series of alphabet then replace with with the same alphabet and a dash -
Related Questions in FILESYSTEMS
- Where exactly is the first data sector on a FAT file system?
- `df` command not capturing entire output in perl
- Is it possible to mount a logical volume without wiping the data?
- Speed up search of remote directories
- How to change the directory file system without losing files?
- Flutter SDK: Files Deleted Automatically (e.g., dart.exe), Errors in Android Studio
- How to store metadata for a UTF-8 text file cross-platform?
- fsck error on boot: dev/mapper/ubuntu--vg-ubuntu--lv: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
- rouble with mounting Python code to FUSE: No response and prolonged processing ---
- mkfs.erofs erofs: failed to lookup selabel
- How to deny user access MacFuse file system by the really path
- Is it faster to read a file on an NVMe using threads?
- list folders containing mp3 files using the Capacitor Filesystem
- How to use xdg-open in bwrap environment to open dir in the unsandboxed filesystem
- How to provide content of (locally) encrypted files to the iOS and macOS system
Related Questions in BLOCK-DEVICE
- How to create a virtual file in linux (or block device) (through code, C/++ or Python) that I can hook into read/write/etc?
- A file with actual size 1 byte uses 8 blocks of 4096 bytes on the filesystem
- Linux kernel module for block device redirect freezes in make_request on submit_bio/submit_bio_wait
- Is the `bv_len` field of `struct bio_vec` necessarily a multiple of the device's sector size?
- How does a file-system write its metadata to block-devices?
- How to allow nbd devices to submit io requests simultaneously more than physical cpu cores?
- Linux Kernel: What is the mapping of block device sectors to memory pages in struct bio?
- What is the advantage of using kernel level buffering for writing files
- How does the operating system handle I/O writes, that are not a multiple of the block device's sector-size?
- How does a linux block driver ensure all I/O has finished before unloading
- why does not btt in blktrace tool report any data
- Replication mode Protocol C in LinBit DRBD
- how to backup raw- / kvm-device directly over the network
- Getting 'Invalid argument' error when using IOCTL
- GNU/Linux systemd/sd-device problems creating and filtering an sd_device_enumerator
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The partition IDs are stored in the MBR (or EMBR for logical ones). They are thus not stored in the device itself. i.e. /dev/sda1 doesn't contains its type.
fdisk and similar commands do display the partition types and are designed to do it properly. Trying to avoid them would be pointless.
This Linux shell script will show the partition ID for a given device:
.