LinuxQuestions.org
Visit Jeremy's Blog.
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 01-16-2010, 12:54 PM   #1
heberg21
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Rep: Reputation: 0
Changing hard drive mounts to defaults


Hello,

I am currently using Ubuntu 9.10 x86_64.

During the installation process I set the "/usr" mount point to a partition in another hard drive (/dev/sdf1). I am noticing that I am getting an increasing count of bad sectors (44 so far) in this drive and need to replace it soon. So far I have not lost any data but I would like to reset this mount point to its default place with the "/" root hard drive (/dev/sdd1). What is the easiest way of doing this without having to reinstall my OS?

Thanks!

Last edited by heberg21; 01-16-2010 at 01:03 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-16-2010, 01:11 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
You could do it as a two step process.

1) create a temporary folder in /mnt (for example: mkdir /mnt/usr). Then use cp -R or use tar to copy the contents of /usr to /mnt/usr.

2) umount /usr. After unmountint /usr, if you run 'ls /usr', you should see an empty directory(under /usr in the root directory tree). Now "mv /mnt/usr/* /usr/*" to move the contents of the temporary directory to /usr.

At this point you have copied the contents of the /usr partition to /usr under the root of the filesystem. Edit /etc/fstab to remove the reference to /usr.

You still have /usr files on the other patition, which you can now safely delete.
 
2 members found this post helpful.
Old 01-16-2010, 01:17 PM   #3
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
i think that should be done from minimal boot level, with no processes running from /usr.
 
1 members found this post helpful.
Old 01-16-2010, 04:43 PM   #4
heberg21
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Thank you very much bigrigdriver.

It worked great with your steps but had to do an additional step before step 2: I changed to supersuser with 'su' before doing the unmount (which had to be forced) so that I would not cripple myself when trying to move the files.

Last edited by heberg21; 01-16-2010 at 04:47 PM.
 
Old 01-17-2010, 07:55 AM   #5
heberg21
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Original Poster
Rep: Reputation: 0
By the way in case anyone out there finds this thread looking for the same solution:

The exact 'cp' command referenced to above is as follows (this needs to done like this in order to preserve all file permissions, attributes, etc.):

(the -v (verbose mode, to show you what's going on) is optional)
(the asterisk at the end is to copy the contents and not the directory)

# cp -v -r --preserve=all /path_to_source_directory/* /path_to_destination_directory

For changing to superuser, (if the root password is not set, it can be set by running this command: 'sudo passwd'):

$ su

For unmounting (the -l is to force the unmount):

# umount -l /name_of_mount

Last edited by heberg21; 01-17-2010 at 10:43 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Hard drive mounts r/w but after a while is r only RayNowers Linux - Newbie 1 06-11-2008 05:05 AM
uSB External Hard Drive Mounts Very Slowly rahulthewall3000 Linux - Hardware 0 01-20-2008 05:37 AM
USB hard drive mounts as "Read Only Filesystem" augu2000 Linux - Hardware 11 07-12-2007 10:37 AM
Repartition Hard Drive Mounts atomicx Linux - General 4 06-02-2006 03:55 PM
Changing Hard drive from one machine to another afubini Linux - Hardware 3 10-30-2003 03:41 AM

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

All times are GMT -5. The time now is 04:38 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