차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
tmpfs와_tmp [2024/10/17 07:51] – 만듦 koov | tmpfs와_tmp [2024/10/17 08:13] (현재) – koov | ||
---|---|---|---|
줄 106: | 줄 106: | ||
이런경우 관리자가 수동으로 '' | 이런경우 관리자가 수동으로 '' | ||
+ | 또한 ''/ | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | <code bash> | ||
+ | [root@localhost ~]# df -hP | ||
+ | Filesystem | ||
+ | devtmpfs | ||
+ | tmpfs 636M | ||
+ | tmpfs 255M 3.8M 251M 2% /run | ||
+ | / | ||
+ | / | ||
+ | tmpfs 128M | ||
+ | tmpfs 636M | ||
+ | |||
+ | [root@localhost ~]# mount -o remount, | ||
+ | |||
+ | [root@localhost ~]# df -hP | ||
+ | Filesystem | ||
+ | devtmpfs | ||
+ | tmpfs 636M | ||
+ | tmpfs 255M 3.8M 251M 2% /run | ||
+ | / | ||
+ | / | ||
+ | tmpfs 128M | ||
+ | tmpfs | ||
+ | |||
+ | [root@localhost ~]# free -m | ||
+ | | ||
+ | Mem: 1271 | ||
+ | Swap: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 위의 예제에서는 ''/ | ||
+ | 용량을 늘리는 것 자체는 성공했지만 실수로라도 ''/ | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | <code bash> | ||
+ | [root@localhost ~]# cd /tmp/ | ||
+ | [root@localhost tmp]# ll | ||
+ | total 0 | ||
+ | [root@localhost tmp]# dd if=/ | ||
+ | 10+0 records in | ||
+ | 10+0 records out | ||
+ | 10485760 bytes (10 MB, 10 MiB) copied, 0.00415868 s, 2.5 GB/s | ||
+ | [root@localhost tmp]# dd if=/ | ||
+ | 100+0 records in | ||
+ | 100+0 records out | ||
+ | 104857600 bytes (105 MB, 100 MiB) copied, 0.0360715 s, 2.9 GB/s | ||
+ | [root@localhost tmp]# ll -h | ||
+ | total 100M | ||
+ | -rw-r--r--. 1 root root 100M Oct 17 17:05 data | ||
+ | [root@localhost tmp]# dd if=/ | ||
+ | 1000+0 records in | ||
+ | 1000+0 records out | ||
+ | 1048576000 bytes (1.0 GB, 1000 MiB) copied, 0.375854 s, 2.8 GB/s | ||
+ | [root@localhost tmp]# ll -h | ||
+ | total 1000M | ||
+ | -rw-r--r--. 1 root root 1000M Oct 17 17:05 data | ||
+ | [root@localhost tmp]# free -m | ||
+ | | ||
+ | Mem: 1271 1192 75 | ||
+ | Swap: | ||
+ | [root@localhost tmp]# dd if=/ | ||
+ | 3000+0 records in | ||
+ | 3000+0 records out | ||
+ | 3145728000 bytes (3.1 GB, 2.9 GiB) copied, 2.35655 s, 1.3 GB/s | ||
+ | [root@localhost tmp]# ll -h | ||
+ | total 3.0G | ||
+ | -rw-r--r--. 1 root root 3.0G Oct 17 17:05 data | ||
+ | [root@localhost tmp]# free -m | ||
+ | | ||
+ | Mem: 1271 1228 64 | ||
+ | Swap: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 실제 물리 메모리 용량 이상으로 '' | ||
+ | 위에 보는 바와 같이 '' | ||
+ | |||
+ | 여기서 용량을 더 사용하면 어떻게 될까? | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | <code bash> | ||
+ | [root@localhost tmp]# dd if=/ | ||
+ | Connection closing...Socket close. | ||
+ | |||
+ | Connection closed by foreign host. | ||
+ | |||
+ | Disconnected from remote host(192.168.0.203: | ||
+ | |||
+ | Type `help' to learn how to use Xshell prompt. | ||
+ | [C: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 이와 같이 해당 시스템은 먹통이 되며 강제 리부팅하지 않는 이상 복구 되지 않는다. | ||
+ | |||
+ | |||
+ | ===== Amazon AWS EC2 ===== | ||
+ | |||
+ | EC2 인스턴스의 경우는 이 ''/ | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | <code bash> | ||
+ | [root@ip-172-31-17-98 system]# df -hP | ||
+ | Filesystem | ||
+ | devtmpfs | ||
+ | tmpfs | ||
+ | tmpfs | ||
+ | / | ||
+ | / | ||
+ | tmpfs 95M | ||
+ | tmpfs | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 이것을 비활성화 하고 싶다면 ''/ | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | <code vim> | ||
+ | [root@ip-172-31-17-98 system]# cat basic.target | ||
+ | # SPDX-License-Identifier: | ||
+ | # | ||
+ | # This file is part of systemd. | ||
+ | # | ||
+ | # systemd is free software; you can redistribute it and/or modify it | ||
+ | # under the terms of the GNU Lesser General Public License as published by | ||
+ | # the Free Software Foundation; either version 2.1 of the License, or | ||
+ | # (at your option) any later version. | ||
+ | |||
+ | [Unit] | ||
+ | Description=Basic System | ||
+ | Documentation=man: | ||
+ | Requires=sysinit.target | ||
+ | Wants=sockets.target timers.target paths.target slices.target | ||
+ | After=sysinit.target sockets.target paths.target slices.target tmp.mount | ||
+ | |||
+ | # We support /var, /tmp, /var/tmp, being on NFS, but we don't pull in | ||
+ | # remote-fs.target by default, hence pull them in explicitly here. Note that we | ||
+ | # require /var and /var/tmp, but only add a Wants= type dependency on /tmp, as | ||
+ | # we support that unit being masked, and this should not be considered an error. | ||
+ | RequiresMountsFor=/ | ||
+ | # | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 그리고 '' | ||
+ | |||
+ | <WRAP prewrap> | ||
+ | <code bash> | ||
+ | [root@ip-172-31-17-98 ~]# systemctl disable --now tmp.mount | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 혹시라도 ''/ | ||
+ | 이런경우 해당 서비스나 프로그램을 먼저 종료한 후 수행하거나 | ||
+ | |||
+ | 아니면 '' | ||