• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

ubuntu server 12.04, postgresql and hard disk size?

Joined
Aug 14, 2012
Messages
33
Hi everyone,

I plan to setup a virtual machine (in vmware) with the specs below.

2 core
6GB ram
50GB hard disk storage

Just say I choose LVM part of the ubuntu 12.04 server installation (or entire disks).

Inside here, I will have my business applications running in there.

I assume my postgresql is installed into one of the directories of ubuntu server.

Now my problem. My VM hard disk is fully occupied, say around 95% full already.

I need to add more storage into my VM, which I believe I can. I need to mount a new partition say another 30GB which in total this VM will have 80GB (either as a combined partition, which I am not sure how or 2 partitions).

However if I mount a new partition, but my postgresql is installed on the 1st partition, I don't think it will help either?

A good analog is like windows

say I install postgresql on C:/ drive. When I setup a new D:/ drive, it doesn't solve the issue as postgresql is on C:/ drive.

What should I do?

I am not looking at NAS or SAN storage for time being. But I wonder how can I scale this VM accordingly? Is there any special ways to make this work?

Thanks in advance.
 
I believe postgresl is installed in /var/lib/postgresql.

If you need to add more storage, you simply add the disk to your vm, create a "pv" on it, add it to the "vg" of whatever the system is installed on and then "extend" the lv. No need to shut down postgres, or reboot or anything.
 
Thanks for replying back.

As for your reply here

If you need to add more storage, you simply add the disk to your vm, create a "pv" on it, add it to the "vg" of whatever the system is installed on and then "extend" the lv. No need to shut down postgres, or reboot or anything.

Do you have any tutorials on howto do the above? I don't really know what you mean in exact details. e.g. what is pv, vg and lv? plus do i only increase the size of /var/lib directory or?

Any help? Thanks.
 
Can you post the output of "pvs" "vgs" and "lvs" as well as the name of the new virtual disk you are adding?
the output of "df -h" would be helpful as well.

1) add the disk to your vm.
2) find the CORRECT device id (probably via dmesg (maybe /dev/vdb or /dev/sdb or something similar)
3) "pvcreate /dev/$something" $something you have to fill in based on how the new disk is labelled
4) vgexend $volumegroupname /dev/$something
5) lvextend /dev/$vgname/$lvname +$somenumberG

This should be helpful:
http://tldp.org/HOWTO/LVM-HOWTO/

Also: Assuming you are using ext2/3/4, you wlil need to do "resize2fs /dev/$vgname/$lvname".

You'd also probably get more responses in the linux subforum :)
 
I will give it a try when I go back to office tomorrow.

Upon curiosity, I assume I can't just increase the size of /var/lib. But instead the whole drive which consist or

/var
/etc
/opt
...

Is that correct? Thanks.
 
I will give it a try when I go back to office tomorrow.

Upon curiosity, I assume I can't just increase the size of /var/lib. But instead the whole drive which consist or

/var
/etc
/opt
...

Is that correct? Thanks.

You can increase the size of a lvm volume. If you have one lvm mouted at / and one mounted at /var/lib then you can increase them individually.

Another way to do it is (if you only have one mount point) to stop postgres, and create a new lvm volume JUST for /var/lib then you can just expand (only that) as needed. That would require copying/rsyncing files from /var/lib (a directory on /) to a separate partition & then mounting the new partition at /var/lib.
 
Thanks everyone :) Let me digest the information and revert back if need more tips :) you all rocks :)
 
Back
Top