Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I keep on running out of disk space while trying to compile gcc and I keep on creating larger and larger disk sizes and after 5 hours of compiling, it runs out of disk space. I've resized the disk 4 times now, restarted the compile step for the 4th time now with a 500GB disk.

When I ran df -h to see how much space was used, it only says 9.7GB, but that's considered 100%.

enter image description here

enter image description here

enter image description here

I thought there might be another disk, but I'm only seeing sda and its partition

ls /dev/sd*
/dev/sda  /dev/sda1

So is my disk actually 500GB in size and df is just reporting it wrong (in which case compiling gcc chows up the whole 500GB) or is Google Cloud's Dashboard reporting it wrong, df reporting it right and compiling gcc is not chowing through 500GB ?

Either way, unless I'm supposed to do something to make use of the 500GB (which is counter-intuitive by the way), I'm guessing this is a bug?

(I've searched before I posted, I've only seen AWS related issues)

UPDATE - lsblk explains it:

lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  500G  0 disk 
└─sda1   8:1    0   10G  0 part /
share|improve this question
2  
Post the output of lsblk. – EEAA Jan 6 at 5:30
1  
Looks like a bog-standard Linux root partition resizing to me. Unless GCE has some fancy tools to tell your VM to expand the filesystem for the newly-expanded partion, you have to do it yourself. – Magellan Jan 6 at 5:32
    
Thanks @EEAA, that explains it, I see the boot partition is only 10GB in size of 500GB, wasn't aware that I had to resize it myself. – Jan Vladimir Mostert Jan 6 at 5:42
    
On Debian I don't need to do any resizing, seems that it's just CentOS: stackoverflow.com/questions/30786236/… – Jan Vladimir Mostert Jan 6 at 5:44
    
up vote 9 down vote accepted

It seems Google Compute Engine does offer automatic resizing of root partitions on most operating systems (I'm usually using Debian, so never had such issues), CentOS it seems is not one of them.

See: https://cloud.google.com/compute/docs/disks/persistent-disks#repartitionrootpd

In my case, manual repartition is needed, see: https://cloud.google.com/compute/docs/disks/persistent-disks#manualrepartition

After going through the steps, my disk size is now 500GB

lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  500G  0 disk 
└─sda1   8:1    0  500G  0 part /
share|improve this answer
4  
I'd recommend taking a snapshot of your VM if GCE allows for that before you give that a try. And if you've not done this before, I'd definitely recommend trying it on non-Production instances before doing this in Production. – Magellan Jan 6 at 6:06
1  
Hehe, too late, already wrecked the machine. Luckily made a snapshot last night, so no major damage. – Jan Vladimir Mostert Jan 6 at 6:08

Here are the steps in you have single xfs (/dev/sda1) partition.

First re-create your root partition, type this command:

(echo d; echo n; echo p; echo 1; echo ; echo; echo w) | sudo fdisk /dev/sda

Then restart your server. Once restarted, grow your partition

xfs_growfs /dev/sda1

Verify with:

df -h

Don`t forget to make snapshot before trying!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.