Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am running Ubuntu 11.04. During installation, instead of /usr, I mistakenly assigned /usr/local to a separate partition. Now I want to change the mount point to default to /usr on boot but I don't want to go through the pain of installing Ubuntu again.

share|improve this question
add comment

1 Answer 1

So, if I follow you correctly, you have two partitions (I'm going to call them /dev/sda1 and /dev/sda2, but the names don't matter). The partition /dev/sda1 is now mounted at /, and the partition /dev/sda2 is now mounted at /usr/local. Furthermore, on the filesystem on /dev/sda2, the files are the ones that should be under /usr/local, while other files that should be under /usr are now on /dev/sda1.

First, you need to move all the files that are on the wrong partition. The easiest way to do that would be to boot from a live CD or USB, mount both filesystems, and perform the move. Assuming the filesystems are mounted at /media/sda1 and /media/sda2:

mv /media/sda2/* /media/sda1/usr/local/
mv /media/sda1/usr/* /media/sda2/

Then edit /etc/fstab to change the mount point. That is, there is currently a line with something like

UUID=1234...  /usr/local  ext4  errors=remount-ro  0 1

Change the /usr/local part to /usr. Now reboot to your new system.

share|improve this answer
    
/dev/pv/usr in while other files that should be under /usr are now on /dev/pv/usr should be /dev/pv/root/usr –  Deepak Mittal Jun 4 '11 at 11:19
    
@dpacmittal: /dev/pv/root/usr wouldn't make sense: /dev/pv/root is the device, not a directory. Mmm, maybe it's confusing that I used names for the devices, I'll change that to numbers. –  Gilles Jun 4 '11 at 11:26
    
Also moving between different filesystem takes lot of times compared to moving within same filesystem. So mkdir /media/usr/local && mv /media/usr/* /media/usr/local/, mv /media/root/usr/* /media/usr/ would be a better option. No? –  Deepak Mittal Jun 4 '11 at 11:28
    
@dpacmittal: Yes, but it's more complicated, and on a recently installed system, there's probably not much in /usr/local yet. –  Gilles Jun 4 '11 at 11:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.