17 Mayıs 2017 Çarşamba

How to create logical volumes in linux

This example procedure creates an LVM logical volume called new_logical_volume that consists of the disks at /dev/sda1/dev/sdb1, and /dev/sdc1.
  1. To use disks in a volume group, label them as LVM physical volumes with the pvcreatecommand.
    WARNING
    This command destroys any data on /dev/sda1/dev/sdb1, and /dev/sdc1.
    # pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
      Physical volume "/dev/sda1" successfully created
      Physical volume "/dev/sdb1" successfully created
      Physical volume "/dev/sdc1" successfully created
    
  2. #Another Example:
    
    pvcreate /dev/mapper/mpathx
  3. Create the a volume group that consists of the LVM physical volumes you have created. The following command creates the volume group new_vol_group.
    # vgcreate new_vol_group /dev/sda1 /dev/sdb1 /dev/sdc1
      Volume group "new_vol_group" successfully created
    
    You can use the vgs command to display the attributes of the new volume group.
    # vgs
      VG            #PV #LV #SN Attr   VSize  VFree
      new_vol_group   3   0   0 wz--n- 51.45G 51.45G
    
  4. Create the logical volume from the volume group you have created. The following command creates the logical volume new_logical_volume from the volume group new_vol_group. This example creates a logical volume that uses 2 gigabytes of the volume group.
    # lvcreate -L 2 G -n new_logical_volume new_vol_group
      Logical volume "new_logical_volume" created
  5. #Another Example:  lvcreate -l 100%FREE -n new_logical_volume new_vol_group
  6. Create a file system on the logical volume. The following command creates a GFS2 file system on the logical volume.
    # mkfs.gfs2 -p lock_nolock -j 1 /dev/new_vol_group/new_logical_volume
    This will destroy any data on /dev/new_vol_group/new_logical_volume.
    
    Are you sure you want to proceed? [y/n] y
    
    Device:                    /dev/new_vol_group/new_logical_volume
    Blocksize:                 4096
    Filesystem Size:           491460
    Journals:                  1
    Resource Groups:           8
    Locking Protocol:          lock_nolock
    Lock Table:
    
    Syncing...
    All Done
    
    #Another Example:
    
    mkfs.xfs /dev/vgx/lgx
    mkfs.xfs /dev/mapper/vg..
    The following commands mount the logical volume and report the file system disk space usage.
    # mount /dev/new_vol_group/new_logical_volume /mnt
    # df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/new_vol_group/new_logical_volume
                           1965840        20   1965820   1% /mnt
    



      Fiziksel diskler atandıktan sonra scan işlemi yapılır

      echo "- - -" > /sys/class/scsi_host/host0/scan
      echo "- - -" > /sys/class/scsi_host/host1/scan
      echo "- - -" > /sys/class/scsi_host/host2/scan

      fdisk -l ile disklerin mpathx bilgileri not edilir

      [root@servername /]# pvcreate /dev/mapper/mpathae /dev/mapper/mpathaf
        Physical volume "/dev/mapper/mpathae" successfully created
        Physical volume "/dev/mapper/mpathaf" successfully created

      [root@servername /]# vgcreate vg11 /dev/
      [root@servername /]#  lvcreate -l 100%FREE -n BACKUP vg11

      cd /
      mkdir BACKUP mount klasörünü oluşturuyoruz

      mkfs.xx ile filesystem oluşturuyoruz

      [root@servername /]# mkfs.ext4 /dev/vg11/BACKUP
      mke2fs 1.42.9 (28-Dec-2013)
      Filesystem label=
      OS type: Linux
      Block size=4096 (log=2)
      Fragment size=4096 (log=2)
      Stride=8 blocks, Stripe width=8 blocks
      335544320 inodes, 2684352512 blocks
      134217625 blocks (5.00%) reserved for the super user
      First data block=0
      Maximum filesystem blocks=4294967296
      81920 block groups
      32768 blocks per group, 32768 fragments per group
      4096 inodes per group
      Superblock backups stored on blocks:
              32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
              4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
              102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
              2560000000

      Allocating group tables: done
      Writing inode tables: done
      Creating journal (32768 blocks): done
      Writing superblocks and filesystem accounting information: done


      Oluşturulan filesystemi mount ediyoruz
      [root@servername /]# mount /dev/mapper/vg11-BACKUP /BACKUP/


      Boot sonrasında da aktif olması için /etc/fstab dosyasını düzenliyoruz.

      [root@servername /]# vi /etc/fstab

      #
      # /etc/fstab
      # Created by anaconda on Tue Jul 11 10:39:36 2017
      #
      # Accessible filesystems, by reference, are maintained under '/dev/disk'
      # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
      #

      /dev/mapper/vg11-BACKUP /BACKUP auto defaults 0 0



Hiç yorum yok:

Yorum Gönder

Windows Server IIS üzerinden hizmet veren bir FTP servisine erişmek istediğimizde;  Internet Explorer, FileZilla vb. uygulamalar ile erişim ...