Symlink at /usr

I have spent three months with Linux and I need to save space in the root partition because I’m running out of space. If i move /usr folder to another partition where i have a lot of free space and make a symlink to it: will Suse work normally ?

I dont want to reformatting or similar because i have important things here including programs.

Thanks.

‘Programs’ under Linux are usually free, and thus may be re-installed without any problem.

maybe tricky. You must not move anything that maybe need at boot before the partition is mounted.

I don’t know if anything in /usr is need before the fstab mount is done. I know you cant move /etc that has the fstab in it. /tmp is ok I think but there are several directories that are virtual ie do not contain files that live on the disk. There maybe section of /usr that are safe???

On 2014-03-06 22:46, berserkerjmb wrote:
>
> I have spent three months with Linux and I need to save space in the
> root partition because I’m running out of space. If i move /usr folder
> to another partition where i have a lot of free space and make a symlink
> to it: will Suse work normally ?

Ugh. I’m not sure.

Either that or a bind mount.

> I dont want to reformatting or similar because i have important things
> here including programs.

You can have “/usr” on a separate partition of its own, but as a
symlink… I have never tried it.

You could try the experiment: using an external rescue disk (I suggest
the XFCE image from the opensuse download page), rename the usr
directory to usr.old, and copy it all to the directory you intended to
use. Then do the symplink, and see if it boots.

Or rather, a bind mount, I think it is safer.

If it does not boot, just revert the rename…

If it boots, keep the rescue media close to that machine. If the system
needs to go to emergency mode, as it will not be able to access “/usr”
(and most things live there), it can fail to boot to emergency mode, and
even if it does, many things will not run.

A separate “/usr” works because the needed things are in the initrd
image, but that has only about 20 megabytes. But obviouly many things
are missing.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

On 2014-03-07 00:46, gogalthorp wrote:

> I don’t know if anything in /usr is need before the fstab mount is done.
> I know you cant move /etc that has the fstab in it. /tmp is ok I think
> but there are several directories that are virtual ie do not contain
> files that live on the disk. There maybe section of /usr that are
> safe???

You can have “/usr” in a different partition. I do.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

For a start, it needs /usr/bin/mount.

Just be sure you have a decent backup before proceeding with any of the suggestions you get. That will save you all the reinstalling and reconfiguring.

However, keep in mind how quick and easy it is to install openSUSE Linux, how easy it is to access and install the free software applications, and so on. So, mostly when using it, you are really only concerned about saving your important data, not as much worrying about an operating system that takes days to set up after a long install, and even software that takes days to install, update, & get set up properly again.

I find that reinstalling openSUSE and all my software (and I have a lot of software) takes only about a day or so, including backing up again, where many of my Windows installs would take a week or two of hours-a-day to get back to the point I was at.

For backing up, you could use Clonezilla. You could generally follow this guide, which is a guide to back up to a USB Flash Key:
https://forums.opensuse.org/showthread.php/495246-Clonezilla-home-partimage-not-enough-space?p=2623103#post2623103

Instead of a flash key, you could always back up to a 2nd HD, or to an external disk, depending on what you have at your disposal.

On 2014-03-07 03:36, arvidjaar wrote:
>
> gogalthorp;2629071 Wrote:
>> I don’t know if anything in /usr is need before the fstab mount is done.
>
> For a start, it needs /usr/bin/mount.

The initrd file is a cpio archive. If you expand it, you see:


