66 links
  • Ban's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
1 results tagged lvm x
  • LVM: Allocate a LV at the end of the PV - 4.4. Logical Volume Administration

    I wanted to create a new LV on one of my VGs, but I wanted it to be allocated at the end of the PV because I knew that I wouldn't want to extend it (or if I ever did, I wouldn't care about its content -- it was for a /tmp partition), and I wanted the LVs on that same PV to be able to extend linearly if possible. Basically, I wanted to create a new LV that wouldn't get in the way.

    The only solution I found was kind of the nuclear one, but it works great: specify which Physical Extents (PEs) the LV should be allocated on. This can easily be specified to lvcreate as a :PEStart-PEEnd suffix to the PhysicalVolumePath argument.

    But to provide the correct PE range, we first need to find what "correct" is here. For that, pvdisplay --maps comes in handy, showing how PEs are allocated on a PV. Once you got the free PE range(s), and the PE size, you can easily calculate how many PEs you'll need, and so which range to specify. Beware though, apparently if you want to allocate the very last PE, you should not specify it, but simply give an "open" range, like ":PEStart-": otherwise, lvcreate told me the range was incorrect (and if you guess it was a 0-based PE value and lower start and end by 1, you get 1 free PE at the end).

    As you provide PE ranges, I suggest you provide the size of the LV in Logical Extents (LEs, --extents) instead of megabytes or gigabytes (--size) -- anyway you already calculated how many PEs you needed for the size you wanted.

    I also chose to explicitly specify the allocation policy as contiguous, just to be sure LVM wouldn't try and be a smartass behind my back in case I messed up with my ranges.

    In the end, I ended up with this command:

    lvcreate --alloc contiguous -l768 -n NewLVName VGName /dev/mapper/PVName:37149-

    And a pvdisplay --maps nicely shows I got free PEs only before that LV -- so you could extend the previous one even with the contiguous allocation policy.

    PS: well, actually I didn't use this command exactly, because I didn't know about that last PE range issue, so I first allocated it one PE too short of the range I wanted. But then, I decided it was alright and just extended the LV by one PE, using lvextend --alloc contiguous -l+1 /dev/mapper/VGName-LVName /dev/mapper/PVName:37148-.

    March 2, 2015 at 16:39:35 GMT+1 * - permalink -
    QRCode
    - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Cluster_Logical_Volume_Manager/LV.html#create_linear_volumes
    lvm linux
Links per page: 20 50 100
Shaarli - The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community - Help/documentation