u盘备份centos系统-(U盘备份系统)

u盘备份centos系统

(U盘备份系统软件)

引言Relax-and-Recover(“ReaR”,此章中简称为 Rear)是供网站管理员所使用的灾难修复架构。它是一个 Bash 脚本结合,您应该根据需在产生灾难时进行的保护特殊工作环境调节这种脚本。

rear限定

硬件配置务必一样(硬盘可以不用一样,可是一个新的硬盘会比备份大)组装yum install rear genisoimage syslinux备份到当地文件目录改动配置文件

编写配置文件/etc/rear/local.conf

# cat /etc/rear/local.conf OUTPUT=ISOOUTPUT_URL=file:///data/BACKUP=NETFSBACKUP_URL=iso:///data/BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/media' '/var/tmp' '/var/crash' '/tmp' '/data')

表明:

OUTPUT 界定修复镜像系统的备份部位BACKUP 界定备份复原对策,能通过内部结构存档可执行程序(tar或rsync)或外界备份程序流程(商业服务或开源系统)进行修复OUTPUT=IOS,输出格式为ISOOUTPUT_URL=file:///data/ 镜像系统备份导出部位,认设置部位 /var/lib/rear/output/BACKUP_PROG_EXCLUDE 清除备份文件目录实行备份# rear -d -v mkbackupRelax-and-Recover 2.4 / GitUsing log file: /var/log/rear/rear-envir.logUsing backup archive '/tmp/rear.F6MCRvLTOnSu5Nv/tmp/isofs/data//backup.tar.gz'Creating disk layoutUsing guessed bootloader 'GRUB' (found in first bytes on /dev/sda)Creating root filesystem layoutHandling network interface 'ens32'ens32 is a physical deviceHandled network interface 'ens32'To log into the recovery system via ssh set up /root/.ssh/authorized_keys or specify SSH_ROOT_PASSWORDcopying logfile /var/log/rear/rear-envir.log into initramfs as '/tmp/rear-envir-partial-2019-12-01T15:00:07 0800.log'copying files and directoriescopying binaries and librariescopying kernel modulescopying all files in /lib*/firmware/Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compressionCreated initrd.cgz with gzip default compression (189840490 bytes) in 22 secondsCreating tar archive '/tmp/rear.F6MCRvLTOnSu5Nv/tmp/isofs/data//backup.tar.gz'Archived 2121 MiB[avg 9919 KiB/sec]OKArchived 2121 MiB in 220 seconds[avg 9874 KiB/sec]Making ISO imageWrote ISO image: /var/lib/rear/output/rear-envir.iso (2.3G)copying resulting files to file locationSaving /var/log/rear/rear-envir.log as rear-envir.log to file locationExiting rear mkbackup (PID 53915) and its descendant processesRunning exit tasksYou should also rm -Rf /tmp/rear.F6MCRvLTOnSu5Nv# ll /data/envir/total 2380992-rw------- 1 root root 202 Dec 1 15:05 README-rw------- 1 root root 2437443584 Dec 1 15:05 rear-envir.iso-rw------- 1 root root 682578 Dec 1 15:05 rear-envir.log-rw------- 1 root root 262 Dec 1 15:05 VERSION

表明:会到备份文件目录建立 IP地址文件夹,数据库文件和系统引导储存到同一个iso文件

实行复原以rear-envir.iso引导系统

键入 root 立即回车键

输入rear -d -v recover 回车键

由于新复原的软件硬盘与之前备份的软件硬盘尺寸不一样。因此需要手动式配备

系统软件此刻被初始化在/mnt/local文件目录

确定/mnt/local/.autorelabel存有,假如不存有则以指令touch /mnt/local/.autorelabel建立。使用reboot指令重新启动

拓展硬盘# fdisk -ldisk /dev/sda: 64.4 GB,64424509440 bytes,125829120 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesdisk label type: dosdisk identifier: 0x0005732dDevice Boot Start End Blocks Id System/dev/sda1 * 2048 2099199 1048576 83 Linux/dev/sda2 2099200 125829119 61864960 8e Linux LVMdisk /dev/mapper/centos-root: 23.6 GB,23613931520 bytes,46120960 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesdisk /dev/mapper/centos-swap: 2147 MB,2147483648 bytes,4194304 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes[root@envir ~]# df -hTFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/centos-root xfs 22G 3.1G 19G 15% /devtmpfs devtmpfs 475M 0 475M 0% /devtmpfs tmpfs 487M 0 487M 0% /dev/shmtmpfs tmpfs 487M 7.7M 479M 2% /runtmpfs tmpfs 487M 0 487M 0% /sys/fs/cgroup/dev/sda1 xfs 1014M 142M 873M 14% /boottmpfs tmpfs 98M 0 98M 0% /run/user/0

尽管系统检测是60G硬盘,可是df见到或是以前系统软件大小

# vgdisplay --- Volume group ---VG Name centosSystem ID Format lvm2Metadata Areas 1Metadata Sequence No 3VG Access read/writeVG Status resizableMAX LV 0Cur LV 2Open LV 2Max PV 0Cur PV 1Act PV 1VG Size <59.00 GiBPE Size 4.00 MiBTotal PE 15103Alloc PE / Size 6142 / 23.99 GiBFree PE / Size 8961 / 35.00 GiBVG UUID Te03U6-VqS2-tewH-liay-G8hD-FjcN-qBXTKi[root@envir ~]# lvdisplay --- Logical volume ---LV Path /dev/centos/rootLV Name rootVG Name centosLV UUID qpRi6l-LgLj-lFlU-UQYR-UiSr-Qg8q-eFFwbXLV Write Access read/writeLV Creation host,time envir,2019-12-01 23:22:12 0800LV Status available# open 1LV Size 21.99 GiBCurrent LE 5630Segments 1Allocation inheritRead ahead sectors auto- currently set to 8192Block device 253:0--- Logical volume ---LV Path /dev/centos/swapLV Name swapVG Name centosLV UUID Cce19z-L2jZ-893o-Cul6-0cE4-F0hk-jDrsQELV Write Access read/writeLV Creation host,2019-12-01 23:22:12 0800LV Status available# open 2LV Size 2.00 GiBCurrent LE 512Segments 1Allocation


相关文章

TPLink路由器是一款功能强大的网络设备,但在使用过程中,我...
TL-WR880N是一款常见的家用路由器,但在使用过程中可能会遇到...
TP-LinkAC1900路由器是一款高性能的无线路由器,它可以支持多...
在家庭或办公室网络中,路由器是连接设备和互联网之间的关键...
TP-Link路由器的网站是tplogin.cn或者192.168.0.1也可以登入...
随着互联网的飞速发展,家庭网络环境越来越重要。路由器是组...