Raspberry Pi_Kor_19.2.1 저장공간 확인


Published Book on Amazon


All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1

All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)

최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


19.2   저장장치 모니터링

 

19.2.1  저장공간 확인

 

19.2.1.1    "df" 명령 - file system 디스크 공간 확인

 

시스템의 전반적인 디스크 저장장치 사용 상태를 확인하고자 할 때 df 명령을 사용할 수 있다.

 

[명령 형식]

df    [ option ]  <device-file>

 

[명령 개요]                

    시스템의 전반적인 디스크 저장장치 사용 상태를 보여준다.

    user 권한    -- 일반 user.

 

[상세 설명]

    이 명령은 시스템에 mount되어 있는 file system에 대한 저장공간의 사용상태를 보여준다.

    device file을 지정할 때는 "/dev"에 등록된 partition에 해당하는 device file을 지정한다. 특정 device를 지정하지 않으면 mount되어 있는 모든 device file에 대한 정보를 보여준다.     

 

[주요 option]

--help

display this help and exit

-a, --all

include dummy file systems

-l, --local

limit listing to local file systems

-t, --type=TYPE

limit listing to file systems of type TYPE

-T, --print-type

print file system type

 


 

[사용 Example]

다음은 df 명령을 실행한 결과이다. 각각의 개별 device file system에 대한 디스크 사용현황을 알 수 있을 뿐만 아니라 "root"("/")에 할당된 file system의 자료를 보면 전체 디스크에 대한 현황을 알 수 있다.

 

pi@raspberrypi ~ $ df -T

Filesystem     Type     1K-blocks    Used Available Use% Mounted on

rootfs         rootfs     7621756 4596368   2615176  64% /

/dev/root      ext4       7621756 4596368   2615176  64% /

devtmpfs       devtmpfs    186124       0    186124   0% /dev

tmpfs          tmpfs        38080     608     37472   2% /run

tmpfs          tmpfs         5120       0      5120   0% /run/lock

tmpfs          tmpfs        76140       0     76140   0% /run/shm

/dev/mmcblk0p5 vfat         60479   19119     41361  32% /boot

/dev/mmcblk0p3 ext4         27633     984     24356   4% /media/SETTINGS

/dev/mmcblk0p7 vfat         80643    6486     74157   9% /media/boot

/dev/sda1      ntfs      30254204  106244  30147960   1% /media/REAL_USB

/dev/mmcblk0p8 ext4       6412216  836252   5227192  14% /media/root0


 

19.2.1.2    "du" 명령 - directory별 디스크 사용 확인

 

"du" 명령은 특정 directory와 그 하부에 있는 자료들이 디스크 공간을 어떻게 사용하고 있는지에 대한 정보를 보여준다.

 

[명령 형식]

du    [ option ]  < directory | file >

 

[명령 개요]            

    지정된 directory file이 사용하고 있는 디스크 공간에 대한 정보를 보여준다.

    user 권한    -- 일반 user.

 

[상세 설명]

    여기서 보여주는 것은 실제로 사용하고 있는 공간이 아니라 directory file에 할당된 디스크 공간 정보를 보여준다.

    directory를 지정한 경우는 그 하부에 있는 모든 directory에 대한 디스크 정보도 개별적으로 상세히 보여준다.

 

[주요 option]

--help

display this help and exit

-a, --all

write counts for all files, not just directories

-X, --exclude-from=FILE

exclude files that match any pattern in FILE

--exclude=PATTERN

exclude files that match PATTERN

-d, --max-depth=N

 

print  the total for a directory (or file, with --all) only if it is N or fewer

levels below the Shell argument;  --max-depth=0 is the same as  --summarize

 


 

[사용 Example]

다음은 "pi" 계정의 home directory에 있는 testdata 폴더에 대한 디스크 사용 상태를 확인한 것이다. 명령을 실행한 결과로 보여주는 자료를 보면 testdata 폴더 하부에 있는 모든 폴더에 대한 디스크 사용상태를 상세히 보여주고 있는 것을 확인할 수 있다.

 

pi@raspberrypi ~ $ du ./testdata

12      ./testdata/TestFolder02

8       ./testdata/TestFolder01/Link

12      ./testdata/TestFolder01/manual01

40      ./testdata/TestFolder01

8       ./testdata/TestFolder03

76      ./testdata


 

19.2.1.3    Desktop window를 이용한 디스크 사용 상태 확인

 

시스템에 Desktop window로 접속한 경우에는 [File Manager] 프로그램을 이용하여 디스크 사용 상태를 모니터링할 수 있다.

 

window Application MenuMenu àAccessories àFile Manager을 실행하면 아래와 같이 [File Manager] 화면이 나타난다


그림 19‑4 Desktop window 폴더/파일 저장공간 사용 확인

 

원하는 폴더를 검색하면 그 하부에 있는 파일들의 디스크 공간 사용상태를 확인할 수 있다. 여기서 보이는 디스크 크기는 파일이 실제로 사용하고 있는 디스크 용량이며, 할당된 디스크 공간은 아니다.

 


 

또한 원하는 파일이나 폴더를 선택하고 오른쪽 mouse 버튼을 눌러서 나타나는 메뉴에서 Properties를 사용하면 해당 파일이나 폴더에 할당된 디스크 공간에 대한 정보를 확인할 수 있다.


 

 


 

Leave a Reply