LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-25-2003, 11:42 PM   #1
ALF
Member
 
Registered: Oct 2002
Posts: 32

Rep: Reputation: 15
Moving Disk Space in Linux


Hi,

I have the /usr and /var directories almost full, but the root directory / is only 34% full. What is the best way to move the extra space in the root / directory for /usr and /home directories?

Alf
 
Old 11-26-2003, 12:11 AM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Are those directories on separate partitions? If so, you can't really "move" empty space to another partition; you can resize partitions using programs like parted, but that can be somewhat dangerous, since data may get lost.

One easier solution (or hack) I can think of right now is to find some part of /usr or /var that is especially full, and move it to another directory mounted on the root / partition, and then use a symbolic link to it. For example, if /usr/local is pretty big, you could do this (as root):

mkdir /usrlocal
cp -R /usr/local/* /usrlocal
(if everything copied okay, then...)
rm -rf /usr/local
ln -s /usrlocal /usr/local

Then "/usr/local" will actually be a symbolic link to "/usrlocal", which is located on the root partition, and the /usr partition will have more free space.
 
Old 11-26-2003, 03:25 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,035

Rep: Reputation: Disabled
You also might want to look into the use of LVM (logical volume manager), which is included e.g. in the SuSE distributions (>= 8.1 at least).

Hint: please use the user profile facility of this site, it is easier to answer when one knows with what distribution etc. you do work.
 
Old 11-26-2003, 08:53 PM   #4
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
/usr is mounted on a partition under / in a folder called usr

All you need to do is unmount /usr and remount it somewhere else, then move all of the files in the new mount to /usr if it fits. Then edit the /etc/fstab file to remove /usr
Code:
mount | grep /usr
/dev/hd?? /usr

mkdir /usrtmp
umount /usr
mount /dev/hd?? /usrtmp
cd /usrtmp

tar -c . | ( cd /usr; tar -x )
Now the contents of the old /usr partition is in /usr on the / partition

remove the /usr line from /etc/fstab

check that all is ok. Then you can umount /usrtmp and rm /usrtmp and do what you want with the partition.

Last edited by DavidPhillips; 11-26-2003 at 08:55 PM.
 
Old 11-27-2003, 12:27 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,035

Rep: Reputation: Disabled
Try as I might, I fail to understand your reasoning. Why don't you simply copy/move the files from the /usr partition to the /usr directory under / (or tar them, if that retains the symlinks correctly -- as an aside, tar works recursively, I presume)?
 
Old 11-27-2003, 05:45 AM   #6
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
Right, that's what it's doing, moving the files to /usr. No big deal.

You just need to remount the partition off of the /usr folder first because cp /usr /usr will not work well. There are a number of ways to do the same thing as long as the files get put in the /usr folder.

This will free the old /usr partition where it can be used for something else. Since /usr will not fit without consuming it maybe something else can go there, or it could be combined with the /home partition if it's adjacent and there is enough room somewhere to get it all moved over so the new partition can be created.



The other post is doing the same thing, however to put the files in /usr not a linked folder you would need to move them twice. By remounting you can put them where they go by moving once.


Last edited by DavidPhillips; 11-27-2003 at 04:46 PM.
 
Old 11-27-2003, 06:19 AM   #7
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,035

Rep: Reputation: Disabled
I see. Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to increase the hard disk space of linux? hari78 Linux - Newbie 5 03-01-2005 05:09 AM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 03:58 PM
Adding more disk space in Linux mkrishnanand Linux - General 1 06-19-2004 02:37 PM
moving space in harddrive from windows to linux SuSE_User Linux - Software 2 02-21-2004 07:39 PM
Cant boot linux, out of disk space fooooo Linux - General 1 05-25-2001 05:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:24 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration