LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-11-2005, 05:43 PM   #1
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 54

Rep: Reputation: 15
best way to copy usr directory


I made my original /usr directory too small and it is pretty full. I managed to free some space on another drive and create a partition named /testusr that's twice as big and mount it on startup.

How would you recommend I copy /usr to /testusr and then make it so testusr is the new usr from here on out? Also, I'd like to regain the space in the now "old" usr for something else.

I tried two things:
cp -p -r /usr /testusr
-- resulted, after a long time, of /usr directory in /testusr
mount --move usr testusr
-- worked, but upon rebooting testusr was empty again

I'm sure the cp may be the way to go (WITH SOME MANIPULATION), and then going with a change to /etc/fstab afterwards, but I wanted to know if there was a foolproof way of doing this.

Regards,
Kurt
 
Old 12-11-2005, 06:34 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
I think you should be able to resize the /usr partition with parted. If it's not the last partion you would first use parted to move it to the end, then resize. You'll then have a "hole" that you can add to other partions by resizing them.

I'm not really sure why the cp didn't work. Maybe it should have been
cp -pr /usr/* /testusr/

Someone who knows what they're talking about should correct me if I'm wrong...
 
Old 12-11-2005, 06:39 PM   #3
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
You are on the right track there. This is my way.

Mount the new partition like /testusr
Copy the contents of /usr to /testusr
Drop to single user mode with the ' init 1 ' command
Unmount /usr and /testusr
remount new partition as /usr
Edit /etc/fstab and change /dev/hd** to correct partitions.
Reboot.

Brian1
 
Old 12-11-2005, 07:18 PM   #4
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks,
I would have never guessed going to init 1. For my edification, what's the purpose of that part. I tried it first by just editing fstab and rebooting, and that did not work.
Worked like a charm.
Kurt
 
Old 12-12-2005, 06:47 PM   #5
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
init is a command to change runlevel. Linux has multiple runlevels from startup to shutdown. When the shutdown command is issued it runs the scripts in /etc/rc6.d. Not not all distro work matching runlevel numbers. Some vary as to what each is.

This list is a few of the ones based on Redhat/Fedora or similiar. Others may vary.
runlevel 1 is basic single user mode, no networking or gui.
runlevel 3 multiuser and networking
runlevel 5 multiuser, networking, and X

Lots of info here and on the net.
Brian1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
copy /usr to another filesystem and cann't reboot system by normal user kinzlaw Red Hat 9 12-04-2005 08:34 PM
copy files from directory to directory without subfile ALInux Linux - General 2 06-03-2005 11:51 AM
/usr/bin/stat not present. Can I just copy the file mystique98ls Linux - Newbie 2 01-06-2005 02:02 PM
Installing software, /usr/lib directory and /usr/local millertime Linux - Software 2 07-10-2004 09:21 AM
can't copy folder to usr/local ontwolf Linux - Hardware 5 04-23-2004 12:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration