zoukankan      html  css  js  c++  java
  • RAID5 制作 (一个硬盘制作)

    [root@localhost ~]# fdisk -l |grep "/dev/"
    磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
    磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
    磁盘 /dev/sdd:32.2 GB, 32212254720 字节,62914560 个扇区
    磁盘 /dev/sde:32.2 GB, 32212254720 字节,62914560 个扇区
    磁盘 /dev/sdf:21.5 GB, 21474836480 字节,41943040 个扇区
    磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
    /dev/sda1   *        2048     2099199     1048576   83  Linux
    /dev/sda2         2099200    83886079    40893440   8e  Linux LVM
    磁盘 /dev/mapper/centos-root:39.7 GB, 39720058880 字节,77578240 个扇区
    磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区

    [root@localhost ~]# fdisk /dev/sdb
    欢迎使用 fdisk (util-linux 2.23.2)。
    更改将停留在内存中,直到您决定将更改写入磁盘。
    使用写入命令前请三思。
    Device does not contain a recognized partition table
    使用磁盘标识符 0x21f48a87 创建新的 DOS 磁盘标签。
    命令(输入 m 获取帮助):m
    命令操作
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       g   create a new empty GPT partition table
       G   create an IRIX (SGI) partition table
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)
    命令(输入 m 获取帮助):n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    分区号 (1-4,默认 1):1
    起始 扇区 (2048-41943039,默认为 2048):
    将使用默认值 2048
    Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):+4G
    分区 1 已设置为 Linux 类型,大小设为 4 GiB
    命令(输入 m 获取帮助):n 
    Partition type:
       p   primary (1 primary, 0 extended, 3 free)
       e   extended
    Select (default p): p
    分区号 (2-4,默认 2):
    起始 扇区 (8390656-41943039,默认为 8390656):
    将使用默认值 8390656
    Last 扇区, +扇区 or +size{K,M,G} (8390656-41943039,默认为 41943039):+4G
    分区 2 已设置为 Linux 类型,大小设为 4 GiB
    命令(输入 m 获取帮助):n 
    Partition type:
       p   primary (2 primary, 0 extended, 2 free)
       e   extended
    Select (default p): p
    分区号 (3,4,默认 3):
    起始 扇区 (16779264-41943039,默认为 16779264):+4G
    值超出范围。
    起始 扇区 (16779264-41943039,默认为 16779264):
    将使用默认值 16779264
    Last 扇区, +扇区 or +size{K,M,G} (16779264-41943039,默认为 41943039):+4G
    分区 3 已设置为 Linux 类型,大小设为 4 GiB
    命令(输入 m 获取帮助):n
    Partition type:
       p   primary (3 primary, 0 extended, 1 free)
       e   extended
    Select (default e): p
    已选择分区 4
    起始 扇区 (25167872-41943039,默认为 25167872):
    将使用默认值 25167872
    Last 扇区, +扇区 or +size{K,M,G} (25167872-41943039,默认为 41943039):
    将使用默认值 41943039
    分区 4 已设置为 Linux 类型,大小设为 8 GiB
    命令(输入 m 获取帮助):t
    分区号 (1-4,默认 4):1
    Hex 代码(输入 L 列出所有代码):fd
    已将分区“Linux”的类型更改为“Linux raid autodetect”
    命令(输入 m 获取帮助):t
    分区号 (1-4,默认 4):2
    Hex 代码(输入 L 列出所有代码):fd
    已将分区“Linux”的类型更改为“Linux raid autodetect”
    命令(输入 m 获取帮助):t
    分区号 (1-4,默认 4):3
    Hex 代码(输入 L 列出所有代码):fd
    已将分区“Linux”的类型更改为“Linux raid autodetect”
    命令(输入 m 获取帮助):4
    4: unknown command
    命令操作
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       g   create a new empty GPT partition table
       G   create an IRIX (SGI) partition table
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)
    命令(输入 m 获取帮助):n
    If you want to create more than four partitions, you must replace a
    primary partition with an extended partition first.
    命令(输入 m 获取帮助):t
    分区号 (1-4,默认 4):4
    Hex 代码(输入 L 列出所有代码):fd
    已将分区“Linux”的类型更改为“Linux raid autodetect”
    命令(输入 m 获取帮助):p
    磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:dos
    磁盘标识符:0x21f48a87
       设备 Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048     8390655     4194304   fd  Linux raid autodetect
    /dev/sdb2         8390656    16779263     4194304   fd  Linux raid autodetect
    /dev/sdb3        16779264    25167871     4194304   fd  Linux raid autodetect
    /dev/sdb4        25167872    41943039     8387584   fd  Linux raid autodetect

    命令(输入 m 获取帮助):w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    正在同步磁盘。
    [root@localhost ~]# fdisk -l |grep "raid"
    /dev/sdb1            2048     8390655     4194304   fd  Linux raid autodetect
    /dev/sdb2         8390656    16779263     4194304   fd  Linux raid autodetect
    /dev/sdb3        16779264    25167871     4194304   fd  Linux raid autodetect
    /dev/sdb4        25167872    41943039     8387584   fd  Linux raid autodetect
    [root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 -x1 /dev/sdb[1234]
    mdadm: layout defaults to left-symmetric
    mdadm: layout defaults to left-symmetric
    mdadm: chunk size defaults to 512K
    mdadm: size set to 4190208K
    mdadm: largest drive (/dev/sdb4) exceeds size (4190208K) by more than 1%
    Continue creating array? y
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md5 started.
    [root@localhost ~]# mkfs.ext4 /dev/md5
    mke2fs 1.42.9 (28-Dec-2013)
    文件系统标签=
    OS type: Linux
    块大小=4096 (log=2)
    分块大小=4096 (log=2)
    Stride=128 blocks, Stripe width=256 blocks
    524288 inodes, 2095104 blocks
    104755 blocks (5.00%) reserved for the super user
    第一个数据块=0
    Maximum filesystem blocks=2145386496
    64 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
    Allocating group tables: 完成                           
    正在写入inode表: 完成                           
    Creating journal (32768 blocks): 完成
    Writing superblocks and filesystem accounting information: 完成
    [root@localhost ~]# mkdir /raid5
    [root@localhost ~]# mount /dev/md5 /raid5
    [root@localhost ~]# df -Th
    文件系统                类型      容量  已用  可用 已用% 挂载点
    /dev/mapper/centos-root xfs        37G  3.4G   34G   10% /
    devtmpfs                devtmpfs  897M     0  897M    0% /dev
    tmpfs                   tmpfs     912M     0  912M    0% /dev/shm
    tmpfs                   tmpfs     912M  9.0M  903M    1% /run
    tmpfs                   tmpfs     912M     0  912M    0% /sys/fs/cgroup
    /dev/sda1               xfs      1014M  179M  836M   18% /boot
    tmpfs                   tmpfs     183M   12K  183M    1% /run/user/42
    tmpfs                   tmpfs     183M     0  183M    0% /run/user/0
    /dev/md5                ext4      7.8G   36M  7.3G    1% /raid5
    [root@localhost ~]# vi /etc/fstab
    /dev/md5 /raid5                                 ext4    defaults        0 0
    [root@localhost ~]# mdadm -D -s > /etc/mdadm.conf
    [root@localhost ~]# vi /etc/mdadm.conf
    auto=yes
     
    卸载
    [root@localhost ~]# umount /dev/md5
    [root@localhost ~]# mdadm -S /dev/md5
    mdadm: stopped /dev/md5
    [root@localhost ~]# vim /etc/fstab
    [root@localhost ~]# rm -f /etc/mdadm.conf
  • 相关阅读:
    新的开始
    react的setState使用中遇到的问题
    h5的input的required使用中遇到的问题
    vue学习中v-if和v-show一起使用的问题
    异步 JavaScript 之 macrotask、microtask
    .eslintrc 文件
    Vue2学习结合bootstrapTable遇到的问题
    Vue2学习(3)
    ES6 箭头函数
    Vue2学习(2)
  • 原文地址:https://www.cnblogs.com/elin989898/p/11301038.html
Copyright © 2011-2022 走看看