-1

How can I determine the free space available in each of my logical volumes? I would prefer not mounting them.

Background: I am running virtual machines with LVM storage and would like to see if any of them are running low on diskspace to expand the volume.

Edit: I have several VMs running different OSes. Hence, it would be great to be able to view all volumes without having to mount each of them

Shoan
  • 1,715
  • 5
  • 17
  • 23
  • 1
    The obvious answer is indeed to mount them, since that's the kernel's way of getting the file system code to take a look at what is otherwise just a bunch of bits. Could you give us some idea why you don't want to do that? – MadHatter May 02 '12 at 13:05
  • I have several VMs running different OSes. Hence, it would be great to be able to view all volumes without having to mount each of them. – Shoan May 03 '12 at 11:22

1 Answers1

2

How can I determine the free space available in each of my logical volumes?

I would stress on "what would you define as free space in that case". Either you have an FS and hence mounting it can find out its free space, or you don't have one.

P. S. How-to mount and not interfere in a way (LVM's way): make a snapshot and mount it instead.

poige
  • 9,448
  • 2
  • 25
  • 52
  • If you're concerned about something happening to the data you can also mount it read only – Safado May 02 '12 at 14:06
  • @Safado, nope you can't. Mounting r/o would start jorunal replay anyways, unless you have options to control it. So snapshots are the only bullet-prof way left. – poige May 02 '12 at 14:08
  • @Safado, And, for e. g., you won't be able mount JFS in dirty state, anyways. EXT3 is possible but it could be in some so weird state that you couldn't rely on its free space reporting. – poige May 02 '12 at 14:11
  • Each VM has it's own filesystem. So I have FAT, NTFS, ext4, zfs etc depending on the VM. I am probing for an agnostic way to determine the diskspace utilization without having to mount each volume on the host. – Shoan May 03 '12 at 11:26
  • @Shoan, it would need to take into consideration underlying FS anyways — you have to examine FS structures to make the conclusion regarding occupied space. – poige May 03 '12 at 12:01
  • @poige Thanks for clarifying that. I am going to select your answer now. – Shoan May 04 '12 at 01:47