Resizing file systems on virtualized hardware is pretty simple, just use your management console (AWS, VirtualBox, etc.) to allocate more data and then as root use standard OS commands to modify the disk partition.
Be extremely careful, because some of the following commands are pretty destructive!
Have your credentials setup for using awscli and then follow this example:
# List volumes attached to some instance aws ec2 describe-instances \ --instance-id=i-01508790348a21307 \ --region=eu-west-1 --query="Reservations[*].Instances[*].BlockDeviceMappings" # Get information about the selected volume aws ec2 describe-volumes \ --volume-id vol-0eb12becf38326c9f \ --region=eu-west-1 # Resize that volume aws ec2 modify-volume \ --volume-id vol-0eb12becf38326c9f \ --size 7700 \ --region=eu-west-1 # Check status of the volume modification aws ec2 describe-volumes-modifications \ --volume-id vol-0eb12becf38326c9f \ --region=eu-west-1
Disk /dev/xvda: 214.7 GB, 214748364800 bytes 255 heads, 63 sectors/track, 26108 cylinders, total 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 Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/xvda1 * 16065 209712509 104848222+ 83 LinuxThe important is the start sector number, in this example 16065.
Disk /dev/xvda: 214.7 GB, 214748364800 bytes 255 heads, 63 sectors/track, 26108 cylinders, total 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 Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/xvda1 * 16065 419430399 209707167+ 83 Linux
/dev/md0: Version : 1.2 Creation Time : Thu Jun 30 14:53:24 2016 Raid Level : raid1 Array Size : 4170419968 (3977.22 GiB 4270.51 GB) Used Dev Size : 4170419968 (3977.22 GiB 4270.51 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Wed Oct 4 00:19:21 2017 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Name : are-X-devD-docker-0:2 UUID : b5654e63:4e7be141:9117b522:e60077f8 Events : 2783 Number Major Minor RaidDevice State 0 202 48 0 active sync /dev/xvdd 1 202 64 1 active sync /dev/xvdeAs you can see, these /dev/sdd and /dev/sde are visible as /dev/xvdd and xvde in current Linux installation.
$ fdisk -l | grep 'Disk /dev/' Disk /dev/xvde doesn't contain a valid partition table Disk /dev/xvdd doesn't contain a valid partition table Disk /dev/md0 doesn't contain a valid partition table Disk /dev/xvda: 42.9 GB, 42949672960 bytes Disk /dev/xvde: 5471.8 GB, 5471788335104 bytes Disk /dev/xvdd: 5471.8 GB, 5471788335104 bytes Disk /dev/md0: 4270.5 GB, 4270510047232 bytes
$ resize2fs /dev/md0 resize2fs 1.42.9 (4-Feb-2014) Filesystem at /dev/md0 is mounted on /mnt/are_md0; on-line resizing required old_desc_blocks = 249, new_desc_blocks = 315 The filesystem on /dev/md0 is now 1317177280 blocks long.
Some new hardware types in Amazon Web Services are not using SSDs but NVMe (Non-volatie Memories), they can be managed different way and you can get their volume identification with this script using command nvme:
#!/bin/bash ( printf "AWS console;Volume Id;Local device\n" for nvme_dev in $(nvme list | grep -Eo '/dev/nvme[0-9]n[0-9](p[0-9])?' | grep -v 'p[0-9]$') do aws_dev=$(nvme id-ctrl -v $nvme_dev | grep '^0000' | grep -Eo '(/dev/)?[a-z]{3,4}') aws_id=$(nvme id-ctrl -v $nvme_dev | sed -ne '/^sn/{s/.*vol\([[:xdigit:]]*\)/vol-\1/;p}') if [[ $aws_dev != /dev/* ]] ; then aws_dev=/dev/$aws_dev fi printf "%s;%s;%s\n" $aws_dev $aws_id $nvme_dev done ) | column -s';' -t
This variant uses classic method for disk connected from some external disk array via fiber channel interfaces. Those disks are added to the Logical Volume Manager:
pvcreate /dev/rdsk/c7t0d3 pvcreate /dev/rdsk/c9t0d3 vgextend vg02 /dev/dsk/c7t0d3 /dev/dsk/c9t0d3 vgdisplay -v vg02 | more lvcreate -n data02 -l 6398 vg02 # size is number of extensWhen mirroring is enabled the number of extents must be double.
mkdir /oradata2 vi /etc/fstab /dev/vg02/data02 /oradata2 vxfs delaylog 0 2 mount -a