0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ファイルシステムの確認コマンドメモ

Posted at

検証環境

cat /etc/os-release | grep PRETTY
# PRETTY_NAME="Ubuntu 24.04.1 LTS"

コマンド

  1. df -T ファイルパス
  2. findmnt ファイルパス
  3. stat -f ファイルパス

個人的には、dfかfindmntが見やすいし、正確

表示例

df -T / の場合
Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/ubuntu--vg-ubuntu--lv ext4 412252176 116717840 277671500 30% /

df -T /boot/efi の場合
Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/nvme0n1p1 vfat 1098632 6284 1092348 1% /boot/efi

findmnt / の場合
TARGET SOURCE FSTYPE OPTIONS / /dev/mapper/ubuntu--vg-ubuntu--lv ext4 rw,relatime

findmnt /boot/efi の場合
TARGET SOURCE FSTYPE OPTIONS /boot/efi /dev/nvme0n1p1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro

stat -f / の場合
File: "/" ID: 816f0a35800c03cf Namelen: 255 Type: ext2/ext3 Block size: 4096 Fundamental block size: 4096 Blocks: Total: 103063044 Free: 73883584 Available: 69417875 Inodes: Total: 26214400 Free: 25486952

stat -f /boot/efi の場合
File: "/boot/efi" ID: 1030100000000 Namelen: 1530 Type: msdos Block size: 4096 Fundamental block size: 4096 Blocks: Total: 274658 Free: 273087 Available: 273087 Inodes: Total: 0 Free: 0

検証スクリプト

#!/bin/bash

commands=('df -T' 'findmnt' 'stat -f')
directories=('/' '/boot/efi')

for cmd in "${commands[@]}"; do
  for dir in "${directories[@]}"; do
    echo ""
    echo "\`$cmd $dir\` の場合"
    echo $($cmd "$dir" 2>&1)
  done
done
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?