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

54번째 줄: 54번째 줄:
*[[윈도우 디스크 용량 확인]]
*[[윈도우 디스크 용량 확인]]


==주석==
<references/>


[[분류: 리눅스]]
[[분류: 리눅스]]

2016년 2월 2일 (화) 11:05 판

리눅스 디스크 용량 확인
리눅스 디스크 크기 확인
fdisk

1 기본

명령어
fdisk -l | grep Disk
실행예시
[root@zetawiki ~]# fdisk -l | grep Disk
Disk /dev/xvda: 31.4 GB, 31457280000 bytes
→ 31.4GB라고 나오는데 실제로는 31.4GiB이며, GB로 환산하면 29.3GB이다.
[math]\displaystyle{ 31457280000\ \mbox{bytes}\div 1024\div 1024\div 1024\approx 29.3\ \mbox{GB} }[/math]

2 합산

디스크들의 용량을 합산하여 보여준다.

2.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@zetawiki ~]# 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.2 Byte 단위

명령어
fdisk -l | egrep 'Disk.*bytes' | awk '{ sub(/,/,""); sum +=$5;print $1" "$2" "$3" "$4" "$5" "$6 } END { print "total: " sum" Bytes" }'
실행예시
[root@zetawiki ~]# 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 }}