Friday, July 5, 2013

Understanding df and LVM in Linux

df is a utility that tells you available space on mounted filesystems.  If you use the "-h" option, it will format the numbers in human readable format.
 
# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root   50G  1.4G   46G   3% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  636K  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                    1.9G  1.9G     0 100% /tmp
/dev/sda1                477M   78M  374M  18% /boot
/dev/mapper/fedora-home  864G   72M  820G   1% /home



So what we have here is a list of filesystem volumes, how much space they have, and where they're mounted.

The /dev/mapper/ prefix indicates that the specified filesystem is an LVM volume. In this case, there are two: /dev/mapper/fedora-root and /dev/mapper/fedora-home. Since this computer has a single hard drive, these are likely sliced out of /dev/sda2. Linux does this so that you can, in theory at least, expand /dev/mapper/fedora-root or /dev/mapper/fedora-home, at will.

/dev/sda1 is the boot partition - that's where you GRUB is located - that's the thing that the BIOS boots and which in turn boots Linux (or other OS's in a multi-boot configuration).

/dev/sda2 is not mounted at all, because it is formatted to be part of a LVM set.  In theory, when you want to expand /dev/mapper/*, you add another hard drive, put it into the LVM set, and expand /dev/mapper/*.


No comments:

Post a Comment