Tag: LVM

  • LVM 快照(snapshot)的第二种用法

    之前我已总结了 LVM 快照的第一种用法: 利用 LVM 在线抓取 MySQL 数据库快照, 也可以扩展到任何需要在线生成磁盘快照的应用. 自 LVM 2.0 以来, 镜像分区不只是只读的, 而且可写. 而写入快照分区的一种应用就是造”沙盒(sandbox)”, 在 Xen VM 环境的具体步骤如下: 1, 假设供测试的虚拟机 test, 分区是 /dev/vm/test-disk, 为其生成 10GB 快照分区 test-ss: lvcreate -s -n test-ss -L10G /dev/vm/test-disk 2, 将 test 虚拟机关机, 可以 ssh root@test “shutdown -h now” 或者 xm shutdown test 3, 复制 /etc/xen/test.conf 到 test-s1.conf, 并将磁盘分区…

  • 利用 LVM 在线抓取 MySQL 数据库快照

    续 小试分身 MySQL Replication, 上次是按照 MySQL 教程做的, 比较死板(或者说, 安全), 但需要锁住数据库, 也就是说, 用户一端的感觉就是服务器出问题了… 而如果通知用户服务器要下线一段时间的话, 又会引起不明真相的用户的莫名猜疑. 那么就需要一种在几秒中之内完成生成镜像的操作, 于是我就想到了 LVM snapshot. Google 了一番, 我看到已经有成功先例了, 步骤如下: 1, 确认 MySQL 的数据区(缺省 /var/lib/mysql) 是在 LVM 上, 假设是 /dev/VOLUME_GROUP/data 2, 开一个 MySQL session, 执行并记录 show master status 的输出: flush tables with read lock; show master status; 3, 在另一个 terminal 执行: lvcreate -s…

  • To Duplicate/Backup a Xen VM in a Logical Volume

    技术笔记. 请忽略 🙂 0, If you are to duplicate, create VMs on destination server, just to create conf files and logical volumes for VMs and hold the place for source VMs. #xen-create-image –hostname [HOSTNAME] –ip [IP] –vcpus 2 –pygrub –dist squeeze 1, Create an LVM snapshot for the VM’s logical volume. #lvcreate -L[SIZE] -s -n…