linux下ext4类型文件系统/目录扩容

广大2年前技术文章1442


1、查看分区信息

[root@172-16-121-112 ~]# fdisk -l


Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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

Disk label type: dos

Disk identifier: 0x000a33e0


   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *        2048      411647      204800   83  Linux

/dev/vda2          411648   209715199   104651776   83  Linux


2、进行分区

[root@172-16-121-112 ~]# fdisk /dev/vda 

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): p


Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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

Disk label type: dos

Disk identifier: 0x000a33e0


   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *        2048      411647      204800   83  Linux

/dev/vda2          411648   209715199   104651776   83  Linux


Command (m for help): d

Partition number (1,2, default 2): 2

Partition 2 is deleted


Command (m for help): p


Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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

Disk label type: dos

Disk identifier: 0x000a33e0


   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *        2048      411647      204800   83  Linux


Command (m for help): n

Partition type:

   p   primary (1 primary, 0 extended, 3 free)

   e   extended

Select (default p): p

Partition number (2-4, default 2): 

First sector (411648-209715199, default 411648): 

Using default value 411648

Last sector, +sectors or +size{K,M,G} (411648-209715199, default 209715199): 

Using default value 209715199

Partition 2 of type Linux and of size 99.8 GiB is set


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.


WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.


3、分区完成,使扩容生效

--进行查看文件系统类型

#df -TH

--重读分区表信息,fdisk分区可能不会立即生效,重读信息可以同步最新的设备信息

#partprobe 

--生效扩容的分区,在文件系统上显示。(ext4类型文件系统)

#resize2fs  /dev/vda2


4、查看扩容后目录生效:

[root@172-16-121-112 ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

devtmpfs        1.9G     0  1.9G   0% /dev

tmpfs           1.9G     0  1.9G   0% /dev/shm

tmpfs           1.9G   65M  1.8G   4% /run

tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup

/dev/vda2       100G  2.2G   98G   3% /

/dev/vda1       197M  120M   77M  61% /boot

tmpfs           379M     0  379M   0% /run/user/0


相关文章

MongoDB的WiredTiger存储引擎

从MongoDB 3.2 开始,MongoDB实例默认的存储引擎为WiredTiger,WiredTiger存储引擎具体以下几大优点:文档级并发将数据持久化到磁盘快照和checkpoint数据压缩本地...

Ansible部署和使用(sshpass)

Ansible部署和使用(sshpass)

简介Ansible默认通过 SSH 协议管理机器。安装Ansible之后,不需要启动或运行一个后台进程,或是添加一个数据库。只要在一台电脑(可以是一台笔记本)上安装好,就可以通过这台电脑管理一组远程的...

MySQL 小版本升级

MySQL 小版本升级

MySQL 版本一般不需要经常升级,如果需要使用某个新特性或者修改 BUG 就不得不升级小版本。1. 环境调研1. 当前数据库版本和需要升级到某个版本,如果升级需求 5.6.22+ 那么我们直接下载...

使用udev配置asm

环境:centos7    1、udev介绍udev概念udev 是 Linux2.6 内核里的一个功能,它替代了原来的 devfs,成为当前 Linux 默认的设备管理工具。udev 以守护进程的形...

Ldap部署

安装ldapyum -y install openldap compat-openldap openldap-clients openldap-servers openldap-servers-sql...

MS SQL Server partition by 函数实战二 编排考场人员

需求假设有若干已分配准考证号的考生,准考证号示例(01010001)共计8位,前4位为分类号,后4位为分类下的总排序号。现提供考场分配信息EXCEL文件(包括考场编号 、考场名称、考场容纳人数等),希...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。