美文网首页
linux虚拟机磁盘扩容--VMware非LVM管理的根目录扩容

linux虚拟机磁盘扩容--VMware非LVM管理的根目录扩容

作者: 白面葫芦娃92 | 来源:发表于2020-05-09 17:48 被阅读0次

参考:
https://blog.csdn.net/u014094046/article/details/95951833

[root@hadoop002 ~]# fdisk -l

Disk /dev/sda: 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: 0x0000e740

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      821247      409600   83  Linux
/dev/sda2          821248     7112703     3145728   82  Linux swap / Solaris
/dev/sda3         7112704    41924607    17405952   83  Linux
[root@hadoop002 ~]# fdisk /dev/sda
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/sda: 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: 0x0000e740

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      821247      409600   83  Linux
/dev/sda2          821248     7112703     3145728   82  Linux swap / Solaris
/dev/sda3         7112704    41924607    17405952   83  Linux

Command (m for help): n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): p
Selected partition 4
First sector (41924608-209715199, default 41924608): ^Z
[1]+  Stopped                 fdisk /dev/sda
[root@hadoop002 ~]# fdisk /dev/sda
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/sda: 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: 0x0000e740

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      821247      409600   83  Linux
/dev/sda2          821248     7112703     3145728   82  Linux swap / Solaris
/dev/sda3         7112704    41924607    17405952   83  Linux

Command (m for help): d
Partition number (1-3, default 3): 3
Partition 3 is deleted

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (7112704-209715199, default 7112704): 
Using default value 7112704
Last sector, +sectors or +size{K,M,G} (7112704-209715199, default 209715199): 
Using default value 209715199
Partition 3 of type Linux and of size 96.6 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.

[root@hadoop002 ~]# reboot

[root@hadoop002 ~]# df -T
Filesystem     Type     1K-blocks     Used Available Use% Mounted on
/dev/sda3      ext4      17001256 16101364     13212 100% /
devtmpfs       devtmpfs    915976        0    915976   0% /dev
tmpfs          tmpfs       931624        0    931624   0% /dev/shm
tmpfs          tmpfs       931624    10336    921288   2% /run
tmpfs          tmpfs       931624        0    931624   0% /sys/fs/cgroup
/dev/sda1      ext4        388462   146128    217758  41% /boot
tmpfs          tmpfs       186328        0    186328   0% /run/user/0
tmpfs          tmpfs       186328       12    186316   1% /run/user/42

[root@hadoop002 ~]# resize2fs /dev/sda3
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/sda3 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 13
The filesystem on /dev/sda3 is now 25325312 blocks long.

[root@hadoop002 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        95G   16G   76G  17% /
devtmpfs        895M     0  895M   0% /dev
tmpfs           910M     0  910M   0% /dev/shm
tmpfs           910M   11M  900M   2% /run
tmpfs           910M     0  910M   0% /sys/fs/cgroup
/dev/sda1       380M  143M  213M  41% /boot
tmpfs           182M     0  182M   0% /run/user/0
tmpfs           182M  8.0K  182M   1% /run/user/42


相关文章

网友评论

      本文标题:linux虚拟机磁盘扩容--VMware非LVM管理的根目录扩容

      本文链接:https://www.haomeiwen.com/subject/focqnhtx.html