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 Storage Device Monitoring
19.2.1 Checking Storage Device
19.2.1.1 "df" Command – Check File System Disk Space
You can use "df" command to check the overall disk storage usage status of the system.
[Command Format]
df [ option ] <device-file> |
[Command Overview]
■ This shows the overall disk storage usage status of the system.
■ User privilege -- Normal user.
[Detail Description]
■ This command shows the usage status of the storage space for the file system mounted on the system.
■ When specifying a device file, specify the device file corresponding to the partition registered in "/dev". If you do not specify a specific device, it displays information about all mounted device files.
[Main 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 |
[Used Example]
The following is the result of executing "df" command. Not only is it possible to know the disk usage status of each individual device's file system, but also the status of the whole disk can be seen by viewing the file system data allocated to "root"("/").
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" Command - Check Disk Usage by Directory
"du" command shows information about how a particular directory and its underlying data are using disk space.
[Command Format]
du [ option ] < directory | file > |
[Command Overview]
■ This shows information about the disk space used by the specified directory or file.
■ User privilege -- Normal user.
[Detail Description]
■ This shows the disk space information allocated to the directory or file, not the actual space used.
■ If a directory is specified, disk information for all the directories below it is also shown in detail.
[Main 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 |
[Used Example]
Here is the disk usage status for the "testdata" folder in the home directory of the "pi" account. If you check the result of executing the command, you can see the disk usage status of all the folders under the "testdata" folder in detail.
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 Checking Disk Usage by Using Desktop Window
When connected to the system as a Desktop window, the disk usage status can be monitored using the [File Manager] program.
When running Window Application Menu Menu àAccessories àFile Manager, the [File Manager] screen appears as shown below.
Figure 19‑4 Checking disk usage of foler/file in Desktop window
If you search the desired folder, you can check the disk space usage status of the files below it. The disk size shown here is for the disk space that the file actually uses, not for the disk space allocated to them.
You can also see the information about the disk space allocated to the file or folder by selecting the desired file or folder and clicking the right mouse button to open the [Properties] on the displayed menu.