..
├── bin
├── boot
├── config
├── dev
├── etc
│   ├── modprobe.d
│   ├── splashy
│   │   └── themes -> /usr/share/splashy/themes
│   ├── sysconfig
│   │   └── network
│   │       ├── anterior
│   │       ├── if-down.d
│   │       ├── if-up.d
│   │       ├── providers
│   │       └── scripts
│   └── udev
│       └── rules.d
├── lib
│   ├── firmware
│   ├── modules
│   │   └── 3.11.10-7-desktop
│   │       ├── kernel
│   │       │   ├── arch
│   │       │   │   └── x86
│   │       │   │       └── crypto
│   │       │   ├── crypto
│   │       │   ├── drivers
│   │       │   │   ├── acpi
│   │       │   │   ├── ata
│   │       │   │   ├── gpu
│   │       │   │   │   └── drm
│   │       │   │   ├── hid
│   │       │   │   ├── scsi
│   │       │   │   │   └── device_handler
│   │       │   │   ├── thermal
│   │       │   │   └── usb
│   │       │   │       └── host
│   │       │   ├── fs
│   │       │   │   ├── btrfs
│   │       │   │   └── xfs
│   │       │   └── lib
│   │       │       ├── raid6
│   │       │       └── zlib_deflate
│   │       └── weak-updates
│   │           └── updates
│   └── udev -> ../usr/lib/udev
├── lib64
├── proc
├── root
├── sbin
├── sys
├── tmp
├── usr
│   ├── bin
│   ├── lib
│   │   ├── firmware -> ../../lib/firmware
│   │   ├── systemd
│   │   └── udev
│   │       ├── hwdb.d
│   │       └── rules.d
│   ├── lib64
│   │   └── directfb-1.6-0
│   │       ├── inputdrivers
│   │       ├── interfaces
│   │       │   ├── IDirectFBFont
│   │       │   └── IDirectFBImageProvider
│   │       ├── systems
│   │       └── wm
│   ├── sbin
│   └── share
│       ├── splashy
│       │   └── themes
│       │       └── default
│       └── zoneinfo
└── var
├── lib
│   └── dhcpcd
├── log
└── run


In that small /usr/bin/, there is of course a “mount”. And in
/usr/sbin/, there is an fsck. I even see “mkfs.btrfs”, no idea why
(because there is no “mkfs.ext3” or any other, for instance).


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

The reason why i dont want to reinstall SUSE is that i have a lot of software like processing, android sdk, jdownloader, etc that i dont know if i would be able to make them work as they work actually. I will try to see which directories can i symlink and then if I cant boot then I will just insert an usb live and revert my actions. Give me good luck =/ .

Anyway i think that i will still be able to boot windows from grub ? true ?

And if you know which directories have no problem with symlink (or bind mount) It will be helpful if you tell me. Maybe the lib, lib64 and share ?

Thanks for the replies.

On 2014-03-07 13:36, berserkerjmb wrote:
>
> The reason why i dont want to reinstall SUSE is that i have a lot of
> programs like processing, android sdk, jdownloader, etc that i dont know
> if i would be able to make them work as they work actually. I will try
> to symlink and if I cant boot then I will just insert an usb live and
> revert my actions. Give me good luck =/ .

Better than symlink, I think it is better to bind mount. An entry like
this in fstab:


/data/usr/ /usr   none    bind 0 0

> Anyway i think that i will still be able to boot windows from grub ?
> true ?

Yes, should work fine.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

When /etc/fstab is being processed, initrd no more exists, so it is irrelevant. Unless only root filesystem exists, /usr/bin/mount need to be present for system to boot. If /usr is mount point, mkinitrd is hopefully intelligent enough to notice it and mount it in initrd, together with root. If /usr is link pointing into some other filesystem, I would not be sure. Nor would I be sure if it bind mount.

On 2014-03-07 16:46, arvidjaar wrote:
>
> robin_listas;2629125 Wrote:
>> On 2014-03-07 03:36, arvidjaar wrote:
>>>
>>> gogalthorp;2629071 Wrote:
>>>> I don’t know if anything in /usr is need before the fstab mount is
>> done.
>>>
>>> For a start, it needs /usr/bin/mount.
>>
>> The initrd file is a cpio archive.
>
> When /etc/fstab is being processed, initrd no more exists, so it is
> irrelevant. Unless only root filesystem exists, /usr/bin/mount need to
> be present for system to boot. If /usr is mount point, mkinitrd is
> hopefully intelligent enough to notice it and mount it in initrd,
> together with root. If /usr is link pointing into some other filesystem,
> I would not be sure. Nor would I be sure if it bind mount.

Well, you explained perfectly why I was not sure that it would work. I
had no reason for it, that I could point to, but your explanation is
quite sensible.

