Profile

Cover photo
Chris Schembari
Attended Bolingbrook High School
Lives in Darien, IL USA
26 followers|2,517 views
AboutPostsPhotosVideos

Stream

Chris Schembari

Help Needed  - 
 
Hi, all,
My question is how do I move /home and /var into /usr, then link  to these folders from / to their new locations, without breaking my system and having to reinstall everything again? Can I do this only by booting into a root console, or can I do it from a logged-on system with "sudo" or "kdesudo dolphin"? Should I use hard links or soft-links? How do I make sure that each file and folder's ownership and permissions are preserved. I wouldn't want all my /usr/home files and directories to be labeled "root access only"!

I just did a fresh reinstall of Kubuntu 14.04 LTS on an old P4 (i686) desktop with a 40gb eide hdd. Space on hdd will soon be tight, and I changed my partition layout to make better use of space. I mounted /usr on a large partition separate from /, and I want to move /home and /var into /usr. PC-BSD automatically at install puts those two dirs (and maybe 1 or 2 others? don't remember) inside of /usr, so that all "the usual suspects" of storage-hogging are contained in one partition that occupies the bulk of the drive, leaving / on a small bootable partition. I think this maximizes space efficiency by allowing my userland files and my home folder to share and grow into whatever free space is left.

I manually set up the following in this install. All of the below are primary partitions:
sda1 - 7.63 GiB ext4 - / (includes everything but /usr)
sda2 - 27.26 GiB ext4 - /usr
sda3 - 2.38 GiB swap
1
Andrew Woodhead's profile photoChris Schembari's profile photoMarkus Kary's profile photoAndreas Grois's profile photo
21 comments
 
Actually, there's nothing stopping you from placing user directories somewhere else than /home. For existing users the home folders are set in /etc/passwd, and for new users the path can be set in /etc/default/useradd (might depend on distribution, see "man useradd"). So, there's no real need to symlink or bind mount /usr/home to /home after moving the files, you could just change the paths in these two files instead. The situation with /var is different, as that one is often hardcoded, or set at compile time, so there a bind mount or symlink is in order. I'd use a symlink, as this is what many distributions do.

For moving the files, you can either use rsync as written above, or "cp -a" (but check "man cp" before doing this, as I'm not certain).
Add a comment...
Have him in circles
26 people
Rodrigo Urbina's profile photo
Rich Johnson's profile photo
Steph Kakes's profile photo
j2box's profile photo
Zoltan Hoppar's profile photo
Amanda Wood's profile photo
AJ Appliance Repair Inc's profile photo
Owen York's profile photo
Sofia Starda's profile photo
 
Hi, all,
I'm using Kubuntu 14.04 LTS on an old P4-based desktop with a 40gb eide hdd. Space on my linux partitions is tight, and I want to change my partition layout and directory organization to make use of wasted drive space. I still have the Kubuntu liveUSB stick with which I set up this install, and of course I'll back up everything, but I'd like to do this without having to wipe all my files and reinstall everything fresh. My question is how do I do this, exactly?

My /usr dir is by far the biggest storage hog, using 10+ GiB out of sda2's 16+ GiB. I just shrank sda1 and created a new sda4, so right now I have the following. All of the below 4 are primary partitions:
sda1 - 7.95 GiB ntfs - win xp pro
sda4 - 5.00 GiB ext4 - empty, unmounted
[unallocated space] - 5.92 GiB
sda2 - 16.07 GiB ext4 - / (includes whole dir tree)
sda3 - 2.33 GiB swap

I want to use a scheme like what PC-BSD does, with a separate /usr partition occupying the rest of the drive. I think this maximizes space efficiency by allowing my userland files and my home folder to share whatever free space is left. To do this, I'd:

1. Boot from my Kubuntu liveUSB and mount my hdd's partitions.
2. Move most of the files/directories in sda2 [/.kde, /bin, /boot, /cdrom, /dev, /etc, /lib, /lib64, /libx32, /lost+found, /media, /mnt, /opt, /proc, /root, /run, /sbin, /srv, /sys, /tmp, initrd.img, initrd.img.old, vmlinuz, and vmlinuz.old - about 2.3 GiB] to the new 5 GiB partition, leaving behind /home, /usr, and /var in sda2.
3. Move the "front" end of sda2 to fill that 5.92 GiB of free space.
4. On sda2, move all contents of "usr/" (including any hidden files/folders) up one level to sit alongside the old and undisturbed "home/", "usr/", and "var/" folders.
5. Once empty, delete the old "usr/" folder.
6. Tell linux to mount sda4 as / and sda2 as /usr.
7. Create sym-links in the new / to point to /home and /var in their new location within /usr/.

Alternatively, I could use my liveUSB to back up my whole directory tree onto a separate blank flash drive, do a fresh install on the hdd with larger partitions the way I want them, delete the freshly-installed files, then replace them with my backup copies. But I'm not sure how to preserve each file and folder's ownership and permissions. I wouldn't want all my files and directories to be labeled "root access only"!
1
Stephen “Radha Santadharma” Kawamoto's profile photo
 
Make a 512 mb /boot partition since this présents the ability redo the partition if it gets corrupted. Though you have to know how to fix the mbr to dual boot. That is, ubuntu knows how to dual boot.
Add a comment...
People
Have him in circles
26 people
Rodrigo Urbina's profile photo
Rich Johnson's profile photo
Steph Kakes's profile photo
j2box's profile photo
Zoltan Hoppar's profile photo
Amanda Wood's profile photo
AJ Appliance Repair Inc's profile photo
Owen York's profile photo
Sofia Starda's profile photo
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Darien, IL USA
Links
Education
  • Bolingbrook High School
    1987 - 1991
Basic Information
Gender
Male