"리눅스 디스크 용량 확인"의 두 판 사이의 차이

13번째 줄: 13번째 줄:
total: 200 GB
total: 200 GB
</source>
</source>
*위에 107.3 GB라고 나오는데 실제로는 107.3 GiB (=100GB)를 의미한다.
*107374182400 bytes를 1024로 세번 나누어 보면 정확히 100GB가 나온다.


==Byte 단위==
==Byte 단위==

2012년 3월 26일 (월) 13:17 판

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
  • 위에 107.3 GB라고 나오는데 실제로는 107.3 GiB (=100GB)를 의미한다.
  • 107374182400 bytes를 1024로 세번 나누어 보면 정확히 100GB가 나온다.

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 }}