![/var/log를 새 논리 볼륨으로 이동하면 이제 데이터가 손실됩니다.](https://linux55.com/image/74312/%2Fvar%2Flog%EB%A5%BC%20%EC%83%88%20%EB%85%BC%EB%A6%AC%20%EB%B3%BC%EB%A5%A8%EC%9C%BC%EB%A1%9C%20%EC%9D%B4%EB%8F%99%ED%95%98%EB%A9%B4%20%EC%9D%B4%EC%A0%9C%20%EB%8D%B0%EC%9D%B4%ED%84%B0%EA%B0%80%20%EC%86%90%EC%8B%A4%EB%90%A9%EB%8B%88%EB%8B%A4..png)
전용 LV의 LVG 내부에 /var가 마운트된 RHEL 서버가 있습니다. RH 보안 권고 CCE-26215-4에 따르면 /var/log를 자체 전용 파티션으로 마이그레이션해야 합니다. 그래서 공간을 회수하기 위해 /opt를 축소한 다음(/opt는 동일한 LVG에 있음) 동일한 LVG의 해당 공간에서 /var/log에 대한 새 LV를 만들었습니다. /etc/fstab에 추가하여 마운트하면 더 이상 이전에 있던 모든 데이터를 볼 수 없습니다.
앞으로:
-rw-------. 1 root root 2368 Sep 16 10:50 anaconda.ifcfg.log
-rw-------. 1 root root 39140 Sep 16 10:50 anaconda.log
-rw-------. 1 root root 44009 Sep 16 10:50 anaconda.program.log
-rw-------. 1 root root 387794 Sep 16 10:50 anaconda.storage.log
-rw-------. 1 root root 111921 Sep 16 10:50 anaconda.syslog
-rw-------. 1 root root 30216 Sep 16 10:50 anaconda.xlog
-rw-------. 1 root root 69879 Sep 16 10:50 anaconda.yum.log
drwxr-x---. 2 root root 4096 Oct 2 06:48 audit
-rw-r--r-- 1 root root 2964 Oct 2 15:22 boot.log
-rw------- 1 root utmp 0 Oct 1 03:34 btmp
-rw-------. 1 root utmp 4608 Sep 21 08:47 btmp-20151001
drwxr-xr-x. 2 root root 4096 Sep 16 10:54 ConsoleKit
-rw------- 1 root root 126720 Oct 2 15:22 cron
-rw-------. 1 root root 87635 Sep 20 03:33 cron-20150920
-rw------- 1 root root 160346 Sep 27 03:09 cron-20150927
drwxr-xr-x. 2 lp sys 4096 Jun 10 11:41 cups
-rw-r--r-- 1 root root 66463 Oct 2 15:22 dmesg
-rw-r--r-- 1 root root 66463 Oct 2 14:40 dmesg.old
-rw-r--r--. 1 root root 355634 Sep 16 17:23 dracut.log
drwx------ 2 root root 4096 Aug 18 01:01 httpd
-rw-r--r--. 1 root root 146584 Oct 2 15:22 lastlog
-rw------- 1 root root 2019 Oct 2 15:22 maillog
-rw-------. 1 root root 1859 Sep 17 12:44 maillog-20150920
-rw------- 1 root root 26200 Sep 22 08:57 maillog-20150927
-rw-r--r--. 1 root root 0 Sep 16 10:52 mcelog
-rw------- 1 root root 1079139 Oct 2 15:22 messages
-rw-------. 1 root root 447188 Sep 20 03:33 messages-20150920
-rw------- 1 root root 863216 Sep 27 03:09 messages-20150927
drwxr-x--- 4 nagios nagios 4096 Oct 2 15:23 nagios
drwxr-xr-x. 2 ntp ntp 4096 Apr 28 05:15 ntpstats
drwxr-xr-x 4 nagios nagios 4096 Sep 18 15:04 pnp4nagios
drwxr-xr-x. 2 root root 4096 Sep 16 11:37 prelink
drwxr-xr-x. 2 root root 4096 Sep 27 03:09 rhsm
drwxr-xr-x. 2 root root 4096 Oct 2 00:00 sa
drwx------. 3 root root 4096 Apr 10 01:59 samba
rw------- 1 root root 372611 Oct 2 15:22 secure
-rw-------. 1 root root 22713 Sep 18 17:05 secure-20150920
-rw------- 1 root root 368374 Sep 27 03:08 secure-20150927
-rw------- 1 root root 0 Sep 27 03:09 spooler
-rw-------. 1 root root 0 Sep 16 10:48 spooler-20150920
-rw------- 1 root root 0 Sep 20 03:33 spooler-20150927
drwxr-x---. 2 root root 4096 Jun 22 04:14 sssd
-rw-------. 1 root root 0 Sep 16 10:47 tallylog
-rw-rw-r--. 1 root utmp 81792 Oct 2 15:22 wtmp
-rw-------. 1 root root 28674 Sep 30 09:11 yum.log
뒤쪽에:
-rw-r--r-- 1 root root 3016 Oct 2 14:49 boot.log
-rw------- 1 root root 872 Oct 2 15:10 cron
-rw-r--r-- 1 root root 66529 Oct 2 14:49 dmesg
drwx------ 2 root root 16384 Oct 2 14:03 lost+found
-rw------- 1 root root 1946 Oct 2 15:10 maillog
-rw-r--r-- 1 root root 0 Oct 2 14:49 mcelog
-rw------- 1 root root 81842 Oct 2 15:17 messages
-rw------- 1 root root 1426 Oct 2 15:17 secure
-rw------- 1 root root 0 Oct 2 14:49 spooler
-rw-rw-r-- 1 root utmp 3456 Oct 2 14:50 wtmp
마이그레이션 전에는 /var가 685MB를 사용했고, 새 /var/log 파티션의 전체 크기는 966MB이고, /log의 내용은 총 35MB에 불과하기 때문에 이것이 공간 제한이라고 생각하지 않습니다. 나는 이 모든 작업을 루트로 수행하고 있기 때문에 사용자/권한 문제가 아니라고 생각합니다. 이상한 점은 이를 제거하고 재부팅하면 /var/log에서 볼 것으로 예상되는 모든 내용이 다시 나타난다는 것입니다.
제가 뭔가 잘못하고 있는 건가요, 아니면 LVM의 부작용인가요? 이 데이터를 새 LV에 마운트하면 어디로 가나요?
답변1
복제가 도움이 되지만 모든 새 로그를 수신하는 또 다른 방법은 이전 로그 디렉토리와 동일한 디렉토리 구조를 생성하여 자동으로 생성되지 않고 일부 로그가 손실되도록 하는 것입니다(새 로그가 생성되지도 않음)