LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 05-16-2011, 01:29 PM   #1
franklin.sucre
LQ Newbie
 
Registered: Nov 2010
Location: vadgaon
Posts: 12

Rep: Reputation: 0
increase size how?


Dear all,

My root partition is almost FULL now and its getting problemsome now. SO i need to increase the size of root partition. Can anyone suggest me in doing so without affecting any running programs. I have sufficient disk partitions remained. CentOS platform is being used.

Expecting quick response.


Regards,
Franklin
 
Old 05-16-2011, 02:02 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi there,

Let us know if your root partition is an lvm partition or basic partition.

Also put the output of the following commands:

df -h
mount
vgdisplay
lvdisplay
pvdisplay
 
Old 05-16-2011, 02:03 PM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If you're on a "partition" you won't be able to increase the size of the parition without shutting things down. Also if there are other partitions on the same drive beyond your root partition then you'd have to move them after the resize anyway.

What you might consider instead of resizing root itself is finding things that are in root that could be separate filesystems. Many users initially create most of their space as the root filesystem instead of laying out things like /var, /usr, /opt, /tmp and others as separate filesystems. Of course this usually means you've also used up all the space on the drive so you can't resize anything anyway.

You need to provide some output. Let's start with df -h so we can see what your filesystems look like:
df -h

If root is showing it is on something like /dev/sda2 then also providing output of "fdisk -l /dev/sda" would be helpful.

Of course its always possible you misspoke and your root filesystem is a software RAID or LVM device in which case the advice becomes different. That's why you need to provide your df -h output.

You should also specify the distribution and version of Linux you are using.

P.S. "expecting quick response", "please help" and other similar phrases are unnecessary and will actually cause many folks NOT to help you. Remember this is a forum designed for helping but the folks helping you are VOLUNTEERING to do it rather than being paid by you.
 
Old 05-16-2011, 02:06 PM   #4
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
If you have extra space you can resize the root-partition.
Of course there's a risk in this, so here are some other ideas:

1) Make a partition in free space or use an existing unused
Check what directories needs most space - use GUI-tool if you like or in terminal like: "#du -sh /usr" (Probably /usr or /var are the biggest.)
a) Mount this partition somewhere temporary (example here: /mnt/temp), then copy from (eg) /var to /mnt/temp
b) Unmount the partition /mnt/temp, mount it on /var (or what dir you chosed to copy).
Use your computer, check that it works.
c) Edit /etc/fstab to mount this partition on /var. Reboot.
If everything works (which it should) comment out that line and reboot in single mode (or boot to normal, as root change runlevel with "init 1"
d) Delete /var (the partition you copied - no mistakes here please!)

Another possibility is to use a partiton already created or create a new partition bigger than your root-partition today, and use that for your new / .
Copy everything from root-partition except /dev & /proc to new partition.
Edit /etc/fstab in new partition & also edit your grub.conf.
Take care here so you don't loose your grub!
I'm a bit tired tonight, can't give you all details. Just *think* before you delete anything!

None of these suggestions are really complicated, just take care, think & read & don't do anything hasty and you'll be fine.

If you need more advice I'll be back tomorrow - or a bunch of other people are already here for you!
 
Old 05-16-2011, 06:40 PM   #5
franklin.sucre
LQ Newbie
 
Registered: Nov 2010
Location: vadgaon
Posts: 12

Original Poster
Rep: Reputation: 0
My file system structure is as follows:

#df -h

Filesystem Size Used Avail Use% Mounted on
/dev/hda6 4.8G 4.5G 56M 99% /
/dev/hda5 4.8G 1.2G 3.3G 27% /home
/dev/hda3 4.8G 3.9G 656M 86% /usr
/dev/hda1 479M 27M 428M 6% /boot
tmpfs 759M 0 759M 0% /dev/shm

#fdsik -l

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 63 506016 83 Linux
/dev/hda2 64 193 1044225 82 Linux swap / Solaris
/dev/hda3 194 830 5116702+ 83 Linux
/dev/hda4 831 19457 149621377+ 5 Extended
/dev/hda5 831 1467 5116671 83 Linux
/dev/hda6 1468 2104 5116671 83 Linux
/dev/hda7 2105 2227 987966 82 Linux swap / Solaris
/dev/hda8 2228 7091 39070048+ 83 Linux

#mount


/dev/hda6 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda5 on /home type ext3 (rw)
/dev/hda3 on /usr type ext3 (rw)
/dev/hda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

And i have defined no volume groups.

This is the file system structure of my machine. Suggest kindly.

Thank You T3RM1NVT0R, and i have shown you some information that you needed.

