리눅스 디스크 용량 확인

Jmnote (토론 | 기여)님의 2012년 3월 26일 (월) 13:14 판 (→‎Byte 단위)

1 GB 단위

명령어
fdisk -l | egrep 'Disk.*bytes' | awk '{ sub(/,/,""); sum +=$5;print $1" "$2" "$3" "$4" "$5" "$6 } END { print "total: " sum/1024/1024/1024 " GB" }'
실행예시
[root@localhost ~]# fdisk -l | egrep 'Disk.*bytes' | awk '{ sub(/,/,""); sum +=$5;print $1" "$2" "$3" "$4" "$5" "$6 } END { print "total: " sum/1024/1024/1024 " GB" }'
Disk /dev/xvda: 107.3 GB 107374182400 bytes
Disk /dev/xvdb: 107.3 GB 107374182400 bytes
total: 200 GB

2 Byte 단위

명령어
fdisk -l | egrep 'Disk.*bytes' | awk '{ sub(/,/,""); sum +=$5;print $1" "$2" "$3" "$4" "$5" "$6 } END { print "total: " sum" Bytes" }'
실행예시
[root@localhost ~]# fdisk -l | egrep 'Disk.*bytes' | awk '{ sub(/,/,""); sum +=$5;print $1" "$2" "$3" "$4" "$5" "$6 } END { print "total: " sum" Bytes" }'
Disk /dev/xvda: 107.3 GB 107374182400 bytes
Disk /dev/xvdb: 107.3 GB 107374182400 bytes
total: 214748364800 Bytes

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}