Help on Increasing Virtual Disk Space for Web-sever

Asked by tearsforhari

Hello--I am in the immediate need of increasing the disk space for a virtual web-server on Linux 12.04.5. Can someone show me how to do this?
>uname -a
Linux fd-lso-alice 3.5.0-45-generic #68~precise1-Ubuntu SMP Wed Dec 4 16:18:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

>$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/systemname 21G 21G 0 100% /
udev 989M 12K 989M 1% /dev
tmpfs 200M 800K 199M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 999M 0 999M 0% /run/shm
/dev/sda1 228M 29M 187M 14% /boot
/dev/sdb1 74G 794M 70G 2% /mnt

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Could try:

sudo apt-get clean

As a good start.

What technology are you using to virtualise?

Thanks

Revision history for this message
tearsforhari (tearsforhari) said :
#2

The machine running the website is on a Window's server. I will have to increase the disk space there I suppose first. The linux box is a virtual machine. Any suggestions on how to go about doing this?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Yes but are you using VMWare or Virtualbox or QEMU??

Revision history for this message
tearsforhari (tearsforhari) said :
#5

Sorry for the naive questions. Are you asking what I am running on the Windows or Linux machine? How can I check?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

You have a Windows OS. It is running some form of software to allow the virtual Linux PC to run.

What is it?

Revision history for this message
tearsforhari (tearsforhari) said :
#7

Sorry, the host is a remote 2008 Windows server running HyperV (which is the equivalent to VMWare.)

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

Once you expand the disk in hyper v the new space will be visible in the OS.

If you are expanding the system partition you will need to boot to Ubuntu LiveCD desktop and resize thpartitionsn into the new space.

Obviously make sure your backups are sufficient before starting this in case of catastrophe.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#9

The tool in Live CD you will need is gparted.

Revision history for this message
tearsforhari (tearsforhari) said :
#10

If I understand, I first expand the disk in Hyper V in Windows. But then I need to resize the linux partition on it using a Ubuntu boot CD.
My questions are:
1. Because the machine is remote, can I use remote desktop on Windows to read a local CD so that the remote machine running linux will read it?
2. Would it be better to create a new partition that is larger and clone the contents onto that? If so, how?
3. How do I image the linux partition remotely before proceeding?

I really appreciate the help on this one.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#11

Hyper v can mount CD images to use, just like you did when you installed Ubuntu. It doesn't matter if the system is remote or not.

You can use tools (in LiveCD again) to clone disks. dd is one such tool but extending the disk is super simple.

If you want to make an image you can use dd to another storage to effectively make an ISO of your data. You can use dd to spit the data back if needed. You can even mount the file like you would a partition or CD and recover individual files.

Revision history for this message
tearsforhari (tearsforhari) said :
#12

Ok. Glad to hear it is simple. Thanks for the confidence!

1. By LiveCD, is that Disk 1 of the Installation of Ubuntu? How can I make another if I need one?

2. Can you write out the steps to extend the disk using the liveCD?

3. What are the dd commands to make an ISO of the partition containing my data, say to a portable USB HDD drive?
     What are the dd commands to spit it back?

4. Please tell how to make a new partition using the liveCD in case I wanted to created another VM on that same disk.

Revision history for this message
tearsforhari (tearsforhari) said :
#13

One more question please: I'm not sure how that Ubuntu partition got filled up so quickly. Is there a way or command to see if there are excessive logs files building up?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#14

cd /
du -sh *

Will show you the largest folders. I suspect your /var folder is large. You can clear them down and save lots of space

Revision history for this message
tearsforhari (tearsforhari) said :
#16

Also, when you have time, I need to still enlarge the disk partition for the VM. The real problem is I am accumulating more data now; so my backup files are growing in size. I would appreciate if you could help us with:

2. Can you write out the steps to extend the disk using the liveCD?

As far as the iso image of the partition, I believe that Hyper V can make the iso image.

Finally, the directory that contains the backups is highlights when I do a ls -als. I think this means that the directory is linked to another place either on this machine or another machine that contains the script. Any suggestions on locating it?

