12

Both seem to be a virtualization layer on top of physical disks. I'm having a hard-time understanding each of them and the difference between them.

BlueGene
  • 2,191
  • 9
  • 29
  • 33

4 Answers4

19

Different layers of abstraction.

If you've got a large storage array, you probably don't want one server to use the whole thing, so you divide it into logical units (LUN is actually Logical Unit Number, but hey, it helps me remember). So you've got your storage sliced into usable chunks, and now you present it to the server. In a simple example, suppose it shows up as /dev/sdb. No partitions on it, it's just a disk, so far as the server cares.

Why throw LVM on top of it? For me, it's because of growth. If I fill up that disk, I want to be able to add more space to it. LVM makes it easier and (in my mind) less risky, because I can resize that LUN on the storage array (or even create another LUN and present that to the server) and using LVM, I can grow the "virtual" disk without rebooting.

I wrote an introduction to LVM here: http://www.standalone-sysadmin.com/blog/2008/09/introduction-to-lvm-in-linux/

Which I referenced when talking about resizing LUNs here: http://www.standalone-sysadmin.com/blog/2009/05/resizing-storage-luns-in-linux-on-the-fly/

Matt Simmons
  • 20,218
  • 10
  • 67
  • 114
7

LVM is a piece of software used to "carve" up a disk, usually a locally attached disk, into smaller sections.

LVM is a method of allocating hard drive space into logical volumes that can be easily resized instead of partitions.

A LUN is a construct, usually on a storage array, with which you present a "slice" of a disk array/volume to a host, where it appears as a physically attached local disk via some connection, usually SAN (iSCSI/FC).

For example, if you presented a LUN to a host, you could then use LVM to further customize the layout of what the system thought was a local disk.

A LUN is a Logical Unit Number. It can be used to refer to an entire physical disk, or a subset of a larger physical disk or disk volume. The physical disk or disk volume could be an entire single disk drive, a partition (subset) of a single disk drive, or disk volume from a RAID controller comprising multiple disk drives aggregated together for larger capacity and redundancy. LUNs represent a logical abstraction or, if you prefer, virtualization layer between the physical disk device/volume and the applications.

WerkkreW
  • 5,879
  • 3
  • 23
  • 32
4

A LUN is generally a disk array level reference to an amount of raw disk space that's been formatted and allocated to a specific server or group of servers. It might be spread out over multiple physical disks, but will be presented by the disk array as a single "logical" drive to the target server.

LVM stands for "Logical Volume Manager", and is generally a piece of operating system software which is layered on top of the raw LUNs being assigned to a server. LVM allows you to perform various tasks on the LUNS, such as sub-divide LUNs into smaller logical volumes, group them together into volume groups, perform disk mirroring between LUNS, etc.

Ewan Leith
  • 1,695
  • 8
  • 7
3

A LUN is a SCSI concept (a "Logical Unit Number").

SCSI has "targets", which correspond to controllers. A target might have a number of "logical units" attached. As an example, imagine a JBOD with a bunch of disks attached. It could choose to present those disks as LUNs on a single target.

Often a storage array will present RAIDs of several disks as individual LUNs; you get an interface that looks like a large disk but is RAID protected.

LVM is a higher level concept, decoupling the logical "things you put a filesystem on" from "physical disks". You can certainly implement an "LVM controller" which takes in a bunch of disks, internally does some form of LVM, and presents the resulting drives as LUNs on SCSI targets. That is very common on fancier storage arrays.

However, a LUN need not be the result of any LVM! It may just be a physical disk.