Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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 2 '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 3 '12 at 11:22

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
If you're concerned about something happening to the data you can also mount it read only –  Safado May 2 '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 2 '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 2 '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 3 '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 3 '12 at 12:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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