Extend the size of ext3 partition online in VM

1. Increase disk space in vCenter

2. scan disk on the Linux VM

# fdisk -lu > /tmp/fdisk.1
# echo 1 > /sys/block/sdb/device/rescan
# echo 1 > /sys/block/sdd/device/rescan
# fdisk -lu > /tmp/fdisk.2

3. umount the partition

# umount /Backup
# umount /Data/

4. Extend disk size by fdisk, and command "d" will not format the data in the disk by test

# fdisk -u /dev/sdb

The number of cylinders for this disk is set to 23497.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-377487359, default 63): 
Using default value 63
Last sector or +size or +sizeM or +sizeK (63-377487359, default 377487359): 
Using default value 377487359

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

5. Verify the new partition

# e2fsck -f /dev/sdb1 
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 171/13107200 files (24.6% non-contiguous), 23456238/26214055 blocks

6. Resize new partition in system

# resize2fs /dev/sdb1
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/sdb1 to 47185912 (4k) blocks.
The filesystem on /dev/sdb1 is now 47185912 blocks long.

7. Mount new size partition back to system

# mount -all
原文地址:https://www.cnblogs.com/oskb/p/3317051.html