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

广大9个月前技术文章422


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


相关文章

MySQL创建用户授权

创建用户授权一、创建用户1.创建管理用户create user 'test'@'%' identified by 'Test123@'create user 'test'@'localhost' id...

kafka日志数据清理策略

kafka日志数据清理策略

1.关于Kafka的日志在Kafka中,日志分为两种:1、数据日志是指Kafka的topic中存储的数据,这种日志的路径是$KAFKA_HOME/config/server.properties文件中...

Spark thriftserver对接cdh hive

Spark thriftserver对接cdh hive

1、背景客户需要使用spark的thriftserver来通过beeline或者jdbc 来使用spark sql环境: spark 3.2.0hive: 2.1.1-cdh6.3.2hadoop:...

LINUX 安全运维-用户密码

密码策略linux作为一个多用户的系统,我们还是不可避免的会去新增很多用户,我们不能保证每一个用户具有很好的安全意识,所以只能在用户的密码以及用户的远程访问上做一些限制,我们先介绍Linux用户密码策...

mysql表结构对比工具介绍

mysql表结构对比工具介绍

一、AmpNmp.DatabaseCompare工具1、工具特点:优点:比较两个数据库全部表结构的差异,包括表名、存储引擎、字符集、注释的不同,以及每张表中的字段名、数据类型、字符集、默认值、注释的不...

MySQL Group Replication(一)部署篇

MySQL Group Replication(一)部署篇

MGR 简介Group Replication 是 MySQL 在 2016 年 12 月以 GA 的形式发布,以插件的形式绑定在 MySQL 服务器上。传统的 MySQL 复制功能是异步复制,而 M...

发表评论    

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