博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux硬盘扩容
阅读量:4298 次
发布时间:2019-05-27

本文共 50272 字,大约阅读时间需要 167 分钟。

目录

Linux硬盘扩容

一.软件版本

  • 硬盘

硬盘大小:4T

硬盘接口:SCSI

  • 其它:

Linux发行版:CentOS-7-x86_64-DVD-1804.iso

二.扩容准备

1.分区规则

  • 1至4个主分区 或者 1至3个主分区和1个扩展分区(扩展分区中可再分区为逻辑分区)

2.分区工具

  • fdisk:单个分区最大只能创建2T的空间
  • parted:单个分区可超过2T的空间

3.分区类型

分区类型 空间分配 扩容命令
ext2、ext3、ext4 可扩容、可缩容 resize2fs
xfs(centos7默认) 仅扩容 xfs_growfs

4.硬盘设备名规则

  • SCSI接口:/dev/sd [a-z] ;设备名后追加的数字,表示此设备的第几个分区,例如:/dev/sda1、/dev/sda2
  • IDE接口:/dev/hd [a-z]

5.分区说明

  • /dev/mapper/centos-root:根分区(根文件系统)
  • /dev/mapper/contos-home:用户分区
  • /dev/mapper/centos-swap:交换分区

三.parted工具扩容

1.分区

#--查看硬盘使用情况# df -Th#--查看设备列表# fdisk -l#--使用parted工具# parted /dev/sdd#--打印硬盘和分区信息# (parted) p#--其中打印信息中:Disk /dev/sdd: 4001GB 表示可分区空间#-- GPT分区表# (parted) mklabel gpt# Yes/No y#--这里只做一个分区# (parted) mkpart#--分区名可自定义# Partition name?  []? sd2#--分区类型# File system type?  [ext2]? ext4#--分区开始大小# Start? 0#--分区结束大小(这些复制上面打印的可分区空间)# End? 4001GB# Ignore/Cancel? Ignore#--打印硬盘和分区信息# (parted) p#--退出# quit
  • 格式化分区
#--查看设备列表# fdisk -l#-- mkfs.[分区类型] [设备分区名]# mkfs.ext4 /dev/sdd1

2.LVM

#--进入LVM# lvm#--创建PV# lvm> pvcreate /dev/sdd1[y/n]: y#--查看现有的VG信息;其中打印信息 Free PE / Size 表示可用空间# lvm> vgdisplay#--创建VG;centos是现有的vg name;/dev/sdd1是上面创建的pv# lvm> vgextend centos /dev/sdd1#--查看现有的LV# lvm> lvdisplay#--LV设置扩容信息(分配的容量可查看vgdisplay的Free PE/Size)(库容的分区可查看lvdisplay)# lvm> lvextend -L +3720G /dev/centos/home#--退出# quit

3.扩容

#--查看硬盘使用情况, /dev/mapper/centos-home xfs# df -Th#--使用xfs命令扩容(/dev/mapper/centos-home 或 /dev/centos/home)# xfs_growfs /dev/centos/home#--重新查看硬盘使用情况# df -Th

案例一

Last login: Wed Feb 20 09:19:29 2019 from 192.168.xxx.xxxABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1550624655[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdb: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdb1   *           1      630783      315391+   6  FAT16Disk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: 8C8D5A9C-437F-42D4-A4BD-E09E1B734C08#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sda1Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  System/dev/sdd1            2048  4294967294  2147482623+  8e  Linux LVM[root@localhost ~]# fdisk /dev/sddWARNING: The size of this disk is 4.0 TB (4000787030016 bytes).DOS partition table format can not be used on drives for volumeslarger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID partition table format (GPT).Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): mCommand action   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)Command (m for help): dSelected partition 1Partition 1 is deletedCommand (m for help): pDisk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  SystemCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdb: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdb1   *           1      630783      315391+   6  FAT16Disk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: 8C8D5A9C-437F-42D4-A4BD-E09E1B734C08#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sda1Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  System[root@localhost ~]# lvmlvm> pvdisplay  --- Physical volume ---  PV Name               /dev/sda3  VG Name               centos  PV Size               445.42 GiB / not usable 0     Allocatable           yes   PE Size               4.00 MiB  Total PE              114028  Free PE               1  Allocated PE          114027  PV UUID               BnuZik-R5j2-2iCr-9nQ4-lQH1-c4UA-RI7JqP   lvm> exit  Exiting.[root@localhost ~]# parted /dev/sdcGNU Parted 3.1Using /dev/sdcWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) help                                                               align-check TYPE N                        check partition N for TYPE(min|opt) alignment  help [COMMAND]                           print general help, or help on COMMAND  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)  mkpart PART-TYPE [FS-TYPE] START END     make a partition  name NUMBER NAME                         name partition NUMBER as NAME  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found        partitions, or a particular partition  quit                                     exit program  rescue START END                         rescue a lost partition near START and END    resizepart NUMBER END                    resize partition NUMBER  rm NUMBER                                delete partition NUMBER  select DEVICE                            choose the device to edit  disk_set FLAG STATE                      change the FLAG on selected device  disk_toggle [FLAG]                       toggle the state of FLAG on selected device  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER  unit UNIT                                set the default unit to UNIT  version                                  display the version number and copyright information of GNU Parted(parted) p                                                                Model: TOSHIBA MG04SCA40ENY (scsi)Disk /dev/sdc: 4001GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number  Start   End     Size    File system  Name  Flags 1      17.4kB  4001GB  4001GB  ext4         sda1(parted) rm 1                                                             (parted) p                                                                Model: TOSHIBA MG04SCA40ENY (scsi)Disk /dev/sdc: 4001GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number  Start  End  Size  File system  Name  Flags(parted) mklabel gptWarning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you wantto continue?Yes/No? y                                                                 (parted) mkpart                                                           Partition name?  []? sd1File system type?  [ext2]? ext4                                           Start? 0                                                                  End? 4001GB                                                               Warning: The resulting partition is not properly aligned for best performance.Ignore/Cancel? Ignore                                                     (parted) p                                                                Model: TOSHIBA MG04SCA40ENY (scsi)Disk /dev/sdc: 4001GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number  Start   End     Size    File system  Name  Flags 1      17.4kB  4001GB  4001GB  ext4         sd1(parted) gpt                                                                align-check TYPE N                        check partition N for TYPE(min|opt) alignment  help [COMMAND]                           print general help, or help on COMMAND  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)  mkpart PART-TYPE [FS-TYPE] START END     make a partition  name NUMBER NAME                         name partition NUMBER as NAME  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found        partitions, or a particular partition  quit                                     exit program  rescue START END                         rescue a lost partition near START and END    resizepart NUMBER END                    resize partition NUMBER  rm NUMBER                                delete partition NUMBER  select DEVICE                            choose the device to edit  disk_set FLAG STATE                      change the FLAG on selected device  disk_toggle [FLAG]                       toggle the state of FLAG on selected device  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER  unit UNIT                                set the default unit to UNIT  version                                  display the version number and copyright information of GNU Parted(parted) quit                                                             Information: You may need to update /etc/fstab.[root@localhost ~]# fdisk -l                                              WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdb: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdb1   *           1      630783      315391+   6  FAT16Disk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: E2DCC553-3A14-479F-9496-39D0C99CB2DD#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd1Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  System[root@localhost ~]# mkfs.ext4 /dev/sd1mke2fs 1.42.9 (28-Dec-2013)Could not stat /dev/sd1 --- No such file or directoryThe device apparently does not exist; did you specify it correctly?[root@localhost ~]# mkfs.ext4 /dev/sdc1mke2fs 1.42.9 (28-Dec-2013)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks244195328 inodes, 976754637 blocks48837731 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=312475648029809 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,         4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,         102400000, 214990848, 512000000, 550731776, 644972544Allocating group tables: done                            Writing inode tables: done                            Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done       [root@localhost ~]# fisdk -lbash: fisdk: command not found...[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdb: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdb1   *           1      630783      315391+   6  FAT16Disk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: E2DCC553-3A14-479F-9496-39D0C99CB2DD#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd1Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  System[root@localhost ~]# lvmlvm> pvcreate /dev/sdc1WARNING: ext4 signature detected on /dev/sdc1 at offset 1080. Wipe it? [y/n]: y  Wiping ext4 signature on /dev/sdc1.  Physical volume "/dev/sdc1" successfully created.lvm> quit  Exiting.[root@localhost ~]# ef -hbash: ef: command not found...[root@localhost ~]# df -hFilesystem               Size  Used Avail Use% Mounted on/dev/mapper/centos-root   50G  5.8G   45G  12% /devtmpfs                 7.5G     0  7.5G   0% /devtmpfs                    7.5G     0  7.5G   0% /dev/shmtmpfs                    7.5G   12M  7.5G   1% /runtmpfs                    7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sda2               1014M  162M  853M  16% /boot/dev/sda1                200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home  388G   37M  388G   1% /home/dev/sdb1                308M     0  308M   0% /run/media/abc/OEMDRVtmpfs                    1.5G  4.0K  1.5G   1% /run/user/42tmpfs                    1.5G   64K  1.5G   1% /run/user/0[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdb: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdb1   *           1      630783      315391+   6  FAT16Disk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: E2DCC553-3A14-479F-9496-39D0C99CB2DD#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd1Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  System[root@localhost ~]# lvmlvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        1  Metadata Sequence No  4  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                1  Act PV                1  VG Size               445.42 GiB  PE Size               4.00 MiB  Total PE              114028  Alloc PE / Size       114027 / <445.42 GiB  Free  PE / Size       1 / 4.00 MiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> vgextend centos /dev/sdc1  Volume group "centos" successfully extendedlvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        2  Metadata Sequence No  5  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                2  Act PV                2  VG Size               4.07 TiB  PE Size               4.00 MiB  Total PE              1067889  Alloc PE / Size       114027 / <445.42 GiB  Free  PE / Size       953862 / <3.64 TiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> lvextend -L +100%FREE /dev/mapper/centos-root  Can't parse size argument.  Invalid argument for --size: +100%FREE  Error during parsing of command line.lvm> lvextend -L +3639G /dev/mapper/centos-root  Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 3.60 TiB (944384 extents).  Logical volume centos/root successfully resized.lvm> pvdisplay  --- Physical volume ---  PV Name               /dev/sda3  VG Name               centos  PV Size               445.42 GiB / not usable 0     Allocatable           yes (but full)  PE Size               4.00 MiB  Total PE              114028  Free PE               0  Allocated PE          114028  PV UUID               BnuZik-R5j2-2iCr-9nQ4-lQH1-c4UA-RI7JqP     --- Physical volume ---  PV Name               /dev/sdc1  VG Name               centos  PV Size               <3.64 TiB / not usable 3.80 MiB  Allocatable           yes   PE Size               4.00 MiB  Total PE              953861  Free PE               22278  Allocated PE          931583  PV UUID               sgv4wR-EDls-XzS9-Owey-koQP-kXH8-Uo6G7K   lvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        2  Metadata Sequence No  6  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                2  Act PV                2  VG Size               4.07 TiB  PE Size               4.00 MiB  Total PE              1067889  Alloc PE / Size       1045611 / <3.99 TiB  Free  PE / Size       22278 / 87.02 GiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> quit  Exiting.[root@localhost ~]# xfs_growfs /dev/mapper/centos-rootmeta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=3276800 blks         =                       sectsz=4096  attr=2, projid32bit=1         =                       crc=1        finobt=0 spinodes=0data     =                       bsize=4096   blocks=13107200, imaxpct=25         =                       sunit=0      swidth=0 blksnaming   =version 2              bsize=4096   ascii-ci=0 ftype=1log      =internal               bsize=4096   blocks=6400, version=2         =                       sectsz=4096  sunit=1 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0data blocks changed from 13107200 to 967049216[root@localhost ~]# df -hFilesystem               Size  Used Avail Use% Mounted on/dev/mapper/centos-root  3.7T  5.8G  3.6T   1% /devtmpfs                 7.5G     0  7.5G   0% /devtmpfs                    7.5G     0  7.5G   0% /dev/shmtmpfs                    7.5G   12M  7.5G   1% /runtmpfs                    7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sda2               1014M  162M  853M  16% /boot/dev/sda1                200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home  388G   37M  388G   1% /home/dev/sdb1                308M     0  308M   0% /run/media/abc/OEMDRVtmpfs                    1.5G  4.0K  1.5G   1% /run/user/42tmpfs                    1.5G   64K  1.5G   1% /run/user/0

案例二

[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdb: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: E2DCC553-3A14-479F-9496-39D0C99CB2DD#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd1Disk /dev/mapper/centos-root: 3961.0 GB, 3961033588736 bytes, 7736393728 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdc: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdc1   *           1      630783      315391+   6  FAT16Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x83c173dc   Device Boot      Start         End      Blocks   Id  System[root@localhost ~]# parted /dev/sddGNU Parted 3.1Using /dev/sddWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) p                                                                Model: SEAGATE ST4000NM0025 (scsi)Disk /dev/sdd: 4001GBSector size (logical/physical): 512B/512BPartition Table: msdosDisk Flags: Number  Start  End  Size  Type  File system  Flags(parted) mklabel gpt                                                      Warning: The existing disk label on /dev/sdd will be destroyed and all data on this disk will be lost. Do you wantto continue?Yes/No? y                                                                 (parted) mkpart                                                           Partition name?  []? sd2                                                  File system type?  [ext2]? ext4                                           Start? 0                                                                  End? 4001GB                                                               Warning: The resulting partition is not properly aligned for best performance.Ignore/Cancel? Ignore(parted) p                                                                Model: SEAGATE ST4000NM0025 (scsi)Disk /dev/sdd: 4001GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number  Start   End     Size    File system  Name  Flags 1      17.4kB  4001GB  4001GB               sd2(parted) quitInformation: You may need to update /etc/fstab.[root@localhost ~]# mkfs.ext4 /dev/sd2mke2fs 1.42.9 (28-Dec-2013)Could not stat /dev/sd2 --- No such file or directoryThe device apparently does not exist; did you specify it correctly?[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdb: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: E2DCC553-3A14-479F-9496-39D0C99CB2DD#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd1Disk /dev/mapper/centos-root: 3961.0 GB, 3961033588736 bytes, 7736393728 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-home: 416.5 GB, 416456638464 bytes, 813391872 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/sdc: 322 MB, 322961408 bytes, 630784 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x444d454f   Device Boot      Start         End      Blocks   Id  System/dev/sdc1   *           1      630783      315391+   6  FAT16WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: 87D03097-5A19-48F7-A23B-78314D0F2BB6#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd2[root@localhost ~]# mkfs.ext4 /dev/sdd1mke2fs 1.42.9 (28-Dec-2013)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks244195328 inodes, 976754637 blocks48837731 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=312475648029809 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,         4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,         102400000, 214990848, 512000000, 550731776, 644972544Allocating group tables: done                            Writing inode tables: done                            Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done       [root@localhost ~]# lvmlvm> pvcreate /dev/sdd1^C[root@localhost ~]# lvmlvm> pvcreate /dev/sdd1WARNING: ext4 signature detected on /dev/sdd1 at offset 1080. Wipe it? [y/n]: y  Wiping ext4 signature on /dev/sdd1.  Physical volume "/dev/sdd1" successfully created.lvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        2  Metadata Sequence No  6  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                2  Act PV                2  VG Size               4.07 TiB  PE Size               4.00 MiB  Total PE              1067889  Alloc PE / Size       1045611 / <3.99 TiB  Free  PE / Size       22278 / 87.02 GiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> vgextend centos /dev/sdd1  Volume group "centos" successfully extendedlvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        3  Metadata Sequence No  7  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                3  Act PV                3  VG Size               7.71 TiB  PE Size               4.00 MiB  Total PE              2021750  Alloc PE / Size       1045611 / <3.99 TiB  Free  PE / Size       976139 / 3.72 TiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> lvdisplay  --- Logical volume ---  LV Path                /dev/centos/swap  LV Name                swap  VG Name                centos  LV UUID                e3tU2L-yiAu-0d91-gCUc-pK2b-UA1J-qefwSf  LV Write Access        read/write  LV Creation host, time localhost.localdomain, 2019-02-19 20:10:51 +0800  LV Status              available  # open                 2  LV Size                7.56 GiB  Current LE             1936  Segments               1  Allocation             inherit  Read ahead sectors     auto  - currently set to     256  Block device           253:1     --- Logical volume ---  LV Path                /dev/centos/home  LV Name                home  VG Name                centos  LV UUID                A2SjOW-ptcT-MPDF-lmJr-Jubo-soFq-OVdaAr  LV Write Access        read/write  LV Creation host, time localhost.localdomain, 2019-02-19 20:10:51 +0800  LV Status              available  # open                 1  LV Size                <387.86 GiB  Current LE             99291  Segments               1  Allocation             inherit  Read ahead sectors     auto  - currently set to     256  Block device           253:2     --- Logical volume ---  LV Path                /dev/centos/root  LV Name                root  VG Name                centos  LV UUID                D3trQp-dXuk-oWog-VQMO-MmMp-bLUm-6Kpxei  LV Write Access        read/write  LV Creation host, time localhost.localdomain, 2019-02-19 20:10:52 +0800  LV Status              available  # open                 1  LV Size                3.60 TiB  Current LE             944384  Segments               2  Allocation             inherit  Read ahead sectors     auto  - currently set to     256  Block device           253:0   lvm> vgdispaly  No such command 'vgdispaly'.  Try 'help'.lvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        3  Metadata Sequence No  7  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                3  Act PV                3  VG Size               7.71 TiB  PE Size               4.00 MiB  Total PE              2021750  Alloc PE / Size       1045611 / <3.99 TiB  Free  PE / Size       976139 / 3.72 TiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> lvextend -L +4000G /dev/centos/home  Insufficient free space: 1024000 extents needed, but only 976139 availablelvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        3  Metadata Sequence No  7  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                3  Act PV                3  VG Size               7.71 TiB  PE Size               4.00 MiB  Total PE              2021750  Alloc PE / Size       1045611 / <3.99 TiB  Free  PE / Size       976139 / 3.72 TiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> lvextend -L +7720G /dev/centos/home  Insufficient free space: 1976320 extents needed, but only 976139 availablelvm> lvextend -L +3720G /dev/centos/home  Size of logical volume centos/home changed from <387.86 GiB (99291 extents) to 4.01 TiB (1051611 extents).  Logical volume centos/home successfully resized.lvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        3  Metadata Sequence No  8  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                3  Act PV                3  VG Size               7.71 TiB  PE Size               4.00 MiB  Total PE              2021750  Alloc PE / Size       1997931 / 7.62 TiB  Free  PE / Size       23819 / 93.04 GiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> quit  Exiting.[root@localhost ~]# df -hFilesystem               Size  Used Avail Use% Mounted on/dev/mapper/centos-root  3.7T  5.8G  3.6T   1% /devtmpfs                 7.5G     0  7.5G   0% /devtmpfs                    7.5G     0  7.5G   0% /dev/shmtmpfs                    7.5G   12M  7.5G   1% /runtmpfs                    7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sdb2               1014M  162M  853M  16% /boot/dev/sdb1                200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home  388G   37M  388G   1% /hometmpfs                    1.5G  4.0K  1.5G   1% /run/user/42tmpfs                    1.5G   32K  1.5G   1% /run/user/0/dev/sdc1                308M     0  308M   0% /run/media/root/OEMDRV[root@localhost ~]# df -ThFilesystem              Type      Size  Used Avail Use% Mounted on/dev/mapper/centos-root xfs       3.7T  5.8G  3.6T   1% /devtmpfs                devtmpfs  7.5G     0  7.5G   0% /devtmpfs                   tmpfs     7.5G     0  7.5G   0% /dev/shmtmpfs                   tmpfs     7.5G   12M  7.5G   1% /runtmpfs                   tmpfs     7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sdb2               xfs      1014M  162M  853M  16% /boot/dev/sdb1               vfat      200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home xfs       388G   37M  388G   1% /hometmpfs                   tmpfs     1.5G  4.0K  1.5G   1% /run/user/42tmpfs                   tmpfs     1.5G   32K  1.5G   1% /run/user/0/dev/sdc1               vfat      308M     0  308M   0% /run/media/root/OEMDRV[root@localhost ~]# xfs_growfs /dev/centos/homemeta-data=/dev/mapper/centos-home isize=512    agcount=4, agsize=25418496 blks         =                       sectsz=4096  attr=2, projid32bit=1         =                       crc=1        finobt=0 spinodes=0data     =                       bsize=4096   blocks=101673984, imaxpct=25         =                       sunit=0      swidth=0 blksnaming   =version 2              bsize=4096   ascii-ci=0 ftype=1log      =internal               bsize=4096   blocks=49645, version=2         =                       sectsz=4096  sunit=1 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0data blocks changed from 101673984 to 1076849664[root@localhost ~]# df -ThFilesystem              Type      Size  Used Avail Use% Mounted on/dev/mapper/centos-root xfs       3.7T  5.8G  3.6T   1% /devtmpfs                devtmpfs  7.5G     0  7.5G   0% /devtmpfs                   tmpfs     7.5G     0  7.5G   0% /dev/shmtmpfs                   tmpfs     7.5G   12M  7.5G   1% /runtmpfs                   tmpfs     7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sdb2               xfs      1014M  162M  853M  16% /boot/dev/sdb1               vfat      200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home xfs       4.1T   38M  4.1T   1% /hometmpfs                   tmpfs     1.5G  4.0K  1.5G   1% /run/user/42tmpfs                   tmpfs     1.5G   32K  1.5G   1% /run/user/0/dev/sdc1               vfat      308M     0  308M   0% /run/media/root/OEMDRV[root@localhost ~]# fdisk -lWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdb: 479.6 GB, 479554568192 bytes, 936630016 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: gptDisk identifier: 265C500F-7FC7-47B2-8ABC-B0DB1F42A62E#         Start          End    Size  Type            Name 1         2048       411647    200M  EFI System      EFI System Partition 2       411648      2508799      1G  Microsoft basic  3      2508800    936628223  445.4G  Linux LVM       WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sda: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: E2DCC553-3A14-479F-9496-39D0C99CB2DD#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd1Disk /dev/mapper/centos-root: 3961.0 GB, 3961033588736 bytes, 7736393728 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-swap: 8120 MB, 8120172544 bytes, 15859712 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/mapper/centos-home: 4410.8 GB, 4410776223744 bytes, 8614797312 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesWARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: gptDisk identifier: 87D03097-5A19-48F7-A23B-78314D0F2BB6#         Start          End    Size  Type            Name 1           34   7814037134    3.7T  Microsoft basic sd2[root@localhost ~]# 连接断开连接成功Last login: Wed Feb 20 10:05:24 2019 from 192.168.xxx.xxx[root@localhost ~]# df -ThFilesystem              Type      Size  Used Avail Use% Mounted on/dev/mapper/centos-root xfs       3.7T  5.8G  3.6T   1% /devtmpfs                devtmpfs  7.5G     0  7.5G   0% /devtmpfs                   tmpfs     7.5G     0  7.5G   0% /dev/shmtmpfs                   tmpfs     7.5G   11M  7.5G   1% /runtmpfs                   tmpfs     7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sdc2               xfs      1014M  162M  853M  16% /boot/dev/sdc1               vfat      200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home xfs       4.1T   38M  4.1T   1% /hometmpfs                   tmpfs     1.5G  8.0K  1.5G   1% /run/user/42tmpfs                   tmpfs     1.5G     0  1.5G   0% /run/user/0[root@localhost ~]# lvmlvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        3  Metadata Sequence No  8  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                3  Act PV                3  VG Size               7.71 TiB  PE Size               4.00 MiB  Total PE              2021750  Alloc PE / Size       1997931 / 7.62 TiB  Free  PE / Size       23819 / 93.04 GiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> lvextend -L +93G /dev/centos/root  Size of logical volume centos/root changed from 3.60 TiB (944384 extents) to 3.69 TiB (968192 extents).  Logical volume centos/root successfully resized.lvm> vgdisplay  --- Volume group ---  VG Name               centos  System ID               Format                lvm2  Metadata Areas        3  Metadata Sequence No  9  VG Access             read/write  VG Status             resizable  MAX LV                0  Cur LV                3  Open LV               3  Max PV                0  Cur PV                3  Act PV                3  VG Size               7.71 TiB  PE Size               4.00 MiB  Total PE              2021750  Alloc PE / Size       2021739 / 7.71 TiB  Free  PE / Size       11 / 44.00 MiB  VG UUID               UN00Ou-xPuX-tqat-6fYF-QcJD-Dssu-ISE8h5   lvm> quit  Exiting.[root@localhost ~]# xfs_growfs /dev/centos/rootmeta-data=/dev/mapper/centos-root isize=512    agcount=296, agsize=3276800 blks         =                       sectsz=4096  attr=2, projid32bit=1         =                       crc=1        finobt=0 spinodes=0data     =                       bsize=4096   blocks=967049216, imaxpct=25         =                       sunit=0      swidth=0 blksnaming   =version 2              bsize=4096   ascii-ci=0 ftype=1log      =internal               bsize=4096   blocks=6400, version=2         =                       sectsz=4096  sunit=1 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0data blocks changed from 967049216 to 991428608[root@localhost ~]# df -hFilesystem               Size  Used Avail Use% Mounted on/dev/mapper/centos-root  3.7T  5.8G  3.7T   1% /devtmpfs                 7.5G     0  7.5G   0% /devtmpfs                    7.5G     0  7.5G   0% /dev/shmtmpfs                    7.5G   11M  7.5G   1% /runtmpfs                    7.5G     0  7.5G   0% /sys/fs/cgroup/dev/sdc2               1014M  162M  853M  16% /boot/dev/sdc1                200M  9.8M  191M   5% /boot/efi/dev/mapper/centos-home  4.1T   38M  4.1T   1% /hometmpfs                    1.5G   12K  1.5G   1% /run/user/42tmpfs                    1.5G     0  1.5G   0% /run/user/0

四.其它

1.删除分区

  • fdisk 删除分区
# fdisk /dev/sdd# --根据输入 m 的提示,输入 d 可删除分区,如果只有1个分区,自动删除,如果多个分区,需要输入分区数字Command (m for help): d#--退出# quit
  • parted 删除分区
# parted /dev/sdd#--输入 p 显示硬盘信息# (parted) p#--删除 1 分区# (parted) rm 1#--退出# quit

五.待解决问题

  1. fdisk分区大于2T的操作
  2. ext4的缩容操作
  3. 删除扩容

转载地址:http://cknws.baihongyu.com/

你可能感兴趣的文章
25 iOS App Performance Tips & Tricks
查看>>
那些好用的iOS开发工具
查看>>
iOS最佳实践
查看>>
使用CFStringTransform将汉字转换为拼音
查看>>
更轻量的 View Controllers
查看>>
Chisel-LLDB命令插件,让调试更Easy
查看>>
时间格式化hh:mm:ss和HH:mm:ss区别
查看>>
When to use Delegation, Notification, or Observation in iOS
查看>>
Objective-C Autorelease Pool 的实现原理
查看>>
编程语言大牛王垠:编程的智慧,带你少走弯路
查看>>
ios指令集以及基于指令集的app包压缩策略
查看>>
iOS开发者的福利 — — iOS9+Xcode7免越狱免证书直接调试
查看>>
3、JavaWeb学习之基础篇—JSP
查看>>
4、JavaWeb学习之基础篇—Session
查看>>
5、JavaWeb学习之基础篇—标签(自定义&JSTL)
查看>>
8、JavaWEB学习之基础篇—文件上传&下载
查看>>
reRender属性的使用
查看>>
href="javascript:void(0)"
查看>>
h:panelGrid、h:panelGroup标签学习
查看>>
f:facet标签 的用法
查看>>