Total Pageviews

Friday, 21 October 2016

LVM (Logical Volume Manager) !!!

I thought of uploading posts related to Linux since many days, all these days I have posted things related to Solaris itself, so I wanted to start Linux... So the basic thing in the Linux OS is the LVM. 

ubu@ubuntu:~$ su -
Password:
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# df -kh
Filesystem                   Size  Used Avail Use% Mounted on
udev                         982M     0  982M   0% /dev
tmpfs                        201M  3.3M  197M   2% /run
/dev/mapper/ubuntu--vg-root  5.4G  1.3G  3.8G  26% /
tmpfs                       1001M     0 1001M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                       1001M     0 1001M   0% /sys/fs/cgroup
/dev/sda1                    472M   55M  393M  13% /boot
tmpfs                        100K     0  100K   0% /run/lxcfs/controllers
cgmfs                        100K     0  100K   0% /run/cgmanager/fs
tmpfs                        201M     0  201M   0% /run/user/1000
root@ubuntu:~#

For Linux machines meta devices like in Solaris we have Physical Volumes (PVs). Below is the command and output to display PV.

root@ubuntu:~# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               ubuntu-vg
  PV Size               7.52 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1925
  Free PE               0
  Allocated PE          1925
  PV UUID               KBhVnP-30fy-u8QV-IXHK-1zLE-98kR-1Ducfa
root@ubuntu:~#

As you see I already have a PV under which a VG (Volume Group) created, this is because my root disk is under LVM. So upon a PV we will create VG...

root@ubuntu:~# vgdisplay
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.52 GiB
  PE Size               4.00 MiB
  Total PE              1925
  Alloc PE / Size       1925 / 7.52 GiB
  Free  PE / Size       0 / 0
  VG UUID               9ZjLhk-IoTQ-Qfli-j9XS-PjgW-7FDv-3SaqTa

root@ubuntu:~#

Above "ubuntu-vg" is VG for my root and swap. Now LVs (Logical Volumes) comes to the scene. So you can see my lvs for root and swap below.

root@ubuntu:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                stDQ9W-X34I-4eFk-7rDq-SLRL-0kpv-hLki1z
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 1
  LV Size                5.52 GiB
  Current LE             1413
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                3K30n5-M7ew-Znww-km5q-IRQr-dqfz-E9Dtzr
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

root@ubuntu:~#

Like "format" command in Solaris, we have command "fdisk -l" to display the disks... I compare all the time because it is easy to understand somethings when we already know few similar things...

root@ubuntu:~# fdisk -l | more
Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa51c9f65

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *       2048   999423   997376  487M 83 Linux
/dev/sda2       1001470 16775167 15773698  7.5G  5 Extended
/dev/sda5       1001472 16775167 15773696  7.5G 8e Linux LVM

Disk /dev/mapper/ubuntu--vg-root: 5.5 GiB, 5926551552 bytes, 11575296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/ubuntu--vg-swap_1: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@ubuntu:~#

Now I will add few disks for our learning purpose...(It is so easy in Oracle Virtual box or VMware Workstation).

Again logging in,

ubu@ubuntu:~$
ubu@ubuntu:~$ su -
Password:
root@ubuntu:~#
root@ubuntu:~#
root@ubuntu:~# df -kh
Filesystem                   Size  Used Avail Use% Mounted on
udev                         982M     0  982M   0% /dev
tmpfs                        201M  3.3M  197M   2% /run
/dev/mapper/ubuntu--vg-root  5.4G  1.3G  3.8G  26% /
tmpfs                       1001M     0 1001M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                       1001M     0 1001M   0% /sys/fs/cgroup
/dev/sda1                    472M   55M  393M  13% /boot
cgmfs                        100K     0  100K   0% /run/cgmanager/fs
tmpfs                        100K     0  100K   0% /run/lxcfs/controllers
tmpfs                        201M     0  201M   0% /run/user/1000
root@ubuntu:~#

This time let us see output which we require,

root@ubuntu:~# fdisk -l | grep /dev/sd
Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
/dev/sda1  *       2048   999423   997376  487M 83 Linux
/dev/sda2       1001470 16775167 15773698  7.5G  5 Extended
/dev/sda5       1001472 16775167 15773696  7.5G 8e Linux LVM
Disk /dev/sdb: 100 MiB, 104857600 bytes, 204800 sectors
Disk /dev/sdc: 100 MiB, 104857600 bytes, 204800 sectors
Disk /dev/sdd: 100 MiB, 104857600 bytes, 204800 sectors
root@ubuntu:~#

root@ubuntu:~# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               ubuntu-vg
  PV Size               7.52 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              1925
  Free PE               0
  Allocated PE          1925
  PV UUID               KBhVnP-30fy-u8QV-IXHK-1zLE-98kR-1Ducfa

root@ubuntu:~#

Let us create PVs from disks we added,

root@ubuntu:~# pvcreate /dev/sdb /dev/sdc /dev/sdd
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created
  Physical volume "/dev/sdd" successfully created
root@ubuntu:~#

root@ubuntu:~# pvdisplay /dev/sdb /dev/sdc /dev/sdd
  "/dev/sdd" is a new physical volume of "100.00 MiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdd
  VG Name
  PV Size               100.00 MiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               TFtlnW-ZiPx-GrQc-ws9d-md37-i8ij-QeB9gG

  "/dev/sdb" is a new physical volume of "100.00 MiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb
  VG Name
  PV Size               100.00 MiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               j7O15i-NSPS-ppJO-0263-x1hP-P222-veof5g

  "/dev/sdc" is a new physical volume of "100.00 MiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc
  VG Name
  PV Size               100.00 MiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               tNCHDy-8bdJ-JFS6-Zfhe-TFLK-YQgz-iDL9Lt

root@ubuntu:~#

Its time to create VG on our PV...

root@ubuntu:~# vgdisplay
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.52 GiB
  PE Size               4.00 MiB
  Total PE              1925
  Alloc PE / Size       1925 / 7.52 GiB
  Free  PE / Size       0 / 0
  VG UUID               9ZjLhk-IoTQ-Qfli-j9XS-PjgW-7FDv-3SaqTa

root@ubuntu:~#

root@ubuntu:~# vgcreate vol1 /dev/sdb /dev/sdc /dev/sdd
  Volume group "vol1" successfully created
root@ubuntu:~#

root@ubuntu:~# vgdisplay
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.52 GiB
  PE Size               4.00 MiB
  Total PE              1925
  Alloc PE / Size       1925 / 7.52 GiB
  Free  PE / Size       0 / 0
  VG UUID               9ZjLhk-IoTQ-Qfli-j9XS-PjgW-7FDv-3SaqTa

  --- Volume group ---
  VG Name               vol1
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               288.00 MiB
  PE Size               4.00 MiB
  Total PE              72
  Alloc PE / Size       0 / 0
  Free  PE / Size       72 / 288.00 MiB
  VG UUID               Kpd01H-UQqs-n1f9-VVA3-6buC-f1EO-pTK7v1

root@ubuntu:~#

Then its time for LV....

root@ubuntu:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                stDQ9W-X34I-4eFk-7rDq-SLRL-0kpv-hLki1z
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 1
  LV Size                5.52 GiB
  Current LE             1413
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                3K30n5-M7ew-Znww-km5q-IRQr-dqfz-E9Dtzr
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

root@ubuntu:~#

Mine is latest ubuntu server, so the default Filesystem will be ext4...

root@ubuntu:~# lvcreate -L 50M vol1 -n mydata1
  Rounding up size to full physical extent 52.00 MiB
WARNING: ext4 signature detected on /dev/vol1/mydata1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/vol1/mydata1.
  Logical volume "mydata1" created.
root@ubuntu:~#
root@ubuntu:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                stDQ9W-X34I-4eFk-7rDq-SLRL-0kpv-hLki1z
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 1
  LV Size                5.52 GiB
  Current LE             1413
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                3K30n5-M7ew-Znww-km5q-IRQr-dqfz-E9Dtzr
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

  --- Logical volume ---
  LV Path                /dev/vol1/mydata1
  LV Name                mydata1
  VG Name                vol1
  LV UUID                rggxbf-Tenn-kEZA-FdkQ-aRUb-umHP-o0wLoL
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-06 18:13:53 -0400
  LV Status              available
  # open                 0
  LV Size                52.00 MiB
  Current LE             13
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

root@ubuntu:~#

One more volume, 

root@ubuntu:~# lvcreate -L 150M vol1 -n mydata2
  Rounding up size to full physical extent 152.00 MiB
WARNING: ext4 signature detected on /dev/vol1/mydata2 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/vol1/mydata2.
  Logical volume "mydata2" created.
root@ubuntu:~#

root@ubuntu:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                stDQ9W-X34I-4eFk-7rDq-SLRL-0kpv-hLki1z
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 1
  LV Size                5.52 GiB
  Current LE             1413
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                3K30n5-M7ew-Znww-km5q-IRQr-dqfz-E9Dtzr
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-04 19:35:42 -0400
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

  --- Logical volume ---
  LV Path                /dev/vol1/mydata1
  LV Name                mydata1
  VG Name                vol1
  LV UUID                rggxbf-Tenn-kEZA-FdkQ-aRUb-umHP-o0wLoL
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-06 18:13:53 -0400
  LV Status              available
  # open                 0
  LV Size                52.00 MiB
  Current LE             13
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2

  --- Logical volume ---
  LV Path                /dev/vol1/mydata2
  LV Name                mydata2
  VG Name                vol1
  LV UUID                jjFSn5-TE2X-13fq-j9we-QCwf-7ZJk-9H6FOl
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2016-10-06 18:14:10 -0400
  LV Status              available
  # open                 0
  LV Size                152.00 MiB
  Current LE             38
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:3
root@ubuntu:~#

Once done with the LV creation we should make FS on our volume...

root@ubuntu:~# mkfs.ext4 /dev/vol1/mydata1
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 53248 1k blocks and 13328 inodes
Filesystem UUID: e49e7c09-88fa-44c1-b988-2cef549dd049
Superblock backups stored on blocks:
        8193, 24577, 40961

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

root@ubuntu:~#

FS creation for our second volume...

root@ubuntu:~# mkfs.ext4 /dev/vol1/mydata2
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 155648 1k blocks and 38912 inodes
Filesystem UUID: c5bdb3ce-eb8a-4e31-89df-33dc802548d6
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729

Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
root@ubuntu:~#

root@ubuntu:~# mkdir -p /data1
root@ubuntu:~#
root@ubuntu:~# mkdir -p /data2
root@ubuntu:~#

Now I will mount the FS...

root@ubuntu:~# mount /dev/vol1/mydata1 /data1
root@ubuntu:~#
root@ubuntu:~# mount /dev/vol1/mydata2 /data2
root@ubuntu:~#
root@ubuntu:~# df -kh
Filesystem                   Size  Used Avail Use% Mounted on
udev                         982M     0  982M   0% /dev
tmpfs                        201M  3.3M  197M   2% /run
/dev/mapper/ubuntu--vg-root  5.4G  1.3G  3.8G  26% /
tmpfs                       1001M     0 1001M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                       1001M     0 1001M   0% /sys/fs/cgroup
/dev/sda1                    472M   55M  393M  13% /boot
cgmfs                        100K     0  100K   0% /run/cgmanager/fs
tmpfs                        100K     0  100K   0% /run/lxcfs/controllers
tmpfs                        201M     0  201M   0% /run/user/1000
/dev/mapper/vol1-mydata1      47M  842K   42M   2% /data1
/dev/mapper/vol1-mydata2     144M  1.6M  132M   2% /data2
root@ubuntu:~#

To make it permanent mount, to mount at boot time just add the entries in the /etc/fstab file...

root@ubuntu:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=8d74a25e-fef8-45d4-ab90-1cb14910d7f0 /boot           ext2    defaults        0       2
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
root@ubuntu:~#

root@ubuntu:~# vi /etc/fstab
root@ubuntu:~#

root@ubuntu:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/ubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=8d74a25e-fef8-45d4-ab90-1cb14910d7f0 /boot           ext2    defaults        0       2
/dev/mapper/ubuntu--vg-swap_1 none            swap    sw              0       0
/dev/vol1/mydata1 /data1               ext4    rw 0       1
/dev/vol1/mydata2 /data2               ext4    rw 0       1
root@ubuntu:~#

After rebooting...

login as: ubu@10.0.0.143's password:
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-31-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

79 packages can be updated.
41 updates are security updates.

Last login: Thu Oct  6 18:44:28 2016
ubu@ubuntu:~$
ubu@ubuntu:~$ df -kh
Filesystem                   Size  Used Avail Use% Mounted on
udev                         982M     0  982M   0% /dev
tmpfs                        201M  3.4M  197M   2% /run
/dev/mapper/ubuntu--vg-root  5.4G  1.3G  3.8G  26% /
tmpfs                       1001M     0 1001M   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                       1001M     0 1001M   0% /sys/fs/cgroup
/dev/sda1                    472M   55M  393M  13% /boot
/dev/mapper/vol1-mydata2     144M  1.6M  132M   2% /data2
/dev/mapper/vol1-mydata1      47M  842K   42M   2% /data1
cgmfs                        100K     0  100K   0% /run/cgmanager/fs
tmpfs                        201M     0  201M   0% /run/user/0
tmpfs                        201M     0  201M   0% /run/user/1000
ubu@ubuntu:~$

That's it for the volume and filesystem creation under LVM...

####################################################################################

2 comments:

  1. Lokesh, you are awesome ra. I am searching for Apache Web configuration Then I got to know still you are keep posting the stuff...Thanks..:)
    Siva :) :)

    ReplyDelete
    Replies
    1. Hi Shiva,

      How r u?? You are welcome. I am glad you liked my post.
      Its just a hobby whenever I get some free time, I feel like posting something.

      Delete