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

잔글 (로봇: 자동으로 텍스트 교체 (-<source lang='dos'> +<source lang='cli'>))
9번째 줄: 9번째 줄:


;실행예시
;실행예시
<source lang='dos'>
<source lang='cli'>
[root@jmnote ~]# fdisk -l | grep Disk
[root@jmnote ~]# fdisk -l | grep Disk
Disk /dev/xvda: 31.4 GB, 31457280000 bytes</sourcE>
Disk /dev/xvda: 31.4 GB, 31457280000 bytes</sourcE>
24번째 줄: 24번째 줄:


;실행예시
;실행예시
<source lang='dos'>
<source lang='cli'>
[root@jmnote ~]# 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@jmnote ~]# 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/xvda: 107.3 GB 107374182400 bytes
40번째 줄: 40번째 줄:


;실행예시
;실행예시
<source lang='dos'>
<source lang='cli'>
[root@jmnote ~]# fdisk -l | egrep 'Disk.*bytes' | awk '{ sub(/,/,""); sum +=$5;print $1" "$2" "$3" "$4" "$5" "$6 } END { print "total: " sum" Bytes" }'
[root@jmnote ~]# 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/xvda: 107.3 GB 107374182400 bytes

2015년 2월 6일 (금) 04:10 판

리눅스 디스크 용량 확인
fdisk

1 기본

명령어
fdisk -l | grep Disk
실행예시
[root@jmnote ~]# fdisk -l | grep Disk
Disk /dev/xvda: 31.4 GB, 31457280000 bytes
→ 31.4GB라고 나오는데 실제로는 31.4GiB이며, GB로 환산하면 29.3GB이다.
[math]\displaystyle{ 31457280000\ \mbox{bytes}\div1024\div1024\div1024\approx29.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@jmnote ~]# 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@jmnote ~]# 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 같이 보기

4 주석

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