How can I get CentOS 5 to recognize an increase in drive space on my VM?
Solution 1
Resizing a partition on Centos: http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-disk-storage-parted-resize-part.html
If you are using LVM, you will have to first pvresize
to the desired size, then lvextend
the LVs before resizing the partitions.
No need for vgresize
, it's for adding PVs, not for resizing the volgroup.
Solution 2
You're not using LVM.
A reboot will recognize the new space added to the disk from the VMWare side. You can also rescan the SCSI bus, but the reboot will work. Use fdisk -l
to verify.
From there, it looks like you have everything in a single /
partition. Your resizing options are either:
- manually editing the partition table with
fdisk
and usingresize2fs
or... - Using
parted
.
Another option that I prefer for VMs, is examining the utilization on the filesystem (using du
or ncdu
) and adding mount points as needed. If most of your space is consumed by data in /var, why not make /var its own partition/filesystem? It's beyond the scope of this question, but something to think about.
Related videos on Youtube
Mike B
Technology Enthusiast, Gamer, Sci-Fi Addict, and DIY-er in training. =)
Updated on September 18, 2022Comments
-
Mike B over 1 year
VMWare / CentOS 5.x
My CentOS VM system was running low on space so a VMWare admin increased the storage space allocated to the VM. After powering off the system and restarting it, the OS is still showing the same old amount of space.
Can someone please advise on what specific steps I need to complete in order to have CentOS 5 recognize the new space? It's my understanding that I'll likely need to run a partitioning tool in order to incorporate the new space.
If it's helpful, here is the output of
fdisk -l
:Disk /dev/sda: 12.8 GB, 12884901888 bytes 255 heads, 63 sectors/track, 1566 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 16 128488+ 83 Linux /dev/sda2 17 277 2096482+ 82 Linux swap / Solaris /dev/sda3 278 1566 10353892+ 83 Linux
Here's the contents of /etc/fstab:
LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-sda2 swap swap defaults 0 0
Here is the output of the pvs command:
[root@foo ~]# pvs /dev/hdc: open failed: No medium found
Here is the output of the pvscan command:
[root@foo ~]# pvscan No matching physical volumes found
-
David Corsalini about 12 yearsfrom the output you've posted, it looks like /dev/sda is directly formatted, no LVM. to be extra sure, run
pvs
and see if you have any PVs set up -
Mike B about 12 yearsThanks. When I ran that command, I got an error (added to the description above).
-
David Corsalini about 12 yearsnothing related to /dev/sdX meaning you have no PVs set up. Actually, I can be wrong there,
pvs
is not the right command, better usepvscan
. -
Mike B about 12 yearsK. pvscan returns that no physical volumes are found.
-
Luke about 10 yearsTo confirm you are running LVM you can also check the output of
pvdisplay
(to see if there are Physical Volumes defined) orlvdisplay
(to see if there are Logical Volumes defined). You can also look at /etc/fstab to check what kind of partitions are referred to: if you only have real partitions (/dev/hd*, /dev/sd* for instance) you are probably not using LVM; otherwise you'll see references to some LVM logical volume (for instance /dev/GroupName/VolumeName) -
Luke about 10 yearsJust another note: if your partition is referred by label, /etc/fstab could not be the best way to check for LVM usage, that's why I usually double-check it with
pvdisplay
/lvdisplay