您没有来错地!为了更好的发展,黑基网已于9月19日正式更名为【安基网】,域名更换为www.safebase.cn,请卸载旧的APP并安装新的APP,给您带来不便,敬请理解!谢谢

黑基Web安全攻防班
安基网 首页 IT技术 网络管理 查看内容

虚拟机unbuntu的RAID实验

2011-8-8 14:30| 投稿: Linux

摘要:   先在VMWARE添加硬件,3块SCSI硬盘,如果要做RAID5就得四块了。  然后用fdisk将硬盘分区,注意分区的系统格式。  Disk /dev/sdd: 3221 MB, 322122547...
  先在VMWARE添加硬件,3块SCSI硬盘,如果要做RAID5就得四块了。  然后用fdisk将硬盘分区,注意分区的系统格式。  Disk /dev/sdd: 3221 MB, 3221225472 bytes  255 heads, 63 sectors/track, 391 cylinders  Units = cylinders of 16065 * 512 = 8225280 bytes  Disk identifier: 0xe45cf3b9  Device Boot      Start         End      Blocks   Id  System  /dev/sdd1               1         130     1044193+  fd  Linux raid autodetect  /dev/sdd2             131         260     1044225   fd  Linux raid autodetect  /dev/sdd3             261         391     1052257+  fd  Linux raid autodetect  Disk /dev/sde: 3221 MB, 3221225472 bytes  255 heads, 63 sectors/track, 391 cylinders  Units = cylinders of 16065 * 512 = 8225280 bytes  Disk identifier: 0xb51587ec  Device Boot      Start         End      Blocks   Id  System  /dev/sde1               1         130     1044193+  fd  Linux raid autodetect  /dev/sde2             131         260     1044225   fd  Linux raid autodetect  /dev/sde3             261         391     1052257+  fd  Linux raid autodetect  Disk /dev/sdf: 3221 MB, 3221225472 bytes  255 heads, 63 sectors/track, 391 cylinders  Units = cylinders of 16065 * 512 = 8225280 bytes  Disk identifier: 0x5c56f4ae  Device Boot      Start         End      Blocks   Id  System  /dev/sdf1               1         130     1044193+  fd  Linux raid autodetect  /dev/sdf2             131         260     1044225   fd  Linux raid autodetect  /dev/sdf3             261         391     1052257+  fd  Linux raid autodetect  安装mdadm,并确认 apt-get install mdadm,  nestor@nestor-desktop:~$ lsmod | grep md  md_mod                 82068  0  nestor@nestor-desktop:~$ cat /proc/devices | grep md  1 ramdisk  9 md  253 mdp  nestor@nestor-desktop:~$ cat /proc/mdstat  Personalities :  unused devices: <none>  RAID 0:  nestor@nestor-desktop:~$ sudo mdadm -Cv /dev/md0 -l0 -n3 /dev/sdd1 /dev/sde1 /dev/sdf1  mdadm: chunk size defaults to 64K  mdadm: array /dev/md0 started.  nestor@nestor-desktop:~$ cat /proc/mdstat  Personalities : [raid0]  md0 : active raid0 sdf1[2] sde1[1] sdd1[0]  3132288 blocks 64k chunks  unused devices: <none>  nestor@nestor-desktop:~$ mdadm -D /dev/md0  mdadm: cannot open /dev/md0: Permission denied  nestor@nestor-desktop:~$ sudo mdadm -D /dev/md0  /dev/md0:  Version : 00.90.03  Creation Time : Sun Aug  7 01:35:11 2011  Raid Level : raid0  Array Size : 3132288 (2.99 GiB 3.21 GB)  Raid Devices : 3  Total Devices : 3  Preferred Minor : 0  Persistence : Superblock is persistent  Update Time : Sun Aug  7 01:35:11 2011  State : clean  Active Devices : 3  Working Devices : 3  Failed Devices : 0  Spare Devices : 0  Chunk Size : 64K  UUID : 7da54c47:fdd46140:e896b948:8bdba58f (local to host nestor-desktop)  Events : 0.1  Number   Major   Minor   RaidDevice State  0       8       49        0      active sync   /dev/sdd1  1       8       65        1      active sync   /dev/sde1  2       8       81        2      active sync   /dev/sdf1  nestor@nestor-desktop:~$ sudo mkfs.ext3 /dev/md0  mke2fs 1.40.8 (13-Mar-2008)  Filesystem label=  OS type: Linux  Block size=4096 (log=2)  Fragment size=4096 (log=2)  195840 inodes, 783072 blocks  39153 blocks (5.00%) reserved for the super user  First data block=0  Maximum filesystem blocks=805306368  24 block groups  32768 blocks per group, 32768 fragments per group  8160 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 31 mounts or  180 days, whichever comes first.  Use tune2fs -c or -i to override.  nestor@nestor-desktop:~$  nestor@nestor-desktop:~$ sudo mkdir /raid0disk  nestor@nestor-desktop:~$ sudo mount /dev/md0 /raid0disk  nestor@nestor-desktop:~$  nestor@nestor-desktop:~$  RAID 1:  nestor@nestor-desktop:~$ sudo mdadm -Cv /dev/md1  -l1 -n2 -x1 /dev/sdd2 /dev/sde2 /dev/sdf2  mdadm: size set to 1044160K  mdadm: array /dev/md1 started.  nestor@nestor-desktop:~$  nestor@nestor-desktop:~$  nestor@nestor-desktop:~$ cat /proc/mdstat  Personalities : [raid0] [raid1]  md1 : active raid1 sdf2[2](S) sde2[1] sdd2[0]  1044160 blocks [2/2] [UU]  md0 : active raid0 sdf1[2] sde1[1] sdd1[0]  3132288 blocks 64k chunks  unused devices: <none>  nestor@nestor-desktop:~$ mdadm -D /dev/md1  mdadm: cannot open /dev/md1: Permission denied  nestor@nestor-desktop:~$ sudo mdadm -D /dev/md1  /dev/md1:  Version : 00.90.03  Creation Time : Sun Aug  7 01:43:55 2011  Raid Level : raid1  Array Size : 1044160 (1019.86 MiB 1069.22 MB)  Used Dev Size : 1044160 (1019.86 MiB 1069.22 MB)  Raid Devices : 2  Total Devices : 3  Preferred Minor : 1  Persistence : Superblock is persistent  Update Time : Sun Aug  7 01:44:00 2011  State : clean  Active Devices : 2  Working Devices : 3  Failed Devices : 0  Spare Devices : 1  UUID : ee1158f1:5d371eef:e896b948:8bdba58f (local to host nestor-desktop)  Events : 0.4  Number   Major   Minor   RaidDevice State  0       8       50        0      active sync   /dev/sdd2  1       8       66        1      active sync   /dev/sde2  2       8       82        -      spare   /dev/sdf2  nestor@nestor-desktop:~$ sudo mkfs.ext3 /dev/md1  mke2fs 1.40.8 (13-Mar-2008)  Filesystem label=  OS type: Linux  Block size=4096 (log=2)  Fragment size=4096 (log=2)  65280 inodes, 261040 blocks  13052 blocks (5.00%) reserved for the super user  First data block=0  Maximum filesystem blocks=268435456  8 block groups  32768 blocks per group, 32768 fragments per group  8160 inodes per group  Superblock backups stored on blocks:  32768, 98304, 163840, 229376  Writing inode tables: done  Creating journal (4096 blocks): done  Writing superblocks and filesystem accounting information: done  This filesystem will be automatically checked every 23 mounts or  180 days, whichever comes first.  Use tune2fs -c or -i to override.  nestor@nestor-desktop:~$ sudo mkdir /raid1disk  nestor@nestor-desktop:~$ sudo mount /dev/md1 /raid1disk  RAID 5, 并模拟坏盘:  nestor@nestor-desktop:~$ sudo mdadm -Cv /dev/md5  -l5 -n3 -x1 -c128 /dev/sdd3 /dev/sde3 /dev/sdf3 /dev/sdc3  mdadm: layout defaults to left-symmetric  mdadm: size set to 1052160K  mdadm: array /dev/md5 started.  nestor@nestor-desktop:~$ mdadm -D /dev/md5  mdadm: cannot open /dev/md5: Permission denied  nestor@nestor-desktop:~$ sudo mdadm -D /dev/md5  /dev/md5:  Version : 00.90.03  Creation Time : Sun Aug  7 05:04:38 2011  Raid Level : raid5  Array Size : 2104320 (2.01 GiB 2.15 GB)  Used Dev Size : 1052160 (1027.67 MiB 1077.41 MB)  Raid Devices : 3  Total Devices : 4  Preferred Minor : 5  Persistence : Superblock is persistent  Update Time : Sun Aug  7 05:05:08 2011  State : clean  Active Devices : 3  Working Devices : 4  Failed Devices : 0  Spare Devices : 1  Layout : left-symmetric  Chunk Size : 128K  UUID : b14234b7:8b18c28b:e896b948:8bdba58f (local to host nestor-desktop)  Events : 0.4  Number   Major   Minor   RaidDevice State  0       8       51        0      active sync   /dev/sdd3  1       8       67        1      active sync   /dev/sde3  2       8       83        2      active sync   /dev/sdf3  3       8       35        -      spare   /dev/sdc3  nestor@nestor-desktop:~$ mkfs.ext3 /dev/md5  mke2fs 1.40.8 (13-Mar-2008)  mkfs.ext3: Permission denied while trying to determine filesystem size  nestor@nestor-desktop:~$ sudo mkfs.ext3 /dev/md5  mke2fs 1.40.8 (13-Mar-2008)  Filesystem label=  OS type: Linux  Block size=4096 (log=2)  Fragment size=4096 (log=2)  131648 inodes, 526080 blocks  26304 blocks (5.00%) reserved for the super user  First data block=0  Maximum filesystem blocks=541065216  17 block groups  32768 blocks per group, 32768 fragments per group  7744 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 24 mounts or  180 days, whichever comes first.  Use tune2fs -c or -i to override.  nestor@nestor-desktop:~$ sudo mkdir /raid5disk  nestor@nestor-desktop:~$ mount /dev/md5 /raid5disk  mount: only root can do that  nestor@nestor-desktop:~$ sudo mount /dev/md5 /raid5disk  nestor@nestor-desktop:~$ sudo gedit /etc/fstat  nestor@nestor-desktop:~$ sudo gedit /etc/fstab  q  nestor@nestor-desktop:~$  nestor@nestor-desktop:~$ q  nestor@nestor-desktop:~$ sudo mdadm /dev/md5 -f /dev/sdd3  mdadm: set /dev/sdd3 faulty in /dev/md5  nestor@nestor-desktop:~$ mdadm -D /dev/md5  mdadm: cannot open /dev/md5: Permission denied  nestor@nestor-desktop:~$ sudo mdadm -D /dev/md5  /dev/md5:  Version : 00.90.03  Creation Time : Sun Aug  7 05:04:38 2011  Raid Level : raid5  Array Size : 2104320 (2.01 GiB 2.15 GB)  Used Dev Size : 1052160 (1027.67 MiB 1077.41 MB)  Raid Devices : 3  Total Devices : 4  Preferred Minor : 5  Persistence : Superblock is persistent  Update Time : Sun Aug  7 05:16:53 2011  State : clean, degraded, recovering  Active Devices : 2  Working Devices : 3  Failed Devices : 1  Spare Devices : 1  Layout : left-symmetric  Chunk Size : 128K  Rebuild Status : 80% complete  UUID : b14234b7:8b18c28b:e896b948:8bdba58f (local to host nestor-desktop)  Events : 0.6  Number   Major   Minor   RaidDevice State  3       8       35        0      spare rebuilding   /dev/sdc3  1       8       67        1      active sync   /dev/sde3  2       8       83        2      active sync   /dev/sdf3  4       8       51        -      faulty spare   /dev/sdd3  将这些设备加入/etc/fstab启动项:  /dev/md0        /raid0disk      auto    defaults        0       0  /dev/md1        /raid1disk      auto    defaults        0       0  /dev/md5        /raid5disk      auto    defaults        0       0

小编推荐:欲学习电脑技术、系统维护、网络管理、编程开发和安全攻防等高端IT技术,请 点击这里 注册黑基账号,公开课频道价值万元IT培训教程免费学,让您少走弯路、事半功倍,好工作升职加薪!



免责声明:本文由投稿者转载自互联网,版权归原作者所有,文中所述不代表本站观点,若有侵权或转载等不当之处请联系我们处理,让我们一起为维护良好的互联网秩序而努力!联系方式见网站首页右下角。


鲜花

握手

雷人

路过

鸡蛋

相关阅读

最新评论

最新

返回顶部