You are not logged in.

#1 2009-02-04 12:13:05

ftornay
Member
Registered: 2008-11-03
Posts: 20

[Solved] Moving /usr to new partition

I've been trying to move /usr to a new disk. I did this:

rsync -a /usr /usr /new_disk

changed fstab so the new disk was mounted as /usr

telinit 1

mv /usr /oldusr

reboot

Now I get this error at startup:
/bin/bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

Then startup hangss with "respawing too fast" messages.

If I move back /oldusr to /usr (using knoppix) everything works fine again.

Some got an idea of what's happening?

Last edited by ftornay (2009-02-05 22:13:45)

Offline

#2 2009-02-04 12:36:09

kgas
Member
From: Qatar
Registered: 2008-11-08
Posts: 718

Re: [Solved] Moving /usr to new partition

If you are moving a directory from one location another all files permission status are to be maintained. The best way is using cpio command.
This link http://www.psychocats.net/ubuntu/separatehome will give an idea how to move your /home directory from one partition to another. In the same way you can try for your /usr directory.
Don't delete your original /usr directory unless you are satisfied with the result you want.

Offline

#3 2009-02-04 12:40:50

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

I just found a mistake I made. My rsync command copied usr to a --subdirectory-- called usr at the new disk, not its root folder.

As a matter of fact, I made a previous attempt in which usr was correctly moved. That try probably failed because I used rsync -r rather than -a (which preserves ownerships and that). I'll move usr to my new disk root directory using rsync -a and tried again.

I'll keep you posted in case someone's interested. Thank you anyway to those of you who read this and thought about it.

Offline

#4 2009-02-04 13:00:34

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

Still no luck sad

I've made sure usr was correctly copied to the new disk. I'm able to mount it as usr manually from the shell and my fstab line works without problems when I mount the disk under another name and keep my old usr.

But when I try to reboot after renaming usr and changing fstab to mount the disk as /usr I get the same libncurses error at startup.

Any pointers?

Thanks in advance

Offline

#5 2009-02-04 13:10:09

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

Thanks, kgas. I just read your post. I'll try the solution you mentioned but I'm rather sure rsync -a keeps permissions as well.

Offline

#6 2009-02-04 14:09:07

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

At this play they insist on using rsync for the task and explain why

https://help.ubuntu.com/community/Parti … ome/Moving

Since I'd like to find a convenient way of moving usr, I'm going to try the options that are suggested at this site: rsync -axS. At the same time, I've moved the fstab line that mounts /usr to just below the one that mounts / Above that which mounts /home, rather than below that. Does that make any difference?

At any right, I still don't understand why the system complains about not finding linbcurses. If it were a permission problem, shouldn't the error message state it explicitly?

Offline

#7 2009-02-04 14:33:23

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

Update:

I've done the whole process again. Now I'm pretty sure it's not a permission problem. I mounted again the disk manually as /usr (in runlevel 1), then went back to use the desktop without rebooting: everything was perfect.

Then I rebooted. I got a message about "could not unmount /usr, it's busy' or something like that before the power went off.

At the startup I still got the same message about libncurses before the process hanged, just as before. But this time I've noticed that the root gets mounted and then bash tries to read libncurses, apparently without trying to mount /usr first!!!

That could be the problem Why is that so? Is there a file that controls the startup process, mounting order, etc.? I had a look at inittab but there doesn't seem to be anything like that.

Offline

#8 2009-02-04 14:39:25

pointone
Wiki Admin
From: Waterloo, ON
Registered: 2008-02-21
Posts: 379

Re: [Solved] Moving /usr to new partition

/bin/bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

This file is likely a symlink pointing to libncurses.so; does your rsync command copy symlinks too?


M*cr*s*ft: Who needs quality when you have marketing?

Offline

#9 2009-02-04 14:59:28

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

Yes, it does. I even run a rsync -aH to copy hard links.

Offline

#10 2009-02-04 15:02:30

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

Is there a way to look for all links pointing to libncurses in the system?

Offline

#11 2009-02-04 15:19:07

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

I found a link at /lib called libncursesw.so.5  pointing at libncursesw.so.5.6 which also exists at that folder. I moved both to my home folder and replaced it with links to their /usr/lib counterparts. I'm gonna try again and see whether the error message changes.

Offline

#12 2009-02-04 15:47:18

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

I did it!

Changing the libncursesw I told you made things worse: even going back to console mode without moving /usr did not work.
So I copied the old files back to /lib and I also copied all libncurses* files from /usr to /lib

Now everything works!!!!!

It seems the startup process needs to find libncurses libraries before mounting the other filesystems.

I hope my experience can help someone in the same case because I don't think there's documentation about this, or at least it's not easy to found.

Offline

#13 2009-02-04 20:30:14

pointone
Wiki Admin
From: Waterloo, ON
Registered: 2008-02-21
Posts: 379

Re: [Solved] Moving /usr to new partition

Most people have no need to separate /usr from their root partition.

Glad you figured it out, though. Please consider marking this thread as [SOLVED].


M*cr*s*ft: Who needs quality when you have marketing?

Offline

#14 2009-02-05 22:13:11

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

Yes, I guess it's not something you do very often.

I sure would like to mark the thread as solved but I can't figure out how to do it. I'm  a newbie at the forum.
I guess I'm just too tired at this time. I'll keep trying tomorrow. Howeve, if someone could just tell me, I'd be thankful.

See you,

Offline

#15 2009-02-05 22:15:10

ftornay
Member
Registered: 2008-11-03
Posts: 20

Re: [Solved] Moving /usr to new partition

It's done! It was simple, as I said I wa just too tired (it's 23:14 pm here).

Offline

Board footer

Powered by FluxBB