手工备份Xen HVM VPS
ssh登录服务器
运行 lvscan 扫描LV存储a
[root@vs09 /]# lvscan
ACTIVE ‘/dev/vol/vm3240_img’ [20.00 GB] inherit
ACTIVE ‘/dev/vol/vm3260_img’ [25.00 GB] inherit
ACTIVE ‘/dev/vol/vm3280_img’ [20.00 GB] inherit
ACTIVE ‘/dev/vol/vm3290_img’ [20.00 GB] inherit
ACTIVE ‘/dev/vol/vm3320_img’ [20.00 GB] inherit
ACTIVE ‘/dev/vol/vm3330_img’ [20.00 GB] inherit
ACTIVE ‘/dev/vol/vm3360_img’ [20.00 GB] inherit
ACTIVE ‘/dev/vol/vm3370_img’ [20.00 GB] inherit
建立Snapshot/快照
[root@vs09 /]#
lvcreate -s -L 10G -n vm3240_img-snap /dev/vol/vm3240_img
Logical volume “vm3240_img-snap” created
参数意思
-s = 快照模式
-L *G/M = 快照大小
-n xxx = 快照名称
/dev/vol/vm324_img 原镜像
重建分区表 (如果不需要挂载检查数据 不需要重建)
kpartx -av /dev/vol/vm3240_img-snap
add map vm324_img-snap1 : 0 62910477 linear /dev/vol/vm3240_img-snap 63
挂载NTFS文件系统 获得硬盘数据
mount -t ntfs /dev/mapper/vm3240_img-snap1 /mnt -o force
The disk contains an unclean file system (0, 0).
The file system wasn’t safely closed on Windows. Fixing.
可以查看数据
[root@vs09 /]# ll /mnt
total 2096889
-rwxrwxrwx 1 root root 0 Sep 6 17:41 AUTOEXEC.BAT
-rwxrwxrwx 1 root root 208 Sep 6 18:18 boot.ini
-rwxrwxrwx 1 root root 0 Sep 6 17:41 CONFIG.SYS
drwxrwxrwx 1 root root 4096 Sep 6 19:26 Documents and Settings
drwxrwxrwx 1 root root 1294336 Sep 6 21:57 I386
-rwxrwxrwx 1 root root 0 Sep 6 17:41 IO.SYS
-rwxrwxrwx 1 root root 0 Sep 6 17:41 MSDOS.SYS
-rwxrwxrwx 1 root root 94720 Feb 17 2007 msizap.exe
-rwxrwxrwx 1 root root 47772 Mar 22 2006 NTDETECT.COM
-rwxrwxrwx 1 root root 297072 Sep 6 21:02 ntldr
-rwxrwxrwx 1 root root 2145386496 Oct 5 16:29 pagefile.sys
drwxrwxrwx 1 root root 4096 Sep 7 00:55 Program Files
drwxrwxrwx 1 root root 0 Sep 6 19:25 System Volume Information
drwxrwxrwx 1 root root 77824 Sep 6 17:08 WINDOWS
drwxrwxrwx 1 root root 0 Sep 6 17:44 wmpub
卸载挂载的设备
umount /mnt
partx -d /dev/vol/vm3240_img-snap
lvremove /dev/vol/vm3240_img-snap
Do you really want to remove active logical volume vm3240_img-snap? [y/n]: y
输入y
Logical volume “vm3240_img-snap” successfully removed
即可完成