Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Google Cr-48 notebook. The SSD only has 6 gb that I am comfortable allocating to Ubuntu. I need to move /usr to an external HDD. I also will move my /Home to another partition on the drive. I am going to specify the requirements that I must meet.

  1. I CANNOT install Ubuntu again
  2. I CANNOT use LiveUSB or LiveCD or LiveDVD
  3. I CANNOT boot the entire OS from the USB Drive
  4. I CANNOT do anything that requires GRUB (GRUB IS NOT INSTALLED OR UTILIZED, TRUST ME I AM CERTAIN)
  5. I CANNOT boot into Recovery Mode (reboot recovery or pressing button as both require GRUB) at all

I want to know if it can be done and how it can be done in detail. I have tried this many times. Each time something new went wrong.

I am asking for assistance on how to do something, I don't want anyone saying "moving the /usr directory is a bad idea" or anything of that nature. If I had another option that I felt comfortable with I wouldn't be asking this question.

Any assistance that anyone could provide would be greatly appreciated. I will provide more details in the future if requested/required. I am sorry for my pessimism, but after 5 re-installs my patience grows a little thin.

Thank you!

share|improve this question
1  
Actually, it's not clear why do you think you need to move /usr from the root partition, especially if you're also moving /home. 6Gb should be enough to install the OS with all the bells and whistles. –  Sergey Sep 16 '11 at 1:02

1 Answer 1

up vote 1 down vote accepted

Please read my response to your previous question - how to recover from mounting /usr/ nosuid - moving /usr to a mounted partition is not only "a bad idea" but is going to result in silent failures unless you also modify your initrd image, because /usr is expected to be available during the early boot process before any non-root partitions are mounted.

Apart from that, there are no major problems with moving /usr - all you need to do is

  • copy files from /usr to a separate partition
  • modify /etc/fstab
  • issue mount /dev/sdb1 /usr (where /dev/sdb is your "separate partition")

That's it, you should be using the new /usr now. Note that the files in your root /usr partition are not removed - this may require some trickery because /usr unavoidably becomes unavailable for a moment, but all commands required are located in /bin so it looks like it might work. Actually, I tried mounting /usr to a separate partition on a throw-away Virtualbox instance and it worked fine:

mkdir /usr.new
mount /dev/sdb1 /usr.new
cp -rp /usr/* /usr.new/
umount /usr.new
nano /etc/fstab # added a line /dev/sdb1 /usr ext3 relatime,errors=remount-ro 0 0
mv /usr /usr.old
mkdir /usr
mount /usr
rm -rf /usr.old
sync # flush disk caches just in case it hangs up during the shutdown
reboot

And that should be it!

On my test box I found no issues with failing usev rules, but then again - it's a Virtualbox instance, YMMV.

UPDATE: I'm finding that sudo stopped working on that box, complaining on suid bit not set - this was caused by me using cp -r instead of cp -rp, as was suggested in the comments

share|improve this answer
    
I'll try this. If it works I'm making a guide for the whole world (of people with Google Cr-48 notebooks who have storage issues) –  MisterCrazy8 Sep 16 '11 at 1:07
    
I improved the recipe - this is the actual code which worked for me –  Sergey Sep 16 '11 at 2:08
    
Did you boot into recovery mode? –  MisterCrazy8 Sep 18 '11 at 14:47
    
No I didn't. In fact, even a reboot is not necessary - it starts to use the new /usr without a reboot –  Sergey Sep 18 '11 at 20:58
1  
cp -r should be cp -rp (keeps timestamps, suid bits and ownership while copying) –  aquaherd Sep 20 '11 at 21:58

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.