Chinaunix首页 | 论坛 | 博客
  • 博客访问: 94782
  • 博文数量: 42
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-16 13:39
文章分类

全部博文(42)

文章存档

2011年(1)

2010年(6)

2009年(35)

我的朋友

分类: LINUX

2009-08-17 17:00:31

以下为个人主页和论坛,欢迎光临
虚拟机的dd克隆实际演练
1、在关闭系统的情况下,插入一块新盘(与旧盘大小1样,为8G)
2、启动系统
3、使用df和fdisk -l命令查看
[root@offsite ~]# df -h
鏂囦欢绯荤粺              瀹归噺  宸茬敤 鍙?敤 宸茬敤% 鎸傝浇鐐?
/dev/mapper/VolGroup00-LogVol00
                      6.7G  4.7G  1.7G  75% /
/dev/sda1              99M   11M   83M  12% /boot
tmpfs                 252M     0  252M   0% /dev/shm
[root@offsite ~]# fdisk -l                ----在这个时候sdb并不会有被分区出来,这里是dd后的情况
Disk /dev/sda: 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/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1044     8281507+  8e  Linux LVM
 
Disk /dev/sdb: 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/sdb1   *           1          13      104391   83  Linux
/dev/sdb2              14        1044     8281507+  8e  Linux LVM
4、使用dd进行克隆整块系统盘到sdb
[root@offsite ~]# dd if=/dev/sda of=/dev/sdb bs=100M
81+1 records in
81+1 records out
8589934592 bytes (8.6 GB) copied, 332.512 seconds, 25.8 MB/s
[root@offsite ~]# fdisk -l          ---完毕后查看发现sdb已经完全和sda的数据和分区一样
 
Disk /dev/sda: 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/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1044     8281507+  8e  Linux LVM
 
Disk /dev/sdb: 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/sdb1   *           1          13      104391   83  Linux
/dev/sdb2              14        1044     8281507+  8e  Linux LVM
5、验证,通过对grub.conf进行修改将启动盘设置为sdb1
[root@offsite ~]# more /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=1          ---默认是0,这里改为1,表示默认启动盘为第二块
timeout=5
splashimage=(hd1,0)/grub/splash.xpm.gz     ---默认是0,这里改为1,表示默认启动盘为第二块的第一个分区
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-8.el5)
        root (hd1,0)                       ---默认是0,这里改为1,表示默认启动盘为第二块的第一个分区
        kernel /vmlinuz-2.6.18-8.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-8.el5.img
然后重新启动系统发现能正常启动,并且通过对虚拟机的硬盘状态观察,发现sda这张盘并没有处于使用状况,而sdb这张盘在不停地闪烁
为了达到更明确的效果,直接移出sda这张盘,重新启动,发现系统正常,但这时/etc/grub.conf里的hd1变成了hd0,这是因为sdb在sda移出后
优先成为了第1块盘
若再将sda插进来,重新启动,系统仍然正常,这时的/etc/grub.conf里依然是hd1,推断估计旧盘sda回来后,仍然是处于它的优先级为止,但
这个时候/etc/grub.conf里的配置仍然会是要求从sdb来启动,也就是说/etc/grub.conf里指定了从哪块盘启动,那系统就一定按它的设置进行
操作,只是会随盘的优先级别而逻辑上的改变盘符号,并不会有其他任何变化。
阅读(529) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~