zoukankan      html  css  js  c++  java
  • RAID10 (硬盘制作)

    [root@localhost ~]# fdisk /dev/sdc
    欢迎使用 fdisk (util-linux 2.23.2)。
    更改将停留在内存中,直到您决定将更改写入磁盘。
    使用写入命令前请三思。
    Device does not contain a recognized partition table
    使用磁盘标识符 0x2831c455 创建新的 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):
    起始 扇区 (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):+4G
    分区 4 已设置为 Linux 类型,大小设为 4 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 获取帮助):t
    分区号 (1-4,默认 4):4
    Hex 代码(输入 L 列出所有代码):fd
    已将分区“Linux”的类型更改为“Linux raid autodetect”
    命令(输入 m 获取帮助):p
    磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:dos
    磁盘标识符:0x2831c455
       设备 Boot      Start         End      Blocks   Id  System
    /dev/sdc1            2048     8390655     4194304   fd  Linux raid autodetect
    /dev/sdc2         8390656    16779263     4194304   fd  Linux raid autodetect
    /dev/sdc3        16779264    25167871     4194304   fd  Linux raid autodetect
    /dev/sdc4        25167872    33556479     4194304   fd  Linux raid autodetect
    命令(输入 m 获取帮助):w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    正在同步磁盘。
    [root@localhost ~]# fdisk -l |grep "/dev/sdc"
    磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
    /dev/sdc1            2048     8390655     4194304   fd  Linux raid autodetect
    /dev/sdc2         8390656    16779263     4194304   fd  Linux raid autodetect
    /dev/sdc3        16779264    25167871     4194304   fd  Linux raid autodetect
    /dev/sdc4        25167872    33556479     4194304   fd  Linux raid autodetect
    [root@localhost ~]# mdadm -Cv /dev/md11 -l1 -n2 /dev/sdc[12]
    mdadm: Note: this array has metadata at the start and
        may not be suitable as a boot device.  If you plan to
        store '/boot' on this device please ensure that
        your boot-loader understands md/v1.x metadata, or use
        --metadata=0.90
    mdadm: size set to 4190208K
    Continue creating array? y
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md11 started.
    [root@localhost ~]# mdadm -Cv /dev/md12 -l1 -n2 /dev/sdc[34]
    mdadm: Note: this array has metadata at the start and
        may not be suitable as a boot device.  If you plan to
        store '/boot' on this device please ensure that
        your boot-loader understands md/v1.x metadata, or use
        --metadata=0.90
    mdadm: size set to 4190208K
    Continue creating array? y
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md12 started.
    [root@localhost ~]# fdisk -l |grep "/dev/sdc"
    磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
    /dev/sdc1            2048     8390655     4194304   fd  Linux raid autodetect
    /dev/sdc2         8390656    16779263     4194304   fd  Linux raid autodetect
    /dev/sdc3        16779264    25167871     4194304   fd  Linux raid autodetect
    /dev/sdc4        25167872    33556479     4194304   fd  Linux raid autodetect
    [root@localhost ~]# ls -a /dev/md*
    /dev/md11  /dev/md12  /dev/md5
    /dev/md:
    .  ..  5
    [root@localhost ~]# mdadm -Cv /dev/md0 -l0 -n2 /dev/md
    md/   md11  md12  md5  
    [root@localhost ~]# mdadm -Cv /dev/md0 -l0 -n2 /dev/md1[12]
    mdadm: chunk size defaults to 512K
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md0 started.
    [root@localhost ~]# mkfs.ext4 /dev/md0
    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, 2094080 blocks
    104704 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 /raid10
    [root@localhost ~]# mount /dev/md0 /raid10/
    [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/md0                ext4      7.8G   36M  7.3G    1% /raid10
    [root@localhost ~]# vi /etc/fstab                 //添加以下内容
    /dev/md0 /raid10                                ext4    defaults        0 0
    [root@localhost ~]# mdadm -D -s > /etc/mdadm.conf
    [root@localhost ~]# vi /etc/mdadm.conf
    DEVICE /dev/sdc[12]
    ARRAY /dev/md11 metadata=1.2 name=localhost.localdomain:11 UUID=23e7fc83:ab4b7dad:554b3fef:9067bc8e
    auto=yes
    DEVICE /dev/sdc[34]
    ARRAY /dev/md12 metadata=1.2 name=localhost.localdomain:12 UUID=c0e8dfd9:6595de96:5beaa862:5ac26712
    auto=yes
    DEVICE /dev/md1[12]
    ARRAY /dev/md0 metadata=1.2 name=localhost.localdomain:0 UUID=cc40b38f:dc030053:25797e70:e08da380 au
    to=yes     
    ~      
    卸载
    [root@localhost ~]# umount /dev/md0
    [root@localhost ~]# mdadm -S /dev/md0
    mdadm: stopped /dev/md0
    [root@localhost ~]# vim /etc/fstab
    [root@localhost ~]# rm -rf /etc/mdadm.conf
  • 相关阅读:
    萌新向Python数据分析及数据挖掘 第三章 机器学习常用算法 第三节 梯度下降法 (上)理解篇
    萌新向Python数据分析及数据挖掘 第三章 机器学习常用算法 第二节 线性回归算法 (下)实操篇
    萌新向Python数据分析及数据挖掘 第三章 机器学习常用算法 第二节 线性回归算法 (上)理解篇
    萌新向Python数据分析及数据挖掘 第三章 机器学习常用算法 第一节 KNN算法 (下)实操篇
    萌新向Python数据分析及数据挖掘 第三章 机器学习常用算法 第一节 KNN算法 (上)理解篇
    萌新向Python数据分析及数据挖掘 第二章 pandas 第五节 Getting Started with pandas
    Oracle数据库安装和授权
    c# 如何获取JSON文件以及如何获取Config文件(framework 和 net .Core)
    C#Core查询数据库存储EXCEL文件
    如何在WINDOW系统下编译P12证书制作
  • 原文地址:https://www.cnblogs.com/elin989898/p/11301218.html
Copyright © 2011-2022 走看看