7.8 Creating an LVM Logical Volume

You can use the nlvm create linux volume command to create a Linux LVM volume group and logical volume, make a file system on the volume, and mount the volume. LVM requires a device that is unpartitioned and unshared. For command usage information, see Create Linux Volume in the OES 2015 SP1 Beta: NLVM Reference.

For conceptual information about LVM, see Understanding the Logical Volume Manager in the SUSE Linux Enterprise Server 11 SP3 Storage Administration Guide.

  1. Log in to the server as the root user, then open a terminal console.

  2. List the devices by entering the following command, then verify that the device that you want to use has been formatted.

    nlvm list device <device_name>
    

    Note the amount of free unpartitioned space available.

  3. To create the volume, enter

    nlvm create linux volume 
      type=<btrfs|ext2|ext3|reiserfs|xfs> 
      device=<devicename>
      size=<value[K|M|G|T]>
      mp=<full_mount_point_path>
      [mntopt=<fs_mount_options>] 
      lvm
      name=<lv_name> 
      [group=<vg_name>]
      [ncp]
    

    Specify the type of file system to create on the volume. Valid values are ext2, ext3, reiserfs, and xfs.

    Replace device_name with the node name of the device where you want to create the volume, such as sde.

    IMPORTANT:NLVM does not support using Linux software RAID devices and NSS software RAID devices with Linux POSIX file systems. You can use a hardware RAID device to achieve device fault tolerance for Linux POSIX volumes.

    Specify the size of the amount of free unpartitioned space on the device. All sizes are in bytes and can be specified with one of the following multipliers: K (kilobytes), M (megabytes), G (gigabytes), or T (terabytes). Multipliers are case insensitive and are multiples of 1024. If no multiplier is specified, it is assumed to be G.

    Replace full_mount_point_path with the full Linux path where you want to mount the device. The final directory’s name can be the same or different than the name that you assign to the logical volume.

    Replace fs_mount_options with the mount options to use when mounting the volume. For a list of available options, see the mount(8) man page. The default mntopt value is rw.

    Specify the lvm option to create an LVM volume group and logical volume.

    Replace lv_name with the name you want to give the LVM logical volume.

    NOTE:If you enable NCP for the volume, the LVM volume name must comply with the limitations for NCP volume names described in Section 5.4, Naming Conventions for NCP Volume Names. If you use lowercase letters for the volume name, they are automatically changed to uppercase for the NCP volume name.

    Replace vg_name with the name you want to give the LVM volume group. If the group option is not used, the volume group uses the same name as the logical volume.

    Use the ncp option to enable the Linux POSIX file system on the volume to be accessed with the NetWare Control Protocol (NCP). It creates an NCP volume of the same name with all uppercase letters, and creates an NCP share at the root of the volume.

    For example, enter the following command to create an LVM volume group named lvmvg42 and volume named lvmvol42 with the XFS file system that is mounted for read and write access at /mnt/vol42:

    nlvm create linux volume type=xfs device=sde size=511M mp=/mnt/vol42 mntopt=rw lvm name=lvmvol42 group=lvmvg42
    

    If the creation is successful, the response is:

    Volume mounted at /mnt/vol42
    
  4. Verify that the volume is mounted by entering

    nlvm list linux volumes
    

    For example:

    nlvm list linux volumes
     Name     Group    Mounted    Size Shared  Type LVM NCP Mountpoint
     /                   Yes    15.98GB  No    ext3  No  No /
     /boot               Yes   297.00MB  No    ext2  No  No /boot
     lvmvol42 lvmvg42    Yes   508.00MB  No     xfs Yes  No /mnt/vol42
     LVMVOL41 LVMVOL41   Yes   508.00MB  No    ext3 Yes Yes /usr/novell/LVMVOL41
     LVMVOL43 lvmvg43    Yes   508.00MB  No     xfs Yes Yes /mnt/vol43
    

    If NCP is enabled for the volume, the volume name appears in all uppercase, and the NCP value is Yes. If the volume group name is not specified for an NCP-enabled LVM volume, the volume group name also appears in uppercase, as shown for LVMVOL41. For LVM volumes, the mount point path uses the mount point path as provided, as shown for volumes lvmvol42 and LVMVOL43 the example. If no mount point path is provided, the default mount point /usr/novell/<volume_name> is used, such as /usr/novell/LVMVOL41.

  5. View information about the volume group you created by entering the following Linux LVM command:

    vgdisplay [vg_name]
    

    For example: