0

I've mostly worked in Windows environments and am still very noobish in everything Linux, so it's very likely I'm missing basic Linux concepts. That being said, I have questions about logical volumes and their interactions with files :

I have to use an Ubuntu machine (which I did not set up). On this machine, there is a physical volume /dev/sda2 which is in a volume group vg0. That volume group vg0 has 4 logical volumes : lv1, mounted on /, lv2, mounted on /boot, lv3, mounted on /var and lv4, mounted on /tmp

My questions are as follows :

  1. If I save a file (for example foo.txt) in the /var directory, will it be stored on the lv3(/var) logical volume ?
  2. If the lv3(/var) logical volume is full and I try to save foo.txt in the /var directory, will it be stored on the lv1(/) logical volume (after all, /var is in /) ?
  3. If the lv1(/) volume is full and I try to save foo.txt somewhere outside of /var (for example in /home), will it be stored on the lv3(/var) logical volume ?
  4. What could be the point of having all these logical volumes, would 1 volume on / not be much simpler ?
  5. It's quite obvious, from my questions, that I don't really get the relations between logical volumes, mount points and files. Is there somewhere a good tutorial where I could educate myself ?

Thanks in advance.

1 Answers1

1
  1. Yes, because lv3 is mounted on /var any files put in /var go there.
  2. No, there are no special cases that happen when the device is full - you just get a device is full error. Despite /var appearing to be a child of /, that has been overridden by mounting lv3 on /var
  3. No, again because there are no special cases for the device being full. It doesn't care, it just tries to put the file where it goes.
  4. Yes, it is much simpler to have it all in /. But it can cause problems. For example, /boot is often its own volume so that you can't fill it up and prevent your system from working if you download a bunch of stuff in your home folder. There are different schools of thought on how much/how little you should separate your file system into different volumes. It is somewhat just opinion, but those opinions are based on various use cases and problems.
  5. I don't have a great answer other than use the search engine of your choice! Honestly, when you are starting out it doesn't matter so much as long as you have space to put your stuff! If you are a newbie, it might be good to just put everything in one volume - as long as you keep an eye and don't let it fill up.
izzy
  • 769
  • 2
  • 12
  • 22
  • Thanks a lot for you clear and precise answers. I get now why having /boot (or even /tmp) on its own volume can be a good idea. I still fail to see why it's useful for /var, but hey, I have to work with what I've been given. As for the tutorial, I've found sites explaining LVM in detail, others explaining what mount points were, but nothing that could answer my questions as clearly as you did. Guess my google-fu is not up to par. Anyway, thanks again ! – Cheradenine Zakalwe Mar 11 '21 at 18:49
  • Honestly, I have no idea why it is useful for /var either :) Although I think it has to do with, in case something goes crazy and fills up the /var it does not break your whole system – izzy Mar 11 '21 at 19:27
  • LVM is optional, it is used as a layer between your disk and your system. So you can have 1 disk and your system thinks you have 4, or you can have 4 disks and your system thinks you have 1 – izzy Mar 11 '21 at 19:30