blkid
Overview
The blkid
command locates and prints block device attributes. It’s used to find UUID, LABEL, TYPE, and other filesystem information.
Syntax
blkid [options] [device...]
Common Options
Option | Description |
---|---|
-c file |
Read from cache file |
-g |
Garbage collect |
-h |
Display help |
-l |
Lookup only |
-L label |
Look up device by label |
-U uuid |
Look up device by UUID |
-p |
Low-level probe |
-s tag |
Show specified tag |
-t NAME=value |
Find by tag |
-v |
Verbose output |
-w file |
Write to cache file |
Key Use Cases
- Device identification
- Filesystem detection
- UUID lookup
- Label lookup
- System configuration
Examples with Explanations
Example 1: Basic Usage
blkid
Show all block devices
Example 2: Specific Device
blkid /dev/sda1
Show device attributes
Example 3: Find by UUID
blkid -U "uuid-string"
Lookup device by UUID
Common Usage Patterns
List all:
blkid
Find label:
blkid -L "label"
Show type:
blkid -s TYPE
Security Considerations
- Root access
- Device permissions
- Cache security
- Information exposure
- System access
Additional Resources
Best Practices
- Use UUIDs
- Regular updates
- Cache management
- Documentation
- Verification
Filesystem Types
- ext4
- xfs
- btrfs
- swap
- vfat
Troubleshooting
- Device access
- Cache issues
- Missing info
- Version conflicts
- Format errors