Thanks Mensawater, and i am sorry for using such words, but understand like i am in big problem. and i am really hurried.

And pingu, i think it wont imply on root file system.

Regards,
Franklin
 
Old 05-16-2011, 06:59 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
So your /-filesystem is 4.5 GB in size, although you have separate /home- and /usr-partitions. That is rather strange. You really should find out what is taking so much space, you can use the du-command for that.
cd to your /-directory, then issue
Code:
du -h --max-depth=1
This will show you the size of the folders in your root system. Ignore the /home and /usr and cd into the largest directory. Then repeat the du and cd commands until you find the space hog. Post back what you find.
 
Old 05-17-2011, 03:20 AM   #7
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Just an addition to what TobiSGD has mentioned

run the command as : du -h --max-depth=1 / (You might have to hit ctrl+c to stop once it reach /proc as it will not be able to read information from there being virtual file system.)

If you do not put the / at the end then it will show you the directory size listing under which you ran the command

As from the output you have given /usr and /home is mounting as a separate partition so the only places where we can look for freeing up the space I suppose is /var where the log files are located as well as it may contain you site data if you are running a small site. Also you can look under /tmp to see if you can clear up the things in there.

If you want to retain your previous log files then I would say create a new partition and move the old logs or var/crash/kdump file (if any) to that newly created partition.

As you cannot mount the newly created partition on the directory that is not empty otherwise the previous data will be inaccessible. Another approach can be of moving the files from /var to another temp location. Once the directory is empty. Create a partition and assign it to /var and then copy over the files from temp location back to /var

I hope this helps.

Last edited by T3RM1NVT0R; 05-17-2011 at 03:22 AM.
 
Old 05-17-2011, 03:28 AM   #8
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
You have almost 40GB on /dev/sda8, a partition not mounted in your system.
If this partition is unused, I suggest you delete it and then create a new partition for /
Then copy your system - easiest might be from live-cd, but you can do it from your running CentOS. Decide whether you want to copy your /usr too or leave it on own partition.
I've done this a copule of times (last week actually, on a remote server. Copied / and rebooted to new without physical access.)
If you do it from runnig CentOS, easiest is to create a small script:
Mount /dev/sda8 somewhere. like /mnt/temp
Pipe output of "ls /" to file, add "cp -a /" before each directory, " /mnt/tf/ after (easily done in GUI-editor w mouse middleclick)
Might want to move /proc /dev /media /mnt /home /boot (/usr) to end of file first, little easier to make sure you copy correct directories
For these directories, don't copy just create them: add "mkdir /mnt/tf/" before
Then edit /boot/grub/menu.lst & /mnt/tf/etc/fstab and set /dev/sda8 as new /.
Reboot.
Done!
 
Old 05-17-2011, 04:38 AM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by T3RM1NVT0R View Post
If you do not put the / at the end then it will show you the directory size listing under which you ran the command
This is exactly what I intended. Therefore I wrote that the OP should cd to / first. The command I gave works in any directory, while your command every time shows the sizes in /, regardless which directory the OP is in.
 
Old 05-17-2011, 01:24 PM   #10
franklin.sucre
LQ Newbie
 
Registered: Nov 2010
Location: vadgaon
Posts: 12

Original Poster
Rep: Reputation: 0
My further details are:

############################################################################
#pwd
/var
# du -h
...
....
.....
20M ./spool
16K ./empty/sshd/etc
24K ./empty/sshd
32K ./empty
3.0G .
[...var]#

/var/tmp is empty

############################################################################

[/var/log]# du -h
19M ./audit
4.0K ./nagios/rw
344K ./nagios/archives
1.3M ./nagios
8.0K ./conman.old
28K ./gdm
8.0K ./news/OLD
28K ./news
12K ./cups
12K ./clamav
12K ./pm
8.0K ./ppp
8.0K ./squid
8.0K ./conman
8.0K ./vbox
40K ./prelink
16K ./mail
1.1M ./test
8.0K ./samba
2.8G .
[/var/log]#

############################################################################

I have updated clam too and scanned the report of clamscan is as follows:

----------- SCAN SUMMARY -----------
Known viruses: 963507
Engine version: 0.97
Scanned directories: 11776
Scanned files: 232153
Infected files: 0
Total errors: 520
Data scanned: 3239.79 MB
Data read: 5740.88 MB (ratio 0.56:1)
Time: 2655.847 sec (44 m 15 s)
You have new mail in /var/spool/mail/root
[/]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 4.8G 4.5G 23M 100% / ------------> BIG PROBLEM
/dev/hda5 4.8G 1.2G 3.3G 27% /home
/dev/hda3 4.8G 3.7G 891M 81% /usr
/dev/hda1 479M 27M 428M 6% /boot
tmpfs 696M 0 696M 0% /dev/shm
[/]#

