I have a remote Linux CentOS VM on Azure which hosts a MYSQL database. I just finished upgrading the disk size from 30GB to 100GB. Problem is that extra space wasn't added to the partition.
$ parted
(parted) print free
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 31.2GB 31.2GB primary ext4 boot
2 31.2GB 32.2GB 1049MB primary linux-swap(v1)
32.2GB 107GB 75.2GB Free Space
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 29G 0 part /
└─sda2 8:2 0 1000M 0 part
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 50G 0 part /mnt/resource
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 29822848 25241412 3043440 90% /
devtmpfs 1752756 0 1752756 0% /dev
tmpfs 1761624 0 1761624 0% /dev/shm
tmpfs 1761624 8440 1753184 1% /run
tmpfs 1761624 0 1761624 0% /sys/fs/cgroup
/dev/sdb1 51472864 53276 48781868 1% /mnt/resource
tmpfs 352328 0 352328 0% /run/user/1000
Obviously, I need to extend partition 1 (/dev/sda) to include the free space. Using this post, I tried
sudo resize2fs /dev/sda 100G
but it gets rejected with
Device or resource busy while trying to open /dev/sda`.
I think this means that I can't extend the partition while it's in use, which makes sense to me given my experience doing the same on windows. If that is the case, then how do I extend the partition on a remote azure VM?
Note: I only shell into the VM, therefore I cannot boot an external program, use a GUI, or simply mount the drive onto another machine.
OS Details
Static hostname: PMCTMYSQL
Icon name: computer-vm
Chassis: vm
Machine ID: 99f30b6b81444d47a888f0313c428bd8
Boot ID: 444cc3a5a22b4e53a947e06af2d9b4d2
Virtualization: microsoft
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.36.3.el7.x86_64
Architecture: x86-64
More Research
I checked other threads suggested by SU, but they don't apply for a variety of reasons:
Suggests GUI tools
- How to extend partition size in linux(ubuntu 9.04)?
- How to extend a Linux ext3 partition?
- How to extend a Mint Linux partition on a dual boot config with Windows 8.1?
- How to resize extended partition?
Uses VMware
Uses external tools (boot disk)
How to Extend primary partition(/dev/sda1) in linux?
No comments:
Post a Comment