[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Merging / and /usr (was: jessie release goals)

On Thu, 2013-05-09 at 03:43 +0200, Marco d'Itri wrote:
> On May 08, Marc Haber <mh+debian-devel@zugschlus.de> wrote:
> > How would that be done for a 200 MB filesystem holding /, no extra
> > /boot partition, and a multi-gigabyte /usr beyond the 2T barrier?
> Let's assume that at this point there are no files in /{bin,sbin,lib} 
> which have the same name of a file in /usr/{bin,sbin,lib} but are not 
> a symlink to them (which I suspect is something that we want anyway).
> For each $file in /{bin,sbin,lib}:
>   if $file is a symlink to /usr/.../$file
>     do nothing
>   else
>     cp -a $file to /usr/...
>     ln -sf ../usr/.../$file $file
> When /{bin,sbin,lib} only contain symlinks then they can be quickly 
> renamed, replaced by a symlink to /usr/$dir and finally safely deleted.
> There is a tiny race here, but I am sure that there are much worse 
> ones while doing a dist-upgrade.

mount -o bind / /tmp/root
mount -o bind /usr/bin /bin
mv /tmp/root/bin /tmp/root/bin.old
ln -s usr/bin /tmp/root/bin
rm -rf /tmp/root/bin.old
umount /bin
umount /tmp/root

This still leaves the system unbootable if it crashes at exactly the
wrong time, but there is no race condition in the running system.  (And
the initramfs changes to mount /usr could conceivably include recovering
from missing symlinks in /.)


> And now you have space in /boot for a 150 MB grml-small rescue image!

Ben Hutchings
For every action, there is an equal and opposite criticism. - Harrison

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: