AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1050375
Accepted
Majid
Majid
Asked: 2021-01-19 23:17:00 +0800 CST2021-01-19 23:17:00 +0800 CST 2021-01-19 23:17:00 +0800 CST

如何在 CentOS 7 中扩展 SAN 存储

  • 772

我有一台 CentOS 7 的服务器,使用 LUN 来存储数据。最近Storage团队扩展了LUN空间。这是多路径 -ll 的输出

~ # multipath -ll                                                                                    
   mpathc (3600601606cb04000a0eb35b80750eb11) dm-5 DGC     ,VRAID           
   **size=27T** features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 alua' wp=rw
   |-+- policy='service-time 0' prio=50 status=active
   | |- 1:0:0:2 sdl 8:176 active ready running
   | `- 4:0:0:2 sdn 8:208 active ready running
   `-+- policy='service-time 0' prio=10 status=enabled
     |- 1:0:1:2 sdm 8:192 active ready running
     `- 4:0:2:2 sdo 8:224 active ready running

之前的大小为 20TB,现在已扩展到 27TB。

这是 fdisk 命令的输出

fdisk -l /dev/mapper/mpathc
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/mapper/mpathc: 29686.8 GB, 29686813949952 bytes, 57982058496 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
Disk label type: gpt
Disk identifier: 843A6F7E-581A-455E-822F-2CE4306394BF

#         Start          End    Size  Type            Name
1         8192  42949672926     20T  Linux filesyste 

您可以看到 LUN 的大小和扇区都增加了。这是 kpartx 命令的输出

kpartx -l /dev/mapper/mpathc
GPT:Primary header thinks Alt. header is not at the end of the disk.
GPT:Alternate GPT header not at the end of the disk.
GPT: Use GNU Parted to correct GPT errors.
mpathc1 : 0 42949664735 /dev/mapper/mpathc 8192

这是 df 命令的输出

df -h /dev/mapper/mpathc1
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/mpathc1   20T   17T  4.0T  81% /Splunk-Storage/COLD

所以我不知道如何在不丢失数据的情况下扩展 /dev/mapper/mpathc1 的空间。我非常感谢任何建议提前谢谢

hard-drive linux extend
  • 2 2 个回答
  • 1210 Views

2 个回答

  • Voted
  1. Best Answer
    berndbausch
    2021-01-20T01:23:55+08:002021-01-20T01:23:55+08:00

    第 1 步:尝试重新扫描存储设备以告知内核大小已更改。我不确定是否必须对多路径的所有四个组件都执行此操作,但它不应该受到伤害。您可以通过将任何内容写入rescan文件来重新扫描存储设备:

    echo > /sys/class/block/sdl/device/rescan
    echo > /sys/class/block/sdm/device/rescan
    echo > /sys/class/block/sdn/device/rescan
    echo > /sys/class/block/sdo/device/rescan
    

    扫描 HBA 也应该有效。SCSI HBA 有一个scan文件;您将三个十进制数字控制器、目标和 LUN 写入其中以扫描该 LUN。或者使用通配符“-”代替数字。下面扫描两个 HBA 上控制器 0 上的所有设备:

    echo "0 - -" > /sys/class/scsi_host/host1/scan
    echo "0 - -" > /sys/class/scsi_host/host4/scan
    

    第2步:此时,内核知道/dev/mapper/mpathc是27TB。您现在必须增加分区 1 的大小。该parted命令可用于调整分区大小,但我相信 Centos 7 版本parted没有该功能。因此,我将卸载文件系统,删除分区(我知道这很可怕),然后再次创建分区,这次使用正确的大小。检查其参数是否正确。

    umount /dev/mapper/mpathc1
    parted /dev/mapper/mpathc1 rm 1 mkpart primary 0% 100% print
    

    您可能希望首先在不包含有价值数据的磁盘上进行测试。

    我不知道是否可以安装parted具有该resizepart命令的版本。这将使第二步更容易。

    RHEL 7 存储手册包含与 类似的过程,fdisk但它采用 LVM,并且没有多路径。完成该fdisk过程后,您可能必须使用kpartx通知内核有关磁盘上的更改。因此,分开的方法似乎更容易,因此对我来说更安全。

    第三步:增加文件系统。首先,重新安装它。如果是 XFS,则必须挂载它,然后运行xfs_growfs​​.

    mount /dev/mapper/mpathc1 /Splunk-Storage/COLD
    xfs_growfs /Splunk-Storage/COLD
    

    如果是 ext[234],运行resize2fs. 它可以安装或卸载。

    resize2fs /dev/mapper/mpathc1
    mount /dev/mapper/mpathc1 /Splunk-Storage/COLD
    

    你完成了。

    • 2
  2. Majid
    2021-01-20T05:23:47+08:002021-01-20T05:23:47+08:00

    感谢您的时间。
    在第 2 步中,我使用resizepart了但我得到了这个:
    Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? Fix/Ignore/Cancel?
    我应该修复它吗?

    这是完整的输出

    ~ # parted /dev/mapper/mpathc                                                                                                   
     GNU Parted 3.1
     Using /dev/mapper/mpathc
     Welcome to GNU Parted! Type 'help' to view a list of commands.
     (parted) p                                                                
     Error: The backup GPT table is not at the end of the disk, as it should  be.  This might mean that another operating system believes the
     disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?
     Fix/Ignore/Cancel? I                                                      
     Warning: Not all of the space available to /dev/mapper/mpathc appears to be used, you can fix the GPT to use all of the space (an extra
     15032385536 blocks) or continue with the current setting? 
     Fix/Ignore? I                                                             
     Model: Linux device-mapper (multipath) (dm)
     Disk /dev/mapper/mpathc: 29.7TB
     Sector size (logical/physical): 512B/512B
     Partition Table: gpt
     Disk Flags: 
    
     Number  Start   End     Size    File system  Name  Flags
     1      4194kB  22.0TB  22.0TB  xfs
    
    (parted) resizepart                                                       
    Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the
    disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)?
    Fix/Ignore/Cancel? C
    
    • 0

相关问题

  • 你最喜欢的 Linux 发行版是什么?[关闭]

  • 更改 PHP 的默认配置设置?

  • 保护新的 Ubuntu 服务器 [关闭]

  • 为什么添加新驱动器后我的磁盘驱动器访问速度如此之慢?

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve