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.

Linux, Debian.

Now I have:

/dev/sda5   on /
/dev/sda6   on /home
/dev/sda7   on /usr

I would like to use sda6 to hold /usr, then free /dev/sda7 for other use.

What is the safest way to do this? I am confused about how to create a /usr on /dev/sda6 and issue copy command without confusing Linux.

share|improve this question
    
yes you can move it to any partitions and it will get work –  Infected Root Feb 25 at 6:11
    
Do you have enough free space on /dev/sda6 to hold all the data from both /home and /usr? –  Teddy Feb 25 at 6:29
    
@Teddy yes,it does have enough. –  BufBills Feb 25 at 6:42

1 Answer 1

I can see no good way for two subdirectories to share a partition, except for using a symbolic link:

  1. Boot in single-user mode so no processes are running.

  2. Copy everything from /usr into /home

    cp --archive --sparse=always --one-file-system /usr /home
    
  3. Unmount /usr, remove the empty mount point and make a symlink

    umount /usr
    
    rmdir /usr
    
    ln --symbolic /home/usr /
    
  4. Edit /etc/fstab and remove (or comment out) the line with the /usr mount.

    sensible-editor /etc/fstab
    
  5. Reboot

share|improve this answer
    
have you tested this ? –  Rahul Patil Feb 25 at 7:52
    
I see a way. mount sda6 onto the root namespace, then mount sda5 on top of that. have fun configuring the initrd for that, though. –  strugee Feb 25 at 7:55
    
@RahulPatil No. –  Teddy Mar 10 at 3:03

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.