Revision history for this message
tearsforhari (tearsforhari) said :
#17

Hi. Found these command line steps to resize a partition. Can you tell me whether they will work on Ubuntu running off Hyper in Windows 2008 Server? If so, have you tried it or have similar protocol?

1. first adjust the virtual disk size in Hyper V

2. in Ubuntu on a command prompt:
> df -h
/dev/mapper/system name 21 21 0 100%
>fdisk -l #to get the total hard disk size
>pvs #to get the physical volume
>lvextend -L +6G /dev/mapper/system name #to add 6G to increase logical volume
>df -h #just checking
>lvs #just checking
>mount
>resize2fs /dev/mapper/system name
>df -h #check to see if it worked

3. Just a reminder if you could provide a command to find a file (via grep or similar) on a whole hard drive.

Thank You

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#18

What is the output of:

uname -a; dpkg -l | grep linux-image | grep -v extra | awk {'print $2'}

Thanks

Revision history for this message
tearsforhari (tearsforhari) said :
#19

>uname -a; dpkg -l | grep linux-image | grep -v extra | awk {'print $2'}
Linux SystemName 3.5.0-45-generic #68~precise1-Ubuntu SMP Wed Dec 4 16:18:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
linux-image-3.5.0-45-generic

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#20

hm, have you checked how big your logs are?

try:

cd /var/log; du -sh *

What is the output?

Revision history for this message
tearsforhari (tearsforhari) said :
#21

The logs are small (48M). I cleaned up the partitioned disk space yesterday so that I am at 70% usage at the moment. But my needs are growing . So I still need to increase the Linux partition.

In addition, the /tmp directory in Ubuntu is only 1M. I need to increase this to 100M. I'm running into disk space usage there when running some shell scripts that are transfering files.

Do those commands I wrote above work to increase the Ubuntu partition size? How would I increase /tmp?

Revision history for this message
tearsforhari (tearsforhari) said :
#22

Any suggestions?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#23

I already told you. You need a Windows forum or guide to expand the disk in Hyper V then extend the partition into the new space.

Revision history for this message
tearsforhari (tearsforhari) said :
#24

I know that. I know how to expand in Hyper V. I just want to know whether the commands lines above will work in Ubuntu. Specifically, whether the following will work:

>lvextend -L +6G /dev/mapper/system name #to add 6G to increase logical volume
>mount
>resize2fs /dev/mapper/system name

I need some confidence that someone has tried these in Ubuntu. If you haven't, then I'll try on a dummy system.
Just thought that you might have used them before.

Revision history for this message
tearsforhari (tearsforhari) said :
#25

I appreciate the help you have given previously.

Revision history for this message
Manfred Hampl (m-hampl) said :
#26

One word of caution:

In your original text the output of df -h contains
/dev/mapper/systemname 21G 21G 0 100% /

and in response #17 it is
/dev/mapper/system name 21 21 0 100%

once without and once with a space character inside; that is something I do not understand!

If there is a space inside, you might have to escape it in the commands, e.g.

resize2fs /dev/mapper/system\ name
or
resize2fs "/dev/mapper/system name"

Revision history for this message
tearsforhari (tearsforhari) said :
#27

Sorry Manfred: "system name" is one word. I just hand typed it incorrectly the second time. I'm working on a building a second Ubuntu box to test the command resize2fs. Best I understand, expanding a partition can be done online (or while booted) using those commands or a third party software GParted; only shrinking requires Ubuntu to be shut down (offline) and GParted.

As an aside, I would like to become familiar with GParted and the resize2fs command. I fished around for GParted in the LiveCD (or the Desktop Version of Ubuntu 12.04.5 booted from CD). I am not sure how to access GParted. I know it is installed because when I searched for it in the Software Center, it said it was already installed. I was looking for an icon to start the program. Perhaps I should have just type gparted or something similar at the command prompt. Alternatively, I could just download GParted by itself from its website on put it on CD.

Revision history for this message
Launchpad Janitor (janitor) said :
#28

This question was expired because it remained in the 'Open' state without activity for the last 15 days.