°Ô½Ã¹° 259°Ç
   
[RHEL8.6] ReaR ±¸¼º ¹× ¹é¾÷ Å×½ºÆ®
±Û¾´ÀÌ : theko ³¯Â¥ : 2024-02-06 (È­) 11:02 Á¶È¸ : 661
- ȯ°æ 
rear-s : 192.168.122.220 (backup Server)
rear-c : 192.168.122.221 (Client)


1. NAS ¼­¹ö ±¸¼º 

[root@rear-s ~]# yum install nfs-utils

[root@rear-s ~]#mkdir /backup

[root@rear-s ~]#vi /etc/exports
/backup *(rw,sync,no_root_squash)

[root@rear-s ~]# systemctl start nfs-server.service


> NFS Á¤»óÀûÀÎÁö È®ÀÎ
[root@rear-c ~]# showmount -e 192.168.122.220
Export list for 192.168.122.220:
/backup *



2. Rear ÆÐÅ°Áö ¼³Ä¡ 

[root@rear-c ~]# dnf install rear genisoimage syslinux
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                                                                            30 MB/s |  59 MB     00:01
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                               32 MB/s |  65 MB     00:02
Package genisoimage-1.1.11-39.el8.x86_64 is already installed.
Dependencies resolved.
===================================================================================================================================================================================================
 Package                                      Architecture                      Version                                          Repository                                                   Size
===================================================================================================================================================================================================
Installing:
 rear                                         x86_64                            2.6-10.el8                                       rhel-8-for-x86_64-appstream-rpms                            785 k
 syslinux                                     x86_64                            6.04-6.el8                                       rhel-8-for-x86_64-baseos-rpms                               578 k
Installing dependencies:
 bind-export-libs                             x86_64                            32:9.11.36-11.el8_9                              rhel-8-for-x86_64-baseos-rpms                               1.1 M
 dhcp-client                                  x86_64                            12:4.3.6-49.el8                                  rhel-8-for-x86_64-baseos-rpms                               318 k
 dhcp-common                                  noarch                            12:4.3.6-49.el8                                  rhel-8-for-x86_64-baseos-rpms                               207 k
 dhcp-libs                                    x86_64                            12:4.3.6-49.el8                                  rhel-8-for-x86_64-baseos-rpms                               148 k
 ipcalc                                       x86_64                            0.2.4-4.el8                                      rhel-8-for-x86_64-baseos-rpms                                38 k
 libburn                                      x86_64                            1.4.8-3.el8                                      rhel-8-for-x86_64-appstream-rpms                            173 k
 libisoburn                                   x86_64                            1.4.8-4.el8                                      rhel-8-for-x86_64-appstream-rpms                            410 k
 libisofs                                     x86_64                            1.4.8-3.el8                                      rhel-8-for-x86_64-appstream-rpms                            221 k
 syslinux-nonlinux                            noarch                            6.04-6.el8                                       rhel-8-for-x86_64-baseos-rpms                               555 k
 xorriso                                      x86_64                            1.4.8-4.el8                                      rhel-8-for-x86_64-appstream-rpms                            281 k

Transaction Summary
===================================================================================================================================================================================================
Install  12 Packages


3. Rear ¹é¾÷ ¼³Á¤ Çϱâ 
[¼³¸í]
---------------------------------------------------------------------------------------------
OUTPUT
Define the bootable image type among USB, ISO, RAWDISK

OUTPUT_URL
Backup Target among NFS, CIFS, FILE, FTP, HTTP, RSYNC

BACKUP
Which backup method to use: External third-party or internal ReaR mechanism?

BACKUP_URL
Backup target location when using the internal backup method.

BACKUP_PROG_EXCLUDE
Directories to be excluded while performing the backup. Examples are /media and /var/tmp
---------------------------------------------------------------------------------------------

# vim /etc/rear/local.conf
OUTPUT=ISO
OUTPUT_URL=nfs://192.168.122.220/backup
BACKUP=NETFS
BACKUP_URL=nfs://192.168.122.220/backup
BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/media' '/var/tmp' '/var/crash')

---------------¿É¼Ç-------------------------------------------------------------------------
- ƯÁ¤ Æú´õ¸¦ Á¦¿Ü ¿É¼Ç 

BACKUP_PROG_EXCLUDE=( '/data/folder1/*' '/data/folder2/*' ) #¿©·¯ Ç׸ñÀ» Ãß°¡ °¡´É

- ƯÁ¤ F/S Á¦¿Ü ¿É¼Ç 
EXCLUDE_MOUNTPOINTS=( "/data01" "/data02" )
EXCLUDE_COMPonENTS=( "fs:/data01" "fs:/data02" )
EXCLUDE_RECREATE=( "fs:/data01" "fs:/data02" )

! ÁÖÀÇ : OS  ºÎÆà ½Ã ¿¡·¯ ¹ß»ý => mkfs, mount °úÁ¤ ÅëÇØ fs¸¦ Àç»ý¼º¶Ç´Â , /etc/fstab¿¡¼­ ÇØ´ç fs¸¦ Á¦°ÅÇØ¾ß Á¤»ó ºÎÆÃ
---------------------------------------------------------------------------------------------


4. ¹é¾÷ ½ÇÇà 

[root@rear-c ~]# rear -v -d mkbackup
Relax-and-Recover 2.6 / 2020-06-17
Running rear mkbackup (PID 37342)
Using log file: /var/log/rear/rear-rear-c.log
Running workflow mkbackup on the normal/original system
Using backup archive '/tmp/rear.DzOC2vlZyLW9egz/outputfs/rear-c/backup.tar.gz'
Using autodetected kernel '/boot/vmlinuz-4.18.0-372.9.1.el8.x86_64' as kernel in the recovery system
Creating disk layout
Using guessed bootloader 'GRUB' (found in first bytes on /dev/vda)
Verifying that the entries in /var/lib/rear/layout/disklayout.conf are correct ...
Creating recovery system root filesystem skeleton layout
Handling network interface 'enp1s0'
enp1s0 is a physical device
Handled network interface 'enp1s0'
To log into the recovery system via ssh set up /root/.ssh/authorized_keys or specify SSH_ROOT_PASSWORD
Copying logfile /var/log/rear/rear-rear-c.log into initramfs as '/tmp/rear-rear-c-partial-2024-01-31T13:09:00+09:00.log'

Copying files and directories                        <------------------NFS ¼­¹ö¿¡ µ¥ÀÌÅÍ ÀúÀå Çϱ⠽ÃÀÛ 
Copying binaries and libraries
Copying all kernel modules in /lib/modules/4.18.0-372.9.1.el8.x86_64 (MODULES contains 'all_modules')
Copying all files in /lib*/firmware/
Skip copying broken symlink '/etc/mtab' target '/proc/48589/mounts' on /proc/ /sys/ /dev/ or /run/
Ignoring irrelevant broken symlink /usr/lib/modules/4.18.0-372.9.1.el8.x86_64/build
Ignoring irrelevant broken symlink /usr/lib/modules/4.18.0-372.9.1.el8.x86_64/source
Testing that the recovery system in /tmp/rear.DzOC2vlZyLW9egz/rootfs contains a usable system
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (498567622 bytes) in 29 seconds
Making ISO image
Wrote ISO image: /var/lib/rear/output/rear-rear-c.iso (488M)
Copying resulting files to nfs location
Saving /var/log/rear/rear-rear-c.log as rear-rear-c.log to nfs location
Copying result files '/var/lib/rear/output/rear-rear-c.iso /tmp/rear.DzOC2vlZyLW9egz/tmp/VERSION /tmp/rear.DzOC2vlZyLW9egz/tmp/README /tmp/rear.DzOC2vlZyLW9egz/tmp/rear-rear-c.log' to /tmp/rear.DzOC2vlZyLW9egz/outputfs/rear-c at nfs location
Making backup (using backup method NETFS)
Creating tar archive '/tmp/rear.DzOC2vlZyLW9egz/outputfs/rear-c/backup.tar.gz'
Archived 2442 MiB [avg 14208 KiB/sec] OK                      
WARNING: tar ended with return code 1 and below output:
  ---snip---
  tar: /var/lib/sss/pipes/private/sbus-monitor: socket ignored
  tar: /var/lib/sss/pipes/private/sbus-dp_implicit_files.1000: socket ignored
  tar: /var/lib/sss/pipes/nss: socket ignored
  ----------
This means that files have been modified during the archiving
process. As a result the backup may not be completely consistent
or may not be a perfect copy of the system. Relax-and-Recover
will continue, however it is highly advisable to verify the
backup in order to be sure to safely recover this system.

Archived 2442 MiB in 177 seconds [avg 14127 KiB/sec]            <------- Àü¼Û °á°ú
Exiting rear mkbackup (PID 37342) and its descendant processes ...
Running exit tasks
You should also rm -Rf --one-file-system /tmp/rear.DzOC2vlZyLW9egz


- µ¥ÀÌÅÍ ÀÌÀü½Ã rear-c ¼­¹ö¿¡¼­ º¸¸é NFS°¡ ¿¬°áµÇ¾î ÆÄÀÏÀ» ³Ñ±â°í Àִ°ÍÀ» È®ÀÎ ÇÒ¼öÀÖ´Ù.
[root@rear-c tmp]# df -hP
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  9.2M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/rhel-root     17G  8.3G  8.8G  49% /
/dev/vda1               1014M  228M  787M  23% /boot
tmpfs                    796M   12K  796M   1% /run/user/42
tmpfs                    796M     0  796M   0% /run/user/0
192.168.122.220:/backup   40G  2.8G   38G   7% /tmp/rear.DzOC2vlZyLW9egz/outputfs   <---NFSÀ» ÀÚµ¿ ¸¶¿îÆ® ÇÏ¿© µ¥ÀÌÅÍ Àü¼ÛÁß


5. ¹é¾÷ È®ÀΠ
[root@rear-s rear-c]# pwd
/backup/rear-c
[root@rear-s rear-c]# ls -al
total 3035948
drwxr-x--- 2 root root        120 Jan 31 13:12 .
drwxr-xr-x 3 root root         20 Jan 31 13:09 ..
-rw------- 1 root root   11433531 Jan 31 13:12 backup.log
-rw------- 1 root root 2585786056 Jan 31 13:12 backup.tar.gz
-rw------- 1 root root        202 Jan 31 13:09 README
-rw------- 1 root root  511428608 Jan 31 13:09 rear-rear-c.iso
-rw------- 1 root root     143810 Jan 31 13:09 rear-rear-c.log
-rw------- 1 root root        270 Jan 31 13:09 VERSION


- ¹é¾÷ÇÒ ¼­¹öÀÇ È£½ºÆ® À̸§Àº ¿ø°Ý ´ë»ó À§Ä¡¿¡ »ý¼ºµÈ ISO ÆÄÀÏ¿¡ Á¢µÎ»ç°¡ ºÙ½À´Ï´Ù.
. rear-production.iso - ºÎÆ® ISO À̹ÌÁö, º¹±¸ Áß »ç¿ë
. backup.tar.gz - ÇÁ·Î´ö¼Ç ¼­¹öÀÇ ÆÄÀÏÀ» Æ÷ÇÔÇÏ´Â TAR ÆÄÀÏ
. ReaR ¸í·ÉÀº mkbackup ÀÛ¾÷ Áß¿¡ »ý¼ºµÈ µð·ºÅ丮¸¦ Á¦°ÅÇ϶ó´Â Á¦¾È°ú ÇÔ²² ³¡³³´Ï´Ù.


6. ¹é¾÷ º¹±¸ 

TEST 1>

> ÀϺΠµ¥ÀÌÅ͸¦ »èÁ¦ Çغ¸°Ú½À´Ï´Ù. 
[root@rear-c ~]# pwd
/root
[root@rear-c ~]# ls
anaconda-ks.cfg  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  Pictures  Public  Templates  Videos
[root@rear-c ~]# rm -rf Music/ Pictures/ Public/ Templates/
[root@rear-c ~]# ls
anaconda-ks.cfg  Desktop  Documents  Downloads  initial-setup-ks.cfg  Videos


Âü°í : Ŭ·°½º ȸ»ç ȨÆäÀÌÁö¿¡¼­ ³»¿ë ÆÛ¿È


> º¹±¸ ¿Ï·áÈÄ »èÁ¦µÈ Æú´õ°¡ º¹±¸µÈ°ÍÀ» È®ÀÎ ÇÒ¼öÀÖ½À´Ï´Ù.   Music/ Pictures/ Public/ Templates/
[root@rear-c ~]# pwd
/root
[root@rear-c ~]# ls
anaconda-ks.cfg  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  Pictures  Public  rear-2024-01-31T16:29:10+09:00.log  Templates  Videos




TEST2> 

> /usr »èÁ¦ 
[root@rear-c tmp]# cd /usr/
[root@rear-c usr]# ls
bin  config  games  include  lib  lib64  libexec  local  sbin  share  src  tmp

[root@rear-c usr]# rm -rf *
[root@rear-c usr]# ls
-bash: /usr/bin/ls: No such file or directory          <------ /usr¸¦ Åë°·Î Áö¿ö¼­ ¸í·É¾î°¡ ¾ÈµÇ´Â Çö»ó



- TEST1  °ú °°ÀÌ µ¿ÀÏÇÏ°Ô º¹±¸ ÇÏ´Ï Á¤»óÀûÀ¸·Î OS ºÎÆà ÈÄ /usrÀÌ º¹±¸µÈ°ÍÀ» È®ÀÎÇÒ¼öÀÖ¾ú½À´Ï´Ù. 

> /usr º¹±¸ È®ÀÎ
[root@rear-c ~]# cd /usr/
[root@rear-c usr]# ls
bin  config  games  include  lib  lib64  libexec  local  sbin  share  src  tmp


Âü°í¸µÅ© :
https://www.redhat.com/sysadmin/rear-backup-and-recover
https://access.redhat.com/documentation/ko-kr/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-relax-and-recover_rear


À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

miwit.com sir.co.kr DNS Powered by DNSEver.com DNS Powered by DNSEver.com