-1

I'm working on a server which works with logical volumes. The root partition was full, basically because of a large /lib directory. I wanted to set this /lib to a logical partition, as I did already with /usr, /var, /home and /opt.

So I created the volume by

sudo lvcreate -L 20G -n lib vg00

and the filesystem by

sudo mkfs.ext4 /dev/mapper/vg00-lib

then I mounted it by

mount /dev/mapper/vg00-lib /lib/

Now I can't run any command anymore. The mount command somehow failed.

df -h bash: /bin/df: No such file or directory

Any assistance is greatly appreciated. Thanks in advance!

  • There are a lot of essential libraries in /lib, so umount the empty filesystem (reboot is the easiest way for you), and copy all files before next remount. – Ipor Sircer Jan 17 '17 at 9:16
  • Thanks for the quick reply. Is there another way of unmounting it besides rebooting? A couple of applications are still running, I don't know if that's a case after a reboot. – clemenswt Jan 17 '17 at 9:51
  • /bin/busybox umount /lib if busybox-static is installed – Ipor Sircer Jan 17 '17 at 9:54
  • That saved me! I now can rescue my backup files and will then reboot the system. I still don't understand what went wrong though. Probably /lib isn't supposed to be mounted after all? – clemenswt Jan 17 '17 at 10:11
0

If a mount of /lib makes essential libraries like cp, cd, mount, umount unavailable, a

/bin/busybox umount /lib

unmounts the directory. The libraries will work again.

Thanks https://unix.stackexchange.com/users/182562/ipor-sircer !

  • just to mention: it only works if busybox-static is installed, the basic busybox also depends on /lib. – Ipor Sircer Jan 17 '17 at 10:23
  • Of course. I did this on a Ubuntu 14.04 LTS Minimal Server installation. – clemenswt Jan 17 '17 at 11:29
0

/lib contains libraries that are linked to by other applications. When you ran mount /dev/mapper/vg00-lib /lib/ you mounted a fresh filesystem with nothing on it, in place of /lib which effectively made all those libraries unavailable. While they remained on disk, they became inaccessible.

So what you need to do is mount your new logical volume to a different directory, such as /mnt: mount /dev/mapper/vg00-lib /mnt

Then you'll be able to copy /lib to /mnt (which will become your new /lib)

Side note

You...

...wanted to set this /lib to a logical partition...

However, a logical volume and a logical partition are not the same thing. Partitions exist at a lower level (BIOS, GPT, etc) while a logical volume is part of LVM. It was probably just a typo, but I wanted to make that clear.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.