这篇文章主要介绍如何实现lvm磁盘快照创建与恢复,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
默认逻辑卷,卷组都已创建。
元数据文件: |
# Xen 4.6 vmServer Configuration bios = "seabios" builder = "hvm" boot = "cd" pae = 1 acpi = 1 acpi_s3 = 1 acpi_s4 = 1 apic = 1 hap = 0 viridian = "all" rtc_timeoffset = 0 localtime = 0 xen_platform_pci = 1 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" usb = 1 usbdevice = "tablet" soundhw = "hda" parallel = "none" serial = "pty" vga = "stdvga" opengl = 1 sdl = 0 vnc = 1 vncunused = 0 vnclisten = "0.0.0.0" # variable parameter name = "server_yxef445nq83m04xy" uuid = "9a7f8d39-315f-4de8-a153-154988ded4b0" #maxmem = 16284 memory = 1024 vcpus = 2 vcpu_avail = 8 vncdisplay = 4100 vncpasswd = "736B2Z" vif = ["mac=00:16:3e:57:05:95,bridge=xenbr0,rate=2Mb/s", "mac=00:16:3e:b9:28:02,bridge=xenbr1"] disk = ["phy:/dev/mapper/vg0-newlv,sdc,w","phy:/dev/mapper/vg0-server_yxef445nq83m04xy_sdb,sdb,w", "tap2:/storage/vdisk/server_yxef445nq83m04xy_sda,sda,w", "file:,sdd:cdrom,r" ] |
:sda为普通文件类型磁盘作为系统盘,sdb和sdc分别为块文件磁盘。其中sdc为自己后加的块磁盘,用于本次测试。
将sdc磁盘进行挂载 |
a.把sdc格式化为ext3文件系统 mkfs.ext3 /dev/sdc b. 建立挂载目录 mkdir /data/ c.把/dev/sdc这个盘挂载到/data目录下 mount /dev/sdc /data d.系统启动时自动挂载/dev/sda,编辑/etc/fstab文件 vi /etc/fstab 如: /dev/VolGroup00/LogVol00 / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 /dev/sdc /data ext3 defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/VolGroup00/LogVol01 swap swap defaults 0 0 |
创建快照: |
lvcreate -s -n snap -L 50M /dev/mapper/vg0-newlv |
将虚拟机关机
执行快照回复 |
lvconvert --merge /dev/vg0/snap |
重启虚拟机。vnc连接。快照恢复。
以上是“如何实现lvm磁盘快照创建与恢复”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注天达云行业资讯频道!