LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-01-2011, 09:44 AM   #1
Learnix
Member
 
Registered: Jan 2011
Location: Montreal,Qc,Canada
Distribution: Debian/GNU
Posts: 34

Rep: Reputation: 0
Moving /usr from '/' on sda1 to sda7 -- System is Debian Squeeze: sda7 doesn't mount


First you are asking why do such a thing:
I am running a Postgres server and after I did the whole installation I realized the Postgres data was set in /usr/pgsql/data. Sda1 is just 10 Gig so I decided to re-organize the partitions to be able to move /usr to say /dev/sda7 with a mount point as /usr.
The / partition is on the only primary partition and the rest is on an extended partition.
When I tried to resize the primary partition GParted did not give me that possibilty so I decided to move /usr

Original partitions:
sda1 / 10 G on primary partition this includes /usr /var and all others
sda5 swap 2 G on extended partition
sda6 /home 140 G on extended partition

So I did create another partition using Knoppix and Gparted the disk:here is the new picture:

sda1 / 10 G on primary partition this includes /usr /var and all others
sda7 40 G new partition for /usr
sda5 swap 2 G on extended partition
sda6 /home 100 G on extended partition

Here is the fstab file:

proc /proc proc defaults 0 0

# / was on /dev/sda1 during installation
UUID=3c.........bla bla bla ....xxx / ext4 errors= remount -ro 0 1

# /home was on /dev/sda6 during installation
UUID=98.........bla bla bla ....xxx /home ext4 defaults 0 2

# I added this line
/dev/sda7 /usr ext4 defaults 0 3

# swap was on /dev/sda5 during installation
UUID=84..... bla bla bla ....xxx none sw 0 0

# I didn't touch the 2 next lines
/dev/scd0 /media/cdrom0 .............................
/dev/fd0 /media/floppy ............................

# And my backup disk device where I have a full system backup
/dev/sb1 /media/Image ext4 defaults 0 4

# End of the fstab file _________________________________________________

I did rsync to copy all the file to /dev/sda7/usr and then mv /dev/sda7/usr* /dev/sda7
I stop the postgres database and services then I mv /dev/sda1/usr to dev/sda1/poufusr .

When I rebooted it reports errors from kbd files on /etc File not found.
It brings me to a terminal (No GUI)
I did a check with :#mount: nothing is reported about sda7

What am I missing ?
 
Old 04-01-2011, 11:15 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,297

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
If you put the files in sda7/usr, and mounted sda7 on /usr, my friend, the files are actually in /usr/usr :-//.

Solution: as root
cd /usr/usr

check to see files are there, and do
mv * ../
mv .* ../ (Just in case)
cd ..
rmdir usr/ (not rmdir /usr).
Then reboot to stand things up normally.
 
Old 04-01-2011, 12:10 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Quote:
check to see files are there, and do
mv * ../
mv .* ../ (Just in case)
cd ..
rmdir usr/ (not rmdir /usr).
Then reboot to stand things up normally.
That will get the files where they belong in /usr under /. To move the files to /dev/sda7 mounted at /usr (as shown in /etc/fstab), do this as root (assuming you have formatted /dev/sda7 for ext4):
1) mkdir /mnt/usr
2) mount -t ext4 /dev/sda7 /mnt/usr
3) mv /usr/* /mnt/usr
At this point, the files under /usr have been moved to /dev/sda7. /etc/fstab lists /dev/sda7 with mount /usr. Leave empty /usr directory in place (it's now the mount point for /dev/sda7).

Now reboot, and /dev/sda7 should mount normally.

Last edited by bigrigdriver; 04-01-2011 at 12:11 PM.
 
Old 04-04-2011, 10:23 AM   #4
Learnix
Member
 
Registered: Jan 2011
Location: Montreal,Qc,Canada
Distribution: Debian/GNU
Posts: 34

Original Poster
Rep: Reputation: 0
Thanks Business Kid but I knew it and I took care of it before going further. This was indeed an easy one to miss , good advice !

Thanks BigRigDriver: your post was more than clear and I got it done like it is suppose to be.

Last question:

Should I remove the folder /mnt/sda7/ (Just the sda7 portion of it )

Thanks a lot to both of you , that was much appreciated.

Cheers,
 
Old 04-04-2011, 01:32 PM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Sure, you can remove it. It was just a temporary mount point to use in mounting the new partition so that you could move the files into it. The new partition is now mounted via fstab. I suppose it would have helped if I had given a few comments in re the reasons for the commands along with the commands themselves.

If future, when you have a Linux/Unix related question, try www.google.com/linux first. It's a google search filter that filters 99.9% of unrelated hits. There are similar filters for microsoft and macos systems. You may find your answer sooner that you would by waiting for an answer here.

If you still can't resolve a problem, then post it here.

Good Luck and enjoy Linux.
 
Old 04-11-2011, 08:32 AM   #6
Learnix
Member
 
Registered: Jan 2011
Location: Montreal,Qc,Canada
Distribution: Debian/GNU
Posts: 34

Original Poster
Rep: Reputation: 0
Thanks for the google idea. I often use it and try to post the key words in the search line. I will defenitely try www.google.com/linux next time.

End of the story I succeeded to move /usr like expected as you may know. I have to say at some point I dropped the whole /usr folder by accident. Wasn't I happy that I have done a backup on a hard drive of my system before. That was a life saver.

Thanks again, very much appreciated !
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian puts the squeeze on me: /usr filled up! jamesac Debian 4 02-08-2011 11:51 PM
[SOLVED] mounting hda5 and sda7 is not working at same time Prashant19_s Linux - General 6 09-28-2010 02:13 AM
how to remove disk space in /dev/sda8 to increase the /dev/sda7 centguy Linux - Software 16 11-27-2008 06:05 PM
ALERT! /dev/sda7 does not exist. Dropping to shell! eye2eye Ubuntu 2 07-31-2007 10:42 AM
root=/dev/sda7 winxshadi76 Linux - Hardware 0 12-10-2004 03:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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