Ubuntu環境下,查詢硬碟資訊的指令

在探索套件「util-linux」,發現一個指令「lsblk」,剛好回覆「這篇」,順便整理一下!

「blkid」則是在「/etc/fstab」的註解發現到的,也是屬於「util-linux」這個套件。

lsblk

執行

1
$ lsblk

顯示

1
2
3
4
5
6
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda 8:0 0 80G 0 disk
├─sda1 8:1 0 79G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 1022M 0 part [SWAP]
sr0 11:0 1 1024M 0 rom

blkid

執行

1
$ sudo blkid

顯示

1
2
/dev/sda1: UUID="e6ff58bf-dce3-42e5-9734-93d9c781aafb" TYPE="ext4"
/dev/sda5: UUID="8efc70e3-3f95-4d29-8e3e-553d8b156fdc" TYPE="swap"

mount

執行

1
$ mount

顯示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=sam)

fdisk

執行

1
$ sudo fdisk -l

顯示

1
2
3
4
5
6
7
8
9
10
11
Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders, total 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008743d

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 165675007 82836480 83 Linux
/dev/sda2 165677054 167770111 1046529 5 Extended
/dev/sda5 165677056 167770111 1046528 82 Linux swap / Solaris

執行

1
$ df -h