Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Fedora 17 (rpm based) and the root is mounted on a 20G SSD. I have another big HDD which I want to use for the bin folders and user / home.

Can I re-mount all the bin folders to that disk and only contains linux clean core in the SSD? What are all the folders I have to redirect?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You don't need to redirect anything, mounting is completely transparent as far as the OS is concerned. Linux will just look for a /usr directory. If you have another partition mounted at /usr or if /usr is just a directory in your / partition makes absolutely no difference at all.

So, what you want to do is the following (as root, and assuming your partition is sda2):

  1. Mount your empty partition to a temporary location:

    mount /dev/sda2 tmpdir
    
  2. Copy your /usr folder to the new partition:

    cp -rv /usr tmpdir
    
  3. Rename /usr

    mv /usr /usr.backup
    
  4. Create a new /usr directory

    mkdir /usr
    
  5. Unmount from the temp mountpoint and mount the partition to /usr

    umount /dev/sda2
    mount /dev/sda2 /usr
    
  6. Edit /etc/fstab to make the change permanent, something like:

    /dev/sda2   /usr    ext4    rw,errors=remount-ro    0   1
    

If you want to have many, different system directories on this partition, you can use links:

  1. Mount the partition somewhere (e.g. /data)
  2. Copy the, for example, /usr and /etc folders to /data
  3. Delete the /usr and /etc directories
  4. Recreate them as links to /data

    ln -s /data/usr /usr
    ln -s /data/etc /etc
    
share|improve this answer
1  
you'll need to be sure you still have, lcoally, everything you need during boot (ie, before those partition gets mounted. And by the way, they will be mounted by 'mount', which also should be there ^^). You could have a local trimmed-down bin, and /sbin, and /lib, etc, containing just "what you need", and those get overwritten later on during the boot process with the remote /bin, etc. –  Olivier Dulac Jan 7 '13 at 17:24
1  
I want to see his face on the next boot when the first script tries to call /bin/mount ×eg× –  ott-- Jan 7 '13 at 17:37
    
I suggest not deleting the old folder. Just move it aside until you know everything works. (E.g. mv /bin /bin.backup) –  Hennes Jan 7 '13 at 17:38
    
Also, do not move /bin and /sbin. However you are free to move /usr/bin, /usr/sbin and (if they exist) /usr/local/[s]bin/ –  Hennes Jan 7 '13 at 17:39
    
Sorry sorry sorry, I had originally written the answer thinking of the /usr/bin directory and then changed to /bin to make it "clearer" not realizing that I was recommending a good way to bork the system. Thanks @OlivierDulac and @ott for pointing it out. –  terdon Jan 7 '13 at 17:44
show 12 more comments

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.