Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408735
  • 博文数量: 87
  • 博客积分: 6015
  • 博客等级: 准将
  • 技术积分: 960
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-13 16:59
文章分类
文章存档

2015年(4)

2010年(16)

2009年(13)

2008年(12)

2007年(29)

2006年(13)

我的朋友

分类: LINUX

2010-08-05 19:00:58

快照现在已经成为信息安全业内最受欢迎的技术。当生产数据中的记录出现了逻辑错误,可以通过快照的方式快速恢复,全程停机时间可以确保在分钟级,为企业的数据保护起到了保驾护航的功效。下面着重讲解Openfiler系统中如何创建快照。Openfiler系统的快照是通过LVM工具的快照功能实现的。所以在速度和性能上都比较不错。
在Openfiler系统中,用户可以创建循环自动快照,也可以创建定时快照。具体的配置如下所示。
 选择某个需要创建快照的LUN(逻辑卷)。
 配置快照参数。
 查看逻辑卷快照。
 挂载快照
(1)点击“Volumes”“Manage Volumes”选择指定的卷组和逻辑卷创建快照功能。
(2)点击“Create”按钮进入快照配置界面。在第一个栏中配置自动循环快照功能,在第二个栏中配置一次性照。任何一种快照都可以设置是否共享,如下图自动循环快照不共享,一次性快照设置共享。其中“Size in MB”表示快照区域的大小,一般根据逻辑卷数据变化量的大小进行设置,建议设置在8~10%左右;“Interval in hours”表示每隔多少小时创建一个快照,“Rotate count”表示可以创建多少个快照。
(3)登RHEL5系统,挂载快照使用。具体步骤如下。

[root@rhel5 /]# service iscsi start //启动iSCSI客户端服务。
Setting up iSCSI targets: iscsiadm: No records
[ OK ]
[root@rhel5 /]# iscsiadm -m discovery -t st -p 192.168.1.249 //搜索NAS服务器上的iSCSI-Targets记录,结果显示已发现一个iSCSI-Targets记录。
192.168.1.249:3260,1 iqn.2006-01.com.openfiler:tsn.0229e3483cdc
[root@rhel5 /]# fdisk –l //显示RHEL5系统的磁盘分区情况。
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1044 8281507+ 8e Linux LVM
[root@rhel5 /]# iscsiadm -m node -p 192.168.1.249 --login //登录NAS服务器,与ISCSI-Targets Server建立连接。
Login session [iface: default, target: iqn.2006-01.com.openfiler:tsn.0229e3483cdc, portal: 192.168.1.249,3260]
[root@rhel5 /]# fdisk –l //再次显示RHEL5系统的磁盘分区,发现多出一块硬盘,/dev/sda就是Openfiler系统上刚刚划分的LUN。
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1044 8281507+ 8e Linux LVM
Disk /dev/sda: 3154 MB, 3154116608 bytes //多出的磁盘/dev/sda,大小为3G左右。
98 heads, 62 sectors/track, 1013 cylinders
Units = cylinders of 6076 * 512 = 3110912 bytes
Disk /dev/sda doesn't contain a valid partition table
[root@rhel5 /]# fdisk /dev/sda //对/dev/sda磁盘分区。
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won'
t be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p //显示分区情况,/dev/sda暂无分区信息。
Disk /dev/sda: 3154 MB, 3154116608 bytes
98 heads, 62 sectors/track, 1013 cylinders
Units = cylinders of 6076 * 512 = 3110912 bytes
Device Boot Start End Blocks Id System
Command (m for help): n //创建分区。
Command action
e extended
p primary partition (1-4)
p //创建一个主分区。
Partition number (1-4): 1
First cylinder (1-1013, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1013, default 1013):
Using default value 1013
Command (m for help): w //保存分区信息,并退出。
The partition table has been
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rhel5 /]# partprobe //将新建分区信息写入到内核。
[root@rhel5 /]# mkfs.ext3 /dev/sda1 //创建文件系统,将/dev/sda1分区格式化为ext3。
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
384768 inodes, 769365 blocks
38468 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=788529152
24 block groups
32768 blocks per group, 32768 fragments per group
16032 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rhel5 /]# mkdir /media/sda1 //创建挂载点
[root@rhel5 /]# mount /dev/sda1 /media/sda1/ //将新建的分区挂载使用。
[root@rhel5 /]# cd /media/sda1/
[root@rhel5 sda1]# ls //显示/dev/sda1分区信息
lost+found
[root@rhel5 sda1]# df -h //查看挂载情况,显示正常挂载
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.8G 2.2G 3.3G 40% /
/dev/hda1 99M 20M 75M 21% /boot
tmpfs 471M 0 471M 0% /dev/shm
192.168.1.250:/netinstall
450G 294G 133G 69% /mnt
/dev/sda1 2.9G 69M 2.7G 3% /media/sda1


root@rhel5 /]#umount /dev/sda1 //卸载出现的lun1逻辑卷。
root@rhel5 /]# iscsiadm -m node -p 192.168.1.249 –u //i注销与iSCSI服务器连接。
[root@rhel5 /]# fdisk –l //显示磁盘分区,/dev/sda1分区已经断开。
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1044 8281507+ 8e Linux LVM
[root@rhel5 /]# iscsiadm -m node -p 192.168.1.249 –l //再次登录iSCSI服务器,建立连接
Login session [iface: default, target: iqn.2006-01.com.openfiler:tsn.0229e3483cdc, portal: 192.168.1.249,3260]
[root@rhel5 /]# fdisk –l //显示磁盘分区,出现两个分区。其中/dev/sdb1为快照。
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1044 8281507+ 8e Linux LVM
Disk /dev/sda: 3154 MB, 3154116608 bytes //原来的分区
98 heads, 62 sectors/track, 1013 cylinders
Units = cylinders of 6076 * 512 = 3110912 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 1013 3077463 83 Linux
Disk /dev/sdb: 3154 MB, 3154116608 bytes //sda1逻辑卷的快照分区。即在某个时间点sda1分区的完全用状态。
98 heads, 62 sectors/track, 1013 cylinders Openfiler 系统的安装与配置
Units = cylinders of 6076 * 512 = 3110912 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1013 3077463 83 Linux
[root@rhel5 /]# mount /dev/sda1 /media/sda1
[root@rhel5 /]# mount /dev/sdb1 /media/sda1_snap/
You have new mail in /var/spool/mail/root
[root@rhel5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.8G 2.2G 3.3G 40% /
/dev/hda1 99M 20M 75M 21% /boot
tmpfs 471M 0 471M 0% /dev/shm
192.168.1.250:/netinstall
450G 294G 133G 69% /mnt
/dev/sda1 2.9G 69M 2.7G 3% /media/sda1
/dev/sdb1 2.9G 69M 2.7G 3% /media/sda1_snap
[root@rhel5 /]# ls /media/sda1 /media/sda1_snap/ //通过显示出知,sda1的快照是在16 :33~16 :38之间创建的,在原来的磁盘上,每隔5分钟就会创建一个基于当前时间的文件。当用户不小心误删作了16 :33 :33文件时,用户可以轻松的通过快照将16 :33 :33文件恢复回来。
/media/sda1:
16:33:33 16:38:35 16:53:36
/media/sda1_snap/:
16:33:33


阅读(2627) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-12-08 11:20:17

哥们,我想学习一下openfiler 快照,qq:32352619,有详细点的文档吗