Link to home
Start Free TrialLog in
Avatar of s_mack
s_mack

asked on

Adding hard drive space... quick!

Hey all, I just looked at my server and saw that it is 97% full in the /home folder.

My tech guy that knows Linux is on holidays.  Can I just buy a hard drive, plug it in, and run some simple commands to make the /home folder use that new space?

It would be important that users don't have to be moved around and that I don't have to have a /home and /home2 type scenario.  I though I remember Rob (our tech) mentioning we could simply add HDD as needed.

Thanks.

 - Steven
Avatar of Arty K
Arty K
Flag of Kazakhstan image

>  Can I just buy a hard drive, plug it in, and run some simple commands to make the /home folder use that new space?
not very simple, but it's possible with a software raid.
Recommended scenario (downtime is  required):
0) Boot to singlemode
1) Make full backup
2) Turn off machine, add new drive
3) Turn on into singlemode
4) Create new software RAID device (LINEAR or 0 level,  also probably you need to repartition and create separate boot partition)
5) Create new filesystem on that new raid device, it will be your new /home partition, fix /etc/fstab entries to point to new /home device
6) Restore /home
7) Boot as always
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of s_mack
s_mack

ASKER

Do these methods result in NO changes from the user's perspective?  

I have a 320GB HD on order, hopefully it gets here before the last 3% is used up :)

 - Steven
Another quick fix to buy you a some 4-5% of space would be to use "tune2fs  -m 1"
or "tune2fs  -m 0" ro set rhe reserved space on your drive to 1% ( or 0%) if your filesystem
is ext2 or ext3 (or a corresponding tool on other filesystems).

Use with caution and only as a temporary fix - it might make yout filesystem slower when it
id filling up.

HOTWO:
as root:
unmount the /home filesystem
use "tune2fs -m 1 /dev/XXXX" (1% reserved instead of the default 5%)
remount /home



>  Do these methods result in NO changes from the user's perspective?  
yes (beside the part that the home directory is symbolic link)
Avatar of s_mack

ASKER

I just wanted to update and say ahoffmann's answer worked great, except for this line:

5) cd /newhome; (cd /home && tar cf heavy -)|tar xf -

which simply returned some error about "heavy" being a directory (of course, I changed heavy to apply to me, and of course its a directory!)

I figured it is probably a simple syntax issue, but I just used mv instead and it seemed to work.  I'm not a Linux guy at all, but I think what the line is supposed to do is "zip" (for lack of a better word) the old folder, move it to the new one, and unzip it there.  Probalby faster than mv, because mv took a long time.  I thought that perhaps "heavy" should have a trailing slash, but I don't understand enough to try monkeying around with it.

All seems to work so far, so thank!

 - Steven
damn, you're right: syntax problem, should be:

  cd /newhome; (cd /home && tar cf - heavy)|tar xf -