I would be interested in the OP trying it out and telling us if it
worked or not…


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

>I would be interested in the OP trying it out and telling us if it
>worked or not…

Well, it not worked but i managed out to get back to the normality. I’m a n00b in Linux right now so i dont know if i did wrong or it just dont work. I boot into a live USB with PartedMagic inside then i did this things:

1-> I tryed to “bind --mount” but i dont know if i cant do it though live usb or if there is a problem. Here in suse i have this folders/partitions:

/ <- the root
/home <- home where i want to make the link (its a diferent partition dev/sda7)

I think this is only though the actual file system so it should not work trough live usb. Im right ?

so i did this:


bind --mount /media/dev/sda6/usr/share /media/dev/sda7/bind_mount_root_usr/share
bind --mount /media/dev/sda6/usr/lib /media/dev/sda7/bind_mount_root_usr/lib
bind --mount /media/dev/sda6/usr/lib64 /media/dev/sda7/bind_mount_root_usr/lib64

EDIT: Note that /media/dev/sda6/ was the path from the live usb console.

Then i opened the file manager and i tested that it works, it did. So in that moment I restarted the computer and the icon of openSUSE appeared and started to make the image of the chameleon more clear, in that moment said to my self: “Ok, im a pro and this will works :D”. Then the image stop getting clear and the light of block mayus started to flash. I did ctr+alt+F1 but it dint work, shut down button did not work either so i had to shut the power input off.

Then i executed the live USB again and I noticed that the mount dont work this time, so I started thinking that im nub and it only work in the same system.

So then i tried the symlink, because is a link to a path and does not matter which is the path. So this time i did:


ln -s /media/dev/sda6/usr/share /home/bind_mount_root_usr/share
ln -s /media/dev/sda6/usr/lib /home/bind_mount_root_usr/lib
ln -s /media/dev/sda6/usr/lib64 /home/bind_mount_root_usr/lib64

Three new files appeared, so it (i though) was ok but I restarted the computer and had the same problem.

I dont know if it is a problem of trying it with lib, or if I dont have to do that with a live usb or what happen. I appreciate if you teach me.

Thnxs anyway.

mmm can I expand root partition in a live cd/usb easyly without problems ? I have a lot of available space in the /home (/dev/sda7) partition.

I will use Gparted… lets see if a dont destroy everything

On 2014-03-07 21:06, berserkerjmb wrote:
>
>> I would be interested in the OP trying it out and telling us if it
>> worked or not…
>
> Well, it not worked but i managed out to get back to the normality. I’m
> a n00b in Linux right now so i dont know if i did wrong or it just dont
> work. I boot into a live USB with PartedMagic inside then i did this
> things:
>
> 1-> I tryed to “bind --mount” but i dont know if i cant do it though
> live usb or if there is a problem.

I told you exactly how to do that. You simply edit the “/etc/fstab” file.

You can not run “bind --mount”, that will not work. The command is not
permanent, it has to be run during each and every system boot.

> So then i tried the symlink, because is a link to a path and does not
> matter which is the path. So this time i did:
>
>
> Code:
> --------------------
>
> ln -s /media/dev/sda6/usr/share /home/bind_mount_root_usr/share
> ln -s /media/dev/sda6/usr/lib /home/bind_mount_root_usr/lib
> ln -s /media/dev/sda6/usr/lib64 /home/bind_mount_root_usr/lib64
>
> --------------------
>
>
> Three new files appeared, so it (i though) was ok but I restarted the
> computer and had the same problem.

Yes, because those symlinks are related to the live system, not your system.

It would be:


cd /media/dev/sda6/usr
ln -s /home/bind_mount_root_usr/share share
ln -s /home/bind_mount_root_usr/lib lib
ln -s /home/bind_mount_root_usr/lib64 lib64

And the commands above will fail it the directories share, lib, lib64
still exist. You have to rename them first.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

I think it would be better to shrink and grow the root partition anyway… I’m doing backups to be ready for that. Thank you anyway, almost i have learned something and probably it will solve some of my future problems. :slight_smile: