[SOLVED] Moving /usr from '/' on sda1 to sda7 -- System is Debian Squeeze: sda7 doesn't mount
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.