############################################################################

[/]# du -h --max-depth=1
0 ./sys
336K ./opt
7.5M ./bin
116K ./dev
0 ./net
3.0G ./var
47M ./root
0 ./proc
8.0K ./mnt
0 ./misc
33M ./sbin
8.0K ./selinux
164M ./etc
1.1G ./home
177M ./lib
17M ./boot
8.0K ./media
24K ./tmp
16K ./lost+found
3.8G ./usr
8.0K ./srv
40K ./share
4.0K ./images
9.2G .
[/]#

############################################################################

[/]# du -h --max-depth=1 /
0 /sys
336K /opt
7.5M /bin
116K /dev
0 /net
3.0G /var
47M /root
0 /proc
8.0K /mnt
0 /misc
33M /sbin
8.0K /selinux
164M /etc
Segmentation fault
You have new mail in /var/spool/mail/root
[/]#

##############################################################

Dear pingu,

The partition /dev/hda8 is just created for test to backup data which is yet to be done and its can be deleted, no problem and i still have sufficient space in my hard drive as raw file .system. and i am still unable to back up /var to, everytime it says like device or resource busy though i umount it after copying all hardlink, softlinks and files.

Really thanks, i am gathering new new ideas here.

and T3RM1NVT0R, thanks again for your support. I still look forward from you.


Besides, it is really being difficult for me to backup the data from / root partition after creating new partition too. Can anyone suggest me in details....


Regards,
Franklin
 
Old 05-17-2011, 01:46 PM   #11
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
With root filesystem filled up to 100% you have, as you say, a BIG problem! Things that normally works might not work now. If you have an ext# filesystem (which I believe you do) then standard is that a few percent is reserved for root (look at the numbers for /dev/hda6). That's your only hope now, don't fill that up doing things as root!
I suggest you look at /var/cache - specially /var/cache/yum/
This is a directory that holds packages you install. It is completely risk-free to delete the contents of this directory & subdirs - but don't delete any directory only files!
 
Old 05-17-2011, 01:48 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You have 3GB in /var. Anywhere in there is a big file. Search for it.
 
Old 05-17-2011, 02:16 PM   #13
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

@ Franklin

Hi Franklin,

As we can see /var is taking 3 GB of space. You can have a look at the following locations and if there are any big files or data that is taking up space:

/var/crash
/var/www/ if you have configured httpd on your server.

@ TobiSGD

Hi TobiSGD,


Quote:
This is exactly what I intended. Therefore I wrote that the OP should cd to / first. The command I gave works in any directory, while your command every time shows the sizes in /, regardless which directory the OP is in.
That is the reason I said in addition. I was just trying to say that it does not matter from where you run the command the only thing you need to put is the location on which you want to run the command. Say: du -h --max-depth=1 /var or du -h --max-depth=1 /tmp
 
Old 05-17-2011, 02:19 PM   #14
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You are right. I make it easier for me and always install ncdu on my systems, much more comfortable. But since the OP has a problem with size I didn't want to recommend an installation of an additional program.
 
Old 05-17-2011, 06:37 PM   #15
franklin.sucre
LQ Newbie
 
Registered: Nov 2010
Location: vadgaon
Posts: 12

Original Poster
Rep: Reputation: 0
[yum]# du -h
4.0K ./rpmforge/packages
33M ./rpmforge
12K ./updates/packages
2.0M ./updates
4.0K ./opsview/packages
84K ./opsview
4.0K ./addons/packages
40K ./addons
12K ./base/packages
8.4M ./base
4.0K ./extras/packages
852K ./extras
44M .

It seeems only 44M is here and rest of the place are almost of similar sizes. But at /var/log one of the file named bandwidth is 2.8 gbs

-rw------- 1 root root 2.8G May 18 05:20 bandwidth

Can this file be deleted? This is the only file occupying huge size of root partition.

Regards,
Franklin
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
increase the size of a file? Gibzon Linux - General 2 12-01-2010 04:25 AM
How to Increase swap size ramesh14 Linux - Software 10 03-29-2010 12:01 AM
Increase Partition Size shifflav Linux - Newbie 5 02-26-2009 09:09 PM
How do I increase the size of fonts in X gianh Linux - Newbie 2 03-08-2004 09:02 PM
increase point size size when printing PDF files newlin Red Hat 0 09-27-2003 07:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 11:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration