From Fedora Project Wiki

No edit summary
(Blanked the page)
Line 1: Line 1:
= Move all to /usr =


== Summary ==
Provide a way of mounting /usr read-only and share it between multiple hosts to save maintenance and space.
/usr on its own filesystem is useful in custom setups. But instead of the Unix way to (almost randomly) split-off tools from /usr and put them in /, and require more and more tools to move to /, we today just expect /usr to be mounted from inside the initramfs, to be available before 'init' starts. What /bin and /sbin was for Unix is the initramfs for Linux. An initramfs that supports to mount /usr on top of /, before it starts 'init', makes all current setups work properly.
== Owner ==
* Name: [[User:Harald| Harald Hoyer]]
* Email: harald@redhat.com
== Current status ==
* Targeted release: [[Releases/16 | Fedora 16 ]]
* Targeted release: [[Releases/17 | Fedora 17 ]]
* Last updated: (DATE)
* Percentage of completion: 0%
== Detailed Description ==
There is no way to reliably bring up a modern system with an empty /usr, there are two alternatives to fix it: copy /usr back to the rootfs or use an initramfs which can hide the split-off from the system.
Historically /bin, /sbin, /lib had the purpose to contain the utilities to mount /usr. This role can now be taken by the initramfs. Because the initramfs knows, where to find the root partition (which includes /etc), it can parse /etc/fstab and other configuration files and mount /usr before it finally switches the root partition and executes /usr/bin/init. From this point on init mounts the remaining partitions in /etc/fstab and the system starts as usual.
The long-term plan is to clean up the mess and confusion the current split of / vs. /usr has created. All tools will move back to /usr where they belong, and the rootfs will only contain compat-symlinks into /usr. Almost the entire system installed by packages will reside in /usr. This will split all non-host specific data to /usr. /usr can then be seen as the Unix System Resources partition (/System), which defines the base operating system (e.g. F18 or RHEL-7).
This new /usr could be mounted read-only by default, while the rootfs is read-write and contains only empty mount points, compat-symlinks to /usr and the host-specific data like /etc, /root, /srv. Compared to today's setups, the rootfs will be very small. The new /usr could also easily be shared read-only across several systems, and it would contain almost the entire system. Such setups are more efficient, can optionally provide a lot more security, are more flexible, provide more sane options for custom setups, and are much simpler to setup and maintain.
The remaining non-volatile top level directories are host specific:
* /boot - data to boot the machine (bootloader, kernel and initramfs image)
* /var - host specific variable data
* /home - user data
* /root - user data
* /etc - host specific configuration data
* /opt - host specific non-base OS apps
* /srv - host specific contents to be served
In the process of moving /bin and /sbin to /usr/bin, /usr/sbin can be moved also to /usr/bin.
=== Example F15 ===
This output is from a modified F15 standard installation:
<pre># df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                2.0G  162M  1.8G  9% /
udev                  484M    0  484M  0% /dev
tmpfs                494M  248K  493M  1% /dev/shm
tmpfs                494M  43M  451M  9% /run
/dev/sda2            2.0G  162M  1.8G  9% /
/dev/sda5              13G  3.3G  8.8G  28% /usr
tmpfs                494M  43M  451M  9% /run
tmpfs                494M    0  494M  0% /sys/fs/cgroup
tmpfs                494M    0  494M  0% /media
/dev/sda1            117M  47M  65M  42% /boot
</pre>
<pre># ls -l /
total 66
lrwxrwxrwx    1 root root    7 Jul  7 16:28 bin -> usr/bin
dr-xr-xr-x.  5 root root  1024 Jul  4 19:33 boot
drwxr-xr-x  16 root root  3480 Jul 11 19:34 dev
drwxr-xr-x. 127 root root 12288 Jul 11 19:34 etc
drwxr-xr-x.  3 root root  4096 Jul  4 17:33 home
lrwxrwxrwx    1 root root    7 Jul 11 17:30 lib -> usr/lib
lrwxrwxrwx    1 root root    9 Jul 11 17:23 lib64 -> usr/lib64
drwx------.  2 root root 16384 Jul  4 16:02 lost+found
drwxr-xr-x    2 root root    40 Jul 11 19:33 media
drwxr-xr-x.  2 root root  4096 May 18 13:33 mnt
drwxr-xr-x.  2 root root  4096 May 18 13:33 opt
dr-xr-xr-x  116 root root    0 Jul 11 17:33 proc
dr-xr-x---.  6 root root  4096 Jul 11 15:58 root
drwxr-xr-x  28 root root  1060 Jul 11 19:35 run
lrwxrwxrwx    1 root root    7 Jul  7 16:28 sbin -> usr/bin
drwxr-xr-x.  2 root root  4096 Jul  4 16:02 selinux
drwxr-xr-x.  2 root root  4096 May 18 13:33 srv
drwxr-xr-x  13 root root    0 Jul 11 19:33 sys
drwxrwxrwt.  14 root root  4096 Jul 11 19:34 tmp
drwxr-xr-x.  13 root root  4096 Jul  4 19:55 usr
drwxr-xr-x.  18 root root  4096 Jul  4 17:27 var
</pre>
== Benefit to Fedora ==
Clear separation of operating system and host specific resources. /usr can be read-only and shareable.
== Scope ==
The ability to share /usr is especially useful for clusters and virtual machines.
The ability to mount /usr read-only (e.g. on read-only media) adds to the security of the machine.
== How To Test ==
<!-- This does not need to be a full-fledged document.  Describe the dimensions of tests that this feature is expected to pass when it is done.  If it needs to be tested with different hardware or software configurations, indicate them.  The more specific you can be, the better the community testing can be.
Remember that you are writing this how to for interested testers to use to check out your feature - documenting what you do for testing is OK, but it's much better to document what *I* can do to test your feature.
A good "how to test" should answer these four questions:
0. What special hardware / data / etc. is needed (if any)?
1. How do I prepare my system to test this feature? What packages
need to be installed, config files edited, etc.?
2. What specific actions do I perform to check that the feature is
working like it's supposed to?
3. What are the expected results of those actions?
-->
== User Experience ==
<!-- If this feature is noticeable by its target audience, how will their experiences change as a result?  Describe what they will see or notice. -->
* less toplevel directories
== Dependencies ==
<!-- What other packages (RPMs) depend on this package?  Are there changes outside the developers' control on which completion of this feature depends?  In other words, completion of another feature owned by someone else and might cause you to not be able to finish on time or that you would need to coordinate?  Other upstream projects like the kernel (if this is not a kernel feature)? -->
* initramfs (dracut)
* selinux
* repackaging of packages with content in /bin, /sbin, /lib*
* drop consolehelper to move /usr/sbin/* to /usr/bin
* alternatives symlinks?
* filesystem rpm, toplevel symlinks
== Roadmap ==
=== Phase 1 ([[Releases/16 | Fedora 16 ]] ?) ===
* update rpmlint
* begin changing rpm packages with files in /bin, /sbin, /usr/sbin, /lib, /lib64
** ??? make backward compat symlinks in %post and %ghost those symlinks ?????
* RPM package list:
<pre>
$ (for i in bin sbin lib lib64 usr/sbin; do yum -C --disablerepo=* --enablerepo=fedora  provides  "/$i/*"; done) \
  |egrep -v '^Filename '|egrep -v '^Repo '|egrep -v 'Matched '|egrep -v '^\s+:' \
  |while read a b; do a=${a#[0-9]*:}; echo ${a%%-[0-9]*};done|sort -u
</pre>
Outputs 1059 rpm packages.
* change selinux policies
* prepare dracut to mount /usr from /etc/fstab
* drop consolehelper to enable the /usr/sbin -> /usr/bin move
=== Phase 2 ([[Releases/17 | Fedora 17 ]]) ===
* change remaining rpm packages
* check, if rpm can cope with old packages, rpm error, if conflicting files due to symlinks
* create symlinks on new installation /bin -> usr/bin, /sbin -> usr/bin, /lib -> usr/lib, /lib64 -> usr/lib64, /usr/sbin -> bin
* might provide an update script
** check if directory is emtpy besides %ghosted symlinks
** remove directory and create symlink
== Contingency Plan ==
<!-- If you cannot complete your feature by the final development freeze, what is the backup plan?  This might be as simple as "None necessary, revert to previous release behaviour."  Or it might not.  If you feature is not completed in time we want to assure others that other parts of Fedora will not be in jeopardy.  -->
* The move of /usr/sbin to /usr/bin can be delayed. /bin -> /usr/bin, /sbin -> /usr/sbin
* ??? make backward compat symlinks in %post and %ghost those symlinks ?????
== Documentation ==
<!-- Is there upstream documentation on this feature, or notes you have written yourself?  Link to that material here so other interested developers can get involved. -->
*
== Release Notes ==
<!-- The Fedora Release Notes inform end-users about what is new in the release.  Examples of past release notes are here: http://docs.fedoraproject.org/release-notes/ -->
<!-- The release notes also help users know how to deal with platform changes such as ABIs/APIs, configuration or data file formats, or upgrade concerns.  If there are any such changes involved in this feature, indicate them here.  You can also link to upstream documentation if it satisfies this need.  This information forms the basis of the release notes edited by the documentation team and shipped with the release. -->
*
== Comments and Discussion ==
* See [[Talk:Features/UsrMove]]  <!-- This adds a link to the "discussion" tab associated with your page.  This provides the ability to have ongoing comments or conversation without bogging down the main feature page -->
[[Category:FeaturePageIncomplete]]
<!-- When your feature page is completed and ready for review -->
<!-- remove Category:FeaturePageIncomplete and change it to Category:FeatureReadyForWrangler -->
<!-- After review, the feature wrangler will move your page to Category:FeatureReadyForFesco... if it still needs more work it will move back to Category:FeaturePageIncomplete-->
<!-- A pretty picture of the page category usage is at: https://fedoraproject.org/wiki/Features/Policy/Process -->

Revision as of 15:10, 14 July 2011