Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mount /usr on new partition?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
R List
n00b
n00b


Joined: 16 Sep 2004
Posts: 6

PostPosted: Thu Sep 16, 2004 12:02 pm    Post subject: Mount /usr on new partition? Reply with quote

Hi, new user here.

This is more of a general question: I tried out Gentoo and other distros. Thus I have some 4Gb partitions on my disk. I have settled on Gentoo now as my everyday distro, however I foresee problems with diskspace and I don't want to reinstall all the stuff.

My question: Can I create a new file system on one of the other partitions and copy everything under (gentoo)-/usr to that partition (cp -r *) , remove everything under the old /usr and automount the new partition as /usr ?

It seems logical to me but will I screw up something, e.g. file permissions etc?

Thanks in advance
Back to top
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Thu Sep 16, 2004 12:10 pm    Post subject: Reply with quote

You can, just use your cp flags carefully to make sure you keep the right permissions. Also before you empty the /usr dir you can mount the new one over it and check if everything still works. Then when you are possitive it works unmount your new usr and emty the old one + remount the new one (it might be wise to empty the old dir while booted from a livecd, but it is probably not necessarily.)
Back to top
View user's profile Send private message
TheRAt
Veteran
Veteran


Joined: 03 Jun 2002
Posts: 1580

PostPosted: Thu Sep 16, 2004 12:12 pm    Post subject: Reply with quote

I would suggest using tar for the job. Something like:
Code:
mkdir /target
mount /dev/<device> /target
cd /usr
tar cf - * | ( cd /target; tar xfp -)

_________________
All reality is the construct of the observer.

Get Firefox and rediscover the web!

BOFH Excuse #295:
The Token fell out of the ring. Call us when you find it.
Back to top
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Thu Sep 16, 2004 12:48 pm    Post subject: Reply with quote

I'm sorry, but why use tar?? It serves no purpose at all in this case except to use cpu cycles..
Just copy with the -rp flag and permissions should be kept ->
Code:
mkdir /mnt/temp
mount /dev/<newusr> /mnt/temp
cp -rp /usr/* /mnt/temp/
umount /mnt/temp
mount /dev/<newusr> /usr
Back to top
View user's profile Send private message
R List
n00b
n00b


Joined: 16 Sep 2004
Posts: 6

PostPosted: Thu Sep 16, 2004 10:17 pm    Post subject: Reply with quote

OK, I did a copy with the arguments -rpP and it seems to work this far (but the call is still out on that...)

But I did something potentially stupid and am now confused: After having copied /usr to another partition I edited /etc/fstab and moreover renamed the old /usr to /usrOLD to have as backup if anything went wrong. I then was unsure what would happen if I rebooted in an orderly fashion and instead of doing that, by heavenly inspiration, pressed the reboot button. Then when the system is up I have no /usrOLD (filesystem is ext2) . There is now a discrepancy between what du and df says:

du says the old partition (i.e. except for /usr) uses 500M out of 4G and /usr (the new partition) uses 1,6G

df says old partition uses 2,1G (which happens to equal 1,6G + 500M) and the new 1,6G.

So, to me it seems df and du gives contradictory answers. Am I interpreting them incorrectly or is the filesystem screwed up? Is /usrOLD which dissappeared when I rebooted taking up space which only shows up in df but not in du???? I find it hard to believe that df would include the space used by /usr for the old filesystem ( = / )

I am confused. fsck didn't show anything.
Back to top
View user's profile Send private message
TheRAt
Veteran
Veteran


Joined: 03 Jun 2002
Posts: 1580

PostPosted: Thu Sep 16, 2004 10:32 pm    Post subject: Reply with quote

When you altered the fstab entry, did you create a /usrOLD dir ??

This will be required for it to mount correctly...
_________________
All reality is the construct of the observer.

Get Firefox and rediscover the web!

BOFH Excuse #295:
The Token fell out of the ring. Call us when you find it.
Back to top
View user's profile Send private message
R List
n00b
n00b


Joined: 16 Sep 2004
Posts: 6

PostPosted: Thu Sep 16, 2004 10:52 pm    Post subject: Reply with quote

TheRAt wrote:
When you altered the fstab entry, did you create a /usrOLD dir ??

This will be required forit to mount correctly...


Eh no... ...and I don't understand why I should. This is what I did:

mke2fs /dev/hdb4
mount /dev/hdb4 /mnt/usrNEW
cp -rpP /usr/* /mnt/usrNEW
umount /mnt/usrNEW
mv /usr /usrOLD

Then in fstab I put:

/dev/hdb3 / ext2 noauto,noatime 0 1
/dev/hdb4 /usr ext2 defaults 0 0

followed by hard reboot.

Since everything was on one partition (dev/hdb3) before I figured usrOLD would be "just another directory" now and I don't see why I should have to mount it? If there is something I don't understand that is probably a good thing since it indicates a solution is possible

:)
Back to top
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Fri Sep 17, 2004 8:14 am    Post subject: Reply with quote

well I think the move to usrOld somehow didn't work. This means that the new partition is mounted over the old dir (which is like I said no problem) This means the 500 mb is still taken, but you can't access it except by umounti /usr and so can't du (therefore the discrepancy between du and df) I suggest you test it for a few days and when you decide the new usr dir works you do:
Code:
umount /usr
rm -rf /usr/* (I would first doublecheck ofcourz that it's really umounted)
mount /usr
Back to top
View user's profile Send private message
R List
n00b
n00b


Joined: 16 Sep 2004
Posts: 6

PostPosted: Fri Sep 17, 2004 9:16 am    Post subject: Reply with quote

BlackEdder wrote:
well I think the move to usrOld somehow didn't work. This means that the new partition is mounted over the old dir (which is like I said no problem) This means the 500 mb is still taken, but you can't access it except by umounti /usr and so can't du (therefore the discrepancy between du and df) I suggest you test it for a few days and when you decide the new usr dir works you do:
Code:
umount /usr
rm -rf /usr/* (I would first doublecheck ofcourz that it's really umounted)
mount /usr


That sounds reasonable. Thanks for your time.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum