Hey Kapil,

On Saturday 09 Apr 2005 11:18 am, Kapil D. Pendse wrote:
> Hello PLUG!
>
> Currently, I don't have /usr on a separate partition. My / partition is 5GB
> and almost full. I want to move /usr (which sums up to 3.6 GB of my /
> partition) to a separate partition. It is safe?
Of course it is safe. If you are just a bit careful that's all.

> Well, I know that playing 
> with partitions is never really safe, but are there issues with moving /usr
> to a separate partition because of which it should be
> avoided/NOT-DONE-AT-ALL? All I need is more space in order to install new
> software. Is there any better way I can achieve this? Maybe moving /opt to
> a different partition?
This is such a common thing that there is a entry for this sort of thing the 
the Tips and Tricks HOWTO ...dunno if that document is actively maintained 
tho' ...google for it.

The important thing while moving files from one partititon to another is:
a) Take care not to screw up the permissions/ownership info
b) Make sure that you have a valid entry in your fstab to point to the new 
location once the move is done.

Here's how you might want to go about it:
> Here's output of 'df':
>
> kapil:/home/TTux/downloads/bsnldataone/monitoring-software # df
> Filesystem           1K-blocks   Used                 Available       Use%    
> Mounted on
> /dev/sda5              5124508   5041392      83116   99%             /
> tmpfs                   249500     24                 249476          1%      
>         /dev/shm
> /dev/sda6             22932052  20692264      2239788         91%             
> /data1
> /dev/sda7             22624584  13647516      8977068         61%             
> /data2
> /dev/sda8              4096408   1063144      3033264         26%             
> /home
> /dev/sda1              4874192   4389580      484612          91%             
> /windows
> /dev/sda4             12662896  11919416      743480          95%             
> /data3
> /dev/sda3              5194468   3345220      1585384         68%             
> /dis2

(boy are you out of space !! you ought to take backups/get a new disk)

a) Assuming that you want to move your entire '/usr' directory to the 
partition that currently is mounted at /dis2, do the following (as root):


$ (cd /usr && tar -cvf - . ) | (cd /dis2 && tar -xvf - )

This would move all the contents of /usr to /dis2 ...so for example:

Before move:
$ ls /dis2
bar
foo
...

After move:
$ ls /dis2
bin
bar
foo
...
...
sbin
share
...

b) Once you are sure that everything looks fine (eg: do a "find /dis2") you 
can do a

$ rm [-rf] /usr/*

Be VEEEEEERY CAREFUL ..be sure you have understood what you have just done.

c) execute the commands:

umount /dis2
mount /dev/sda3 /usr


d) Then edit /etc/fstab and change the line:

/dev/sda3   .... /dis2 0 0

to

/dev/sda3   .... /usr 0 0

e) Run
$ mount -a ...and you are all done !!


HTH
Regards
Steve
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List:      (plug-mail@plug.org.in)
List Information:  http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.

Reply via email to