• linux 6中4T磁盘识别并分区格式化挂接


    存储端划分4T的LUN后,主机端操作如下

    1、主机识别,本例中hba卡的端口是host11和host12

     [root@db1 ~]#  echo "- - -" > /sys/class/scsi_host/host11/scan
     [root@db1 ~]#  echo "- - -" > /sys/class/scsi_host/host12/scan

    2、fdisk查看

    [root@db1 ~]# fdisk -l |grep '4398.0 GB'

    WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

    Disk /dev/sdae: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdai: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdm: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdq: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdaw: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdba: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdbo: 4398.0 GB, 4398046511104 bytes
    Disk /dev/sdbs: 4398.0 GB, 4398046511104 bytes
    Disk /dev/mapper/mpathq: 4398.0 GB, 4398046511104 bytes

    3、编辑/etc/multipath.conf文件,添加如下内容

    multipath {
            wwid 3201b09ca6700ba90
            alias newbackup
            }

    4、因数据库系统运行中,直接reload多路径软件

    [root@db1 ~]# service multipathd reload
    [root@db1 ~]# multipath -ll
    newbackup (3201b09ca6700ba90) dm-15 TOYOU,Disk-Array
    size=4.0T features='1 queue_if_no_path' hwhandler='0' wp=rw
    |-+- policy='round-robin 0' prio=50 status=active
    | |- 15:0:0:21 sdm  8:192  active ready running
    | |- 16:0:0:21 sdaw 67:0   active ready running
    | |- 15:0:0:25 sdq  65:0   active ready running
    | `- 16:0:0:25 sdba 67:64  active ready running
    `-+- policy='round-robin 0' prio=10 status=enabled
      |- 15:0:1:21 sdae 65:224 active ready running
      |- 16:0:1:21 sdbo 68:32  active ready running
      |- 15:0:1:25 sdai 66:32  active ready running
      `- 16:0:1:25 sdbs 68:96  active ready running

    5、使用parted分区格式化等

    [root@db1 ~]#    fdisk -l /dev/mapper/newbackup

    Disk /dev/mapper/newbackup: 4398.0 GB, 4398046511104 bytes
    255 heads, 63 sectors/track, 534698 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    [root@db1 ~]#  echo "Yes"|parted /dev/mapper/newbackup mklabel gpt
    Information: You may need to update /etc/fstab.                           

    [root@db1 ~]#   echo "Ignore"|parted /dev/mapper/newbackup mkpart backup 0%  100%
    Information: You may need to update /etc/fstab.                           

    [root@db1 ~]#  mkfs.ext4 /dev/mapper/newbackupp1
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    268435456 inodes, 1073741312 blocks
    53687065 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    32768 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, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848, 512000000, 550731776, 644972544

    Writing inode tables: done                            
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information:

    [root@db1 ~]#   blkid
    ..............
    ..............
    /dev/mapper/newbackupp1: UUID="86a73166-1db0-424b-9brf-ff366575202d" TYPE="ext4"  
     
    6、在/etc/fstab文件中增加如下一行。  
    UUID=86a73166-1db0-424b-9brf-ff366575202d      /backup                   ext4    defaults        0 0

    [root@db1 ~]#    mount -a
    [root@db1 ~]#   df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/os_root
                           99G   13G   82G  14% /
    tmpfs                 126G  811M  126G   1% /dev/shm
    /dev/sda2             477M   40M  412M   9% /boot
    /dev/sda1             200M  264K  200M   1% /boot/efi
    /dev/mapper/os-u01
                          352G   52G  320G  14% /u01
    /dev/mapper/newbackupp1
                          4.0T  746G  3.1T  20% /backup

     
     

  • 相关阅读:
    SpringBoot 多模块 多环境 项目 单元测试
    移动通信网络规划:室内覆盖系统概述
    比亚迪的利润飙升超过200%,汽车销量创纪录,有你的一份力吗?
    Mybatis—动态sql和分页
    【场景化解决方案】旺店通与钉钉打通,实现多包裹数据同步
    Java异常、继承结构、处理异常、自定义异常、SpringBoot中全局捕获处理异常
    Navicat连接mysql8.0:提示无法加载身份验证插件“caching_sha2_password”
    React中的页面跳转方式详解
    没掌握这些知识点也敢说自己熟悉AIDL?
    QT C++ sqlite 对多个数据库的操作
  • 原文地址:https://blog.csdn.net/kevinyu998/article/details/132839420