Linux - DistributionsThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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!
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.
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.
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.
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!
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.
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....
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!
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.