Background
What is the File System on our disks?
Outline
- Commands
- df ( Disk Free )
- lsblk ( List Information on the block devices )
- lshw ( List Hardware )
- file ( File Command )
- mount ( List Mount Points )
- blkid ( List Information on Available Block Devices )
- System Configuration File
- /etc/fstab
Commands
df ( Disk Free )
Outline
Lists available free space per each fileSystem.
Options
- -H
- Human Readable
- -T
- Include File System Type
Syntax
df
Sample
df -H -T
Output
Output – Image
Output – Textual
>df -H -T Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs tmpfs 2.0G 35M 2.0G 2% /run tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/mapper/cl-root xfs 54G 6.6G 48G 13% / /dev/mapper/cl-home xfs 441G 9.4G 432G 3% /home /dev/sda1 ext4 1.1G 218M 736M 23% /boot tmpfs tmpfs 392M 17k 392M 1% /run/user/42 tmpfs tmpfs 392M 4.1k 392M 1% /run/user/545260630 >
Explanation
Informative
- Type
- xfs
- tmpfs
- temp file system
- Lists Size Information
- Size
- Used
- Avail
- Use%
lsblk ( List Block Devices )
Outline
Lists information for block devices.
Options
- Columns
- NAME
- Device Name
- KNAME
- Internal Kernel Device Name
- TYPE
- Device Type
- FSTYPE
- File System Type
- SIZE
- Size of the Device
- RA
- Read Ahead of the Device
- mountpoint
- Where the device is mounted
- Label
- File System Label
- NAME
Syntax
lsblk
Sample
lsblk --output NAME,KNAME,TYPE,FSTYPE,SIZE,RA,MOUNTPOINT,LABEL
Output
Output – Image
Output – Textual
>df -H -T Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm tmpfs tmpfs 2.0G 35M 2.0G 2% /run tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/mapper/cl-root xfs 54G 6.6G 48G 13% / /dev/mapper/cl-home xfs 441G 9.4G 432G 3% /home /dev/sda1 ext4 1.1G 218M 736M 23% /boot tmpfs tmpfs 392M 17k 392M 1% /run/user/42 tmpfs tmpfs 392M 4.1k 392M 1% /run/user/545260630 >
Explanation
Informative
- Type
- xfs
- tmpfs
- temp file system
- Lists Size Information
- Size
- Used
- Avail
- Use%
lshw ( List Hardware )
Outline
Lists Hardware
Options
- Columns
- Hardware Path
- Device
- Class
- Description
Syntax
lshw
Sample
sudo lshw -short | egrep 'disk|volume'
Output
Output – Image
Output – Textual
>sudo lshw -short | egrep 'disk|volume' /0/100/1f.2/0.0.0 /dev/sda disk 500GB CT500MX500SSD1 /0/100/1f.2/0.0.0/1 /dev/sda1 volume 1GiB EXT4 volume /0/100/1f.2/0.0.0/2 /dev/sda2 volume 464GiB Linux LVM Physical Volume partition /0/100/1f.2/0.1.0 /dev/cdrom disk DVD+-RW SH-216AB > > >
Explanation
Informative
- Class
- disk
- /dev/sda
- /dev/cdrom
- volume
- /dev/sda1
- 1 GB => EX4 Volume
- /dev/sda2
- 464 GB => Linux LVM Physical Volume Partition
- /dev/sda1
- disk
File ( List File Attributes )
Outline
Lists File Information
Options
- Filename
- Device Name
Syntax
sudo file -sL /dev/sda{,1,2}
Sample
sudo file -sL /dev/sda{,1,2}
Output
Output – Image
Output – Textual
>sudo file -sL /dev/sda{,1,2} /dev/sda: DOS/MBR boot sector /dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=3b0d8074-d527-4c92-9e07-f0b2a67826ce (needs journal recovery) (extents) (64bit) (large files) (huge files) /dev/sda2: LVM2 PV (Linux Logical Volume Manager), UUID: 6pGhc4-MQBs-053D-3rxR-wAYh-DIkd-b6KM9D, size: 499033047040 >
Explanation
Informative
- Device
- File System
- UUID
- Size
blkid ( List Block Devices )
Outline
List Block Devices
Basic
Syntax
blkid
Sample
blkid
Output
Output – Image
Output – Textual
>sudo blkid /dev/sda1: UUID="3b0d8074-d527-4c92-9e07-f0b2a67826ce" TYPE="ext4" PARTUUID="fa74f74f-01" /dev/sda2: UUID="6pGhc4-MQBs-053D-3rxR-wAYh-DIkd-b6KM9D" TYPE="LVM2_member" PARTUUID="fa74f74f-02" /dev/mapper/cl-root: UUID="ff7f0df5-41ed-4647-ad5f-9fa701f06d22" TYPE="xfs" /dev/mapper/cl-swap: UUID="af997147-1621-4bdc-89fd-5eeb7346b25e" TYPE="swap" /dev/mapper/cl-home: UUID="15a8cce6-a202-48eb-a98e-fb0ac08f8619" TYPE="xfs"
Explanation
- /dev/sda1
- ext4
- /dev/sda2
- LVM2_member
Detail
Syntax
sudo blkid -po udev [device]
Sample
Device – 01
Code
sudo blkid -po udev /dev/sda1
Output – Image
Device – 02
Code
sudo blkid -po udev /dev/sda2
Output – Image
Output – Textual
>sudo blkid -po udev /dev/sda2 ID_FS_UUID=6pGhc4-MQBs-053D-3rxR-wAYh-DIkd-b6KM9D ID_FS_UUID_ENC=6pGhc4-MQBs-053D-3rxR-wAYh-DIkd-b6KM9D ID_FS_VERSION=LVM2\x20001 ID_FS_TYPE=LVM2_member ID_FS_USAGE=raid ID_PART_ENTRY_SCHEME=dos ID_PART_ENTRY_UUID=fa74f74f-02 ID_PART_ENTRY_TYPE=0x8e ID_PART_ENTRY_NUMBER=2 ID_PART_ENTRY_OFFSET=2099200 ID_PART_ENTRY_SIZE=974673920 ID_PART_ENTRY_DISK=8:0
Explanation
- /dev/sda2
- ID_FS_VERSION
- LVM2\x20001
- ID_FS_TYPE
- LVM2_member
- ID_FS_USAGE
- raid
- ID_PART_ENTRY_SIZE
- 974673920
- ID_FS_VERSION
Mount ( List Mount Points )
Outline
Lists Mount Points
Syntax
mount
Sample
mount | column -t | grep -v 'nodev' | grep 'dev'
Output
Output – Image
Output – Textual
>mount | column -t | grep -v 'nodev' | grep 'dev' devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1894180k,nr_inodes=473545,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000) /dev/mapper/cl-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota) mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M) /dev/mapper/cl-home on /home type xfs (rw,relatime,seclabel,attr2,inode64,noquota) /dev/sda1 on /boot type ext4 (rw,relatime,seclabel) >
Explanation
Informative
- Device
- When mounted/Mounted On
- type:- File System
- Options
- rw ( readwrite)
- noexec ( Execute Rights not granted )
- relatime
- seclabel
- attr
- attr2
- inode
- inode64
- size
- mode
- 755
- 620
System Configuration File
/etc/fstab
Outline
List information about disk partitions.
Syntax
cat /etc/fstab
Sample
cat /etc/fstab
Output
Output – Image
Output – Textual
>cat /etc/fstab # # /etc/fstab # Created by anaconda on Mon Feb 17 16:55:59 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk/'. # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # /dev/mapper/cl-root / xfs defaults 0 0 UUID=3b0d8074-d527-4c92-9e07-f0b2a67826ce /boot ext4 defaults 1 2 /dev/mapper/cl-home /home xfs defaults 0 0 /dev/mapper/cl-swap swap swap defaults 0 0 >
Explanation
Negative
- High-level information
- Does not show the amount of storage allocated to the device
Summary
A Linux system offers various utilities towards getting one comfortable with its file system.
The most direct approaches are through:-
- df
- lsblk
- lshw
- file
References
- Redhat
- Products & Services > Product Documentation > Red Hat Enterprise Linux6 > Deployment Guide
- Using the blkid Command
Link
- Using the blkid Command
- Products & Services > Product Documentation > Red Hat Enterprise Linux6 > Deployment Guide
- FibreVillage
- lsblk command examples
Link
- lsblk command examples
- TecMint
- Find Linux File System Type
Link
- Find Linux File System Type
- Die.Net
- file(1) – Linux man page
Link
- file(1) – Linux man page
- Linuxize
- Linux File Command
Link
- Linux File Command
- Man7.Org
- The Open Group
- HowToForge
- Linux lsblk Command Tutorial for Beginners (8 Examples)
Link
- Linux lsblk Command Tutorial for Beginners (8 Examples)
- Linuxaria
- Linux Shell – lsblk
Link
- Linux Shell – lsblk