Solved

Adding hard drive space... quick!

Posted on 2006-07-06
7
352 Views
Last Modified: 2010-04-20
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
0
Comment
Question by:s_mack
7 Comments
 
LVL 27

Expert Comment

by:Nopius
ID: 17056101
>  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
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 125 total points
ID: 17056621
1) plug in the drive (proper jumperd as slave or secondary if it is IDE)
2) partition drive as you like
3) change /etc/fstab and add an entry for each partition
4) create a mount point for each partion (see 3))
5) mv your "heavy" users to new partiotion
6) delete moved users (see 5))
7) create a symbolic link for these users

example for 4) to 7) assuming a new disk hdb with only one partition and a user named heavy:

4) mkdir /newhome; mount /dev/hdb1 /newhome
5) cd /newhome; (cd /home && tar cf heavy -)|tar xf -
6) rm -rf /home/heavy
7) ln -s /newhome/heavy /home/heavy

you made a backup before starting, for sure :-))
0
 

Author Comment

by:s_mack
ID: 17062851
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
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 15

Expert Comment

by:DonConsolio
ID: 17063200
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



0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17064166
>  Do these methods result in NO changes from the user's perspective?  
yes (beside the part that the home directory is symbolic link)
0
 

Author Comment

by:s_mack
ID: 17084233
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
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17088147
damn, you're right: syntax problem, should be:

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

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to update  and reset admin password for Linux 5 55
Linux VM 6 89
AWS ELB 5 78
What is linux 4.8.22? Is it the same as ubuntu 16.10 ?? 2 40
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question