sudo fdisk -l
다음을 제공합니다:
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0xdb20e840
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 104859647 52428800 7 HPFS/NTFS/exFAT
/dev/sda2 104859648 310630399 102885376 7 HPFS/NTFS/exFAT
/dev/sda3 310632840 372065399 30716280 83 Linux
/dev/sda4 372072446 838281215 233104385 5 Extended
/dev/sda5 372072448 392552447 10240000 83 Linux
/dev/sda6 392554496 453994495 30720000 83 Linux
/dev/sda7 453996544 515436543 30720000 83 Linux
/dev/sda8 515438592 515456169 8789 82 Linux swap / Solaris
/dev/sda9 515457024 552321023 18432000 83 Linux
/dev/sda10 552323072 585091071 16384000 83 Linux
/dev/sda11 585093120 617861119 16384000 83 Linux
/dev/sda12 617876028 822656519 102390246 7 HPFS/NTFS/exFAT
/dev/sda13 822657024 838281215 7812096 82 Linux swap / Solaris
또한 df -h
주어진:
Filesystem Size Used Avail Use% Mounted on
/cow 1.9G 30M 1.9G 2% /
udev 1.9G 4.0K 1.9G 1% /dev
tmpfs 385M 1.1M 384M 1% /run
/dev/sr0 913M 913M 0 100% /cdrom
/dev/loop0 874M 874M 0 100% /rofs
none 4.0K 0 4.0K 0% /sys/fs/cgroup
tmpfs 1.9G 8.0K 1.9G 1% /tmp
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 80K 1.9G 1% /run/shm
none 100M 24K 100M 1% /run/user
/dev/sda9 18G 1.2G 16G 8% /media/xubuntu/b90d1c45-7805-421b-9ba7-88ab7ed04fd3
/dev/sda7 29G 4.2G 24G 16% /media/xubuntu/964f9a2f-3641-4754-8319-1decea626931
/dev/sda6 29G 20G 7.8G 72% /media/xubuntu/4f6e6be0-a703-4cb6-a425-9ae73f31eb82
/dev/sda5 9.5G 22M 9.0G 1% /media/xubuntu/3c662996-cf77-41a3-9b5d-d7520f8d534a
/dev/sda3 29G 3.4G 24G 13% /media/xubuntu/57f03636-d50f-43fe-97c0-192b761d7054
/dev/sda12 98G 18G 81G 19% /media/xubuntu/5943EBDD309DF483
/dev/sda11 16G 935M 14G 7% /media/xubuntu/a2176105-4afc-4f19-b182-c027925e249e
/dev/sda10 16G 40M 15G 1% /media/xubuntu/4397bd85-5172-4dc4-a4ce-e9690d3ac7f9
/dev/sda1 50G 32G 19G 64% /media/xubuntu/OSDisk
awk
동일한 명령에서 다른 것을 사용하여 이 두 결과를 결합하여 다음 출력을 생성하려면 어떻게 해야 합니까 ?
**Device - System_Type - Size - Use% - Mount_Point**
답변1
왜 시도해 볼 수 없나요 df -hT
?
산출
-bash-3.2$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext3 48G 17G 29G 37% /
/dev/sda5 ext3 238G 66G 160G 30% /home
/dev/sda1 ext3 99M 17M 77M 18% /boot
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
이것유형시스템 유형을 지정하십시오. 유일한 예외는 fdisk -l
마운트 여부에 관계없이 사용 가능한 모든 파티션이 아닌 마운트된 파일 시스템만 표시한다는 것입니다.
답변2
에서 man mount
:
보다 강력하고 정의 가능한 출력을 위해서는 다음을 사용하십시오
findmnt
.
findmnt --help
...
-D - imitate the behavior of df
...
Available Columns:
SOURCE source device
TARGET mountpoint
FSTYPE filesystem type
OPTIONS all mount options
VFS-OPTIONS VFS specific mount options
FS-OPTIONS FS specific mount options
LABEL filesystem label
UUID filesystem UUID
PARTLABEL partition label
PARTUUID partition UUID
MAJ:MIN major:minor device number
ACTION action detected by --poll
OLD-TARGET old mountpoint saved by --poll
OLD-OPTIONS old mount options saved by --poll
SIZE filesystem size
AVAIL filesystem size available
USED filesystem size used
USE% filesystem use percentage
FSROOT filesystem root
TID task ID
ID mount ID
OPT-FIELDS optional mount fields
PROPAGATION VFS propagation flags
FREQ dump(8) period in days [fstab only]
PASSNO pass number on parallel fsck(8) [fstab only]
...
findmnt -D
SOURCE FSTYPE SIZE USED AVAIL USE% TARGET
devtmpfs devtmpfs 11.8G 0 11.8G 0% /dev
tmpfs tmpfs 11.8G 95.1M 11.7G 1% /dev/shm
tmpfs tmpfs 11.8G 928K 11.8G 0% /run
tmpfs tmpfs 11.8G 0 11.8G 0% /sys/fs/cgroup
/dev/sda2[/manjaro] btrfs 12G 7.8G 3.8G 65% /
tmpfs tmpfs 11.8G 758.2M 11G 6% /tmp
/dev/sda1 vfat 3G 588M 2.4G 19% /esp
/dev/sda1[/EFI/manjaro] vfat 3G 588M 2.4G 19% /boot
tmpfs tmpfs 2.4G 8K 2.4G 0% /run/user/1000
gvfsd-fuse fuse.gvfsd-fuse 0 0 0 - /run/user/1000/gvfs
답변3
다음은 수정된 버전입니다라메쉬의 답변중요한 파일 시스템에 필요한 열( udev
, 아님 tmpfs
)만 제공합니다.
disks=$(sudo fdisk -l | grep -Po "/dev/sd.\d+")
for i in $disks; do df -Th $i | tail -n 1; done
답변4
이는 간단할 수 있지만 언제든지 &&를 사용할 수 있습니다.
sudo fdisk -l && df -h
하지만 cfdisk는 아마도 당신이 원하는 것을 할 것입니다:
cfdisk -P s
Partition Table for /dev/sda
First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
Pri/Log 0 2047* 0# 2048*Free Space None
1 Primary 2048* 1026047* 0 1024000*Linux (83) Boot
2 Primary 1026048* 3074047* 0 2048000*Linux swap / So (82) None
3 Primary 3074048* 41943039* 0 38868992*Linux LVM (8E) None