Make room on fog server's storage
-
I’ve gone through and removed several images from my fog server, whats the easiest way to reclaim the storage space.
How do i find which storage contains the images from Fog? Attaching a picture from GParted.
Using Ubuntu 14.04
-
@sjensen By default all the images are stored in folder
/images
on our FOG server. Runls -al /images
to see if they are where we would expect them to be. Then you can remove them one by one using the Linuxrm
command - be careful with this one as you can cause harm if you don’t know for sure what you do. -
@sjensen If you delete the image from the image list (not from within the image definition) the deletion action will only remove the list entry and leave the raw files behind. If you go into the image record and delete the image from there, there is a checkbox to also remove the raw files (or something named similar). This will purge the files from the disk.
So now to your point. All of the raw files are stored in /images on the FOG server. In the images directory there are image specific directories. You can purge the no longer needed image files one by one with this command. Be careful because this command can cause great damage if used incorrectly. You want to run this command
sudo rm -rf /images/<image_name>
where<image_name>
is the directory where you want to remove the image from. This will remove the raw data files that align with the meta data you deleted from before. Once you purge these directories you will regain your disk space.Side bar the
rm -rf
command means remove-r
all files below and the-f
is force, just do it. So that command can be destructive if the path is not clearly defined. -
@sebastian-roth Thank you for the quick reply, so to be clear. From terminal type in the rm command and filename. $ rm Optiplex3070
-
@sjensen See @george1421’s post on options to use with
rm
. Just be sure you know what you do to not delete things you wanted to keep. It will just be gone… -
I have decided to not remove any images from my fog server, instead i added more hard drive space. I added it through our vm console then used GParted to extend the drive. However fog is not recognizing the space i added. Is there an additional step or 2 i need to do?
-
@sjensen You need to extend the file system too. From a virtual machine stand point you extend the vmdk, partition, then the file system. How you extend the file system is based on what filesystem your fog server is using. xfs is the easiest to extend others are not bad either.
-
@george1421 and how does one extend a filesystem and find out what fog server is using?
-
@sjensen well this is a linux issue not specifically a fog issue.
I would look in /etc/fstab to find out what file system your partition is formatted as. Once you know the file system (its probably xfs or ext4) then I can give you a hint how to extend it.
-
@george1421 Thinking about this you have one more layer in the mix. Since you are using lvm, you need to extend the lvm partition if its not matching the size of the disk.
TBH if this is a vm I would personally just create a new disk and create a standard partition, format it and then migrate your files over to this new disk. I’ve been thinking about creating a new recommendation tutorial to show how I would go about setting up fog to allow storage expansion easily after the fact. LVM adds quite a bit of flexibility but also adds some management overhead that isn’t needed.
-
@george1421 sorry sir im very green when it comes to linux im assuming etc/fstab is folder. Not familiar with this command or the command to extend a file system.
-
@sjensen Looking at the pictures you posted it looks like you added space to partition /dev/sda3. That seems kind of strange from my point of view.
It’s very hard to help you in such a situation where we don’t know what exactly was done and how it was initially setup. Lets give it a try nevertheless. Please run the following commands and post all outputs here:
lsblk pvscan lvscan sfdisk -d /dev/sda
-
@sjensen thank you
-
@sjensen Just as a precaution - make sure you have a backup copy of all your important data from this system. I won’t be made liable for any steps you take!
So let’s take a look at the whole process of resizing which involves several “layers” - see below.
In the output of
pvscan
we see that the physical volume on /dev/sda3 is 400 GB in size and has 100 GB free/not in use. So gparted has extended the partition but not the physical volume (in LVM terms). To do that run:pvresize /dev/sda3
The next step is to tell the logical volume (LV) to use that new space:
lvextend -l+100%FREE /dev/FOGServer-vg/root
As a final step you need to extend the filesystem.
resize2fs /dev/FOGserver-vg/root
Finally check the partition size in the output of
df -h
.