【linux磁盘扩容の根磁盘扩容】

linux磁盘扩容–根磁盘扩容

参考博客:点击可跳转至原博客

1.操作命令

partprobe /dev/vda
fdisk /dev/vda
d
n
p
Y
a
w
xfs_growfs /

2.操作回显日志

[root@master-001 ~]#  lsblk
NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                  11:0    1 1024M  0 rom  
vda                 253:0    0  200G  0 disk 
└─vda1              253:1    0   10G  0 part /
vdb                 253:16   0  300G  0 disk 
└─vdb1              253:17   0  300G  0 part 
  └─vg_data-lv_data 252:0    0  300G  0 lvm  /data
[root@master-001 ~]#   df -Th
Filesystem                  Type      Size  Used Avail Use% Mounted on
devtmpfs                    devtmpfs   32G     0   32G   0% /dev
tmpfs                       tmpfs      32G     0   32G   0% /dev/shm
tmpfs                       tmpfs      32G  1.5M   32G   1% /run
tmpfs                       tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/vda1                   xfs        10G  7.1G  3.0G  71% /
/dev/mapper/vg_data-lv_data xfs       300G  6.1G  294G   3% /opt
overlay                     overlay    10G  7.1G  3.0G  71% /var/lib/docker/overlay2/6dc2f4faf4dbaf57567fe5ac077e556b9627bffbbac9ca0792140b511daa03fd/merged
***************************************************************************
tmpfs                       tmpfs     6.3G     0  6.3G   0% /run/user/0

[root@master-001 ~]#  
[root@master-001 ~]#  partprobe /dev/vda
[root@master-001 ~]#  fdisk /dev/vda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table


Command (m for help): p
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xab4e6aa3

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 20971519 20969472  10G 83 Linux

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): p
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xab4e6aa3

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-419430399, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-419430399, default 419430399): 

Created a new partition 1 of type 'Linux' and of size 200 GiB.
Partition #1 contains a xfs signature.

Do you want to remove the signature? [Y]es/[N]o: Y     

The signature will be removed by a write command.

Command (m for help): p
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xab4e6aa3

Device     Boot Start       End   Sectors  Size Id Type
/dev/vda1        2048 419430399 419428352  200G 83 Linux

Filesystem/RAID signature on partition 1 will be wiped.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xab4e6aa3

Device     Boot Start       End   Sectors  Size Id Type
/dev/vda1  *     2048 419430399 419428352  200G 83 Linux

Filesystem/RAID signature on partition 1 will be wiped.

Command (m for help): w
The partition table has been altered.
Syncing disks.

[root@master-001 ~]#  xfs_growfs /
meta-data=/dev/vda1              isize=512    agcount=4, agsize=655296 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=2621184, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 2621184 to 52428544
[root@master-001 ~]#  df -Th
Filesystem                  Type      Size  Used Avail Use% Mounted on
devtmpfs                    devtmpfs   32G     0   32G   0% /dev
tmpfs                       tmpfs      32G     0   32G   0% /dev/shm
tmpfs                       tmpfs      32G  1.5M   32G   1% /run
tmpfs                       tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/vda1                   xfs       200G  8.5G  192G   5% /
/dev/mapper/vg_data-lv_data xfs       300G  6.1G  294G   3% /opt
overlay                     overlay   200G  8.5G  192G   5% /var/lib/docker/overlay2/6dc2f4faf4dbaf57567fe5ac077e556b9627bffbbac9ca0792140b511daa03fd/merged
***************************************************************************
tmpfs                       tmpfs     6.3G     0  6.3G   0% /run/user/0
[root@master-001 ~]#  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值