Increase size of root directory / on ubuntu

Thyagaraj03
Thyagaraj03 used Ask the Experts™
on
Is it possible to increase the size of the root directory '/' on ubuntu server?.
Please need instructions...
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
As far as I know, the root directory '/' is the entire hard disk so the answer would no except by getting a larger hard disk.  What makes you ask?
you need to provide some details, is it a logical volume? is it a straight install off cd?

can you provide the df -h?

Author

Commented:
Actually on a ubuntu server only 900MB of free space is left
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Sounds like you need a new hard drive.  What is the total size of the hard disk?

Author

Commented:
Its only 10GB and I'm not at work place to provide the output of df -h
you need to find out if you are using LVM, if it is a straight install. then see if gparted is installed, if not then install it. sudo apt-get install gparted. once installed you can change partition sizes.
either way 10gb is too small for a server

Commented:
It all depends on how it is installed and what you want to do with it.  Provide the output of

df
fdisk -l
cat /etc/fstab

Also, what services is the server providing?  (e.g. Is is just a firewall?  a web server?  a file server?)  What is taking the space?  Why do you need more space?  What are you trying to add to the server?  
If you are using LVM, simply add a raw disk and then check using fdisk -l
The new hard disk will show itself in the list... say the new disk was /dev/hdc use the command  
vgextend my_volume_group /dev/hdc
this will add the disk to your volume group....
else if the partition is not LVM.... Add a new disk to the machine... use fdisk -l to check the new disk...say it is /dev/hdc.. create a partition on the disk using fdisk /dev/hdc....use the menu of fdisk to create a partition..i.e. alphabet n...use the alphabet l ... to list the partitions.. use the alphabet w.... to write the partition to the disk and exit...then use the mkfs command to create a file system in the newly created partition...
create a mount point on any other partition other than / say /var/ndisk
mount your new partition mount /dev/hdc1 /var/ndisk
copy everything from the / folder to /var/ndisk....
After you successfully copied all the files and folders ...change the fstab entry for / to the new location /dev/hdc1....

reboot your machine....
best of luck...

Commented:
@jgiordano - It all depends on what the server is doing.  If the whole disk is only 10GB, I'd be more concerned with the age of the disk as they haven't sold any that size for years.

Commented:
@expert_tanmay - If you're going to be replacing the disk, you forgot to setup grub for the new disk.

If the OP can give a little more information, we can give better advice rather than shooting in the dark.  (e.g. It might be better to use Clonezilla to clone the whole disk and move to another, larger disk.)
Sorry I forgot to mention that by coping I mean to use partimage (http://www.partimage.org/Main_Page)

Author

Commented:
If I clone the hard disk and boot the system having connected both original and duplicate HDs,
how could I make sure that the system boots from the orginal HD every time it restarts?
Do I have multiple boot option entries at the startup?
I assume you have a /boot partition... thus when the system boots the old disk will still have the grub entry as well as correct pointer to the kernel image....
Hi @Thyagaraj03 if you are thinking there is risk though it is not in the solution above you can always do one simple thing. You can always add a new hard disk to your machine without changing any configuration of your machine...Following are the steps to add a new hard disk...
1> Attach new hard disk to your machine.
2> fdisk -l to find which drive is the new hard disk on... say /dev/hdc.
3> Create a new partition using fdisk on the new disk.
4> Create a file system on the newly created partition using mkfs..
5> Now create a mount point mkdir /ndisk..
6> Mount the new disk mount /dev/hdc1 /ndisk..
7> Now check folders which are occupying heavy disk space under / using du -h.
8> Move the contents of the entire such folders to /ndisk/foldername
9> Create a soft link at the old location of the folder to the new location using ln -s.

This solution has absolutely no risk....
Cheers  

Author

Commented:
It's one of the way to do.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial