Step 1

[root@subash ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             5.4G     0  5.4G   0% /dev

tmpfs                5.4G     0  5.4G   0% /dev/shm

tmpfs                5.4G   13M  5.4G   1% /run

tmpfs                5.4G     0  5.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   25G   11G   15G  42% /

/dev/sda1            5.7G  303M  5.1G   6% /boot

/dev/mapper/ol-temp   20G   45M   19G   1% /temp

/dev/mapper/ol-u01   287G   47G  226G  17% /u01

tmpfs                1.1G   24K  1.1G   1% /run/user/0

[root@subash ~]# partprobe

Step 2 : To check the block

[root@subash ~]# lsblk

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

sda           8:0    0   390G  0 disk

├─sda1        8:1    0   5.9G  0 part /boot

└─sda2        8:2    0 354.1G  0 part

├─ol-root 249:0    0    25G  0 lvm  /

├─ol-swap 249:1    0    18G  0 lvm  [SWAP]

├─ol-temp 249:2    0    20G  0 lvm  /temp

└─ol-u01  249:3    0 291.1G  0 lvm  /u01

sdb           8:16   0    10G  0 disk

sr0          11:0    1  1024M  0 rom

 

Step 3 : To check the PVdisplay

[root@subash ~]# pvdisplay

— Physical volume —

PV Name               /dev/sda2

VG Name               ol

PV Size               <354.14 GiB / not usable 3.00 MiB

Allocatable           yes (but full)

PE Size               4.00 MiB

Total PE              90658

Free PE               0

Allocated PE          90658

PV UUID               2BoLTV-2XEq-3TPr-eEK8-Akw1-iT9E-M1rXi9

Step 4 : To check the VG-display

[root@subash ~]# vgdisplay

— Volume group —

VG Name               ol

System ID

Format                lvm2

Metadata Areas        1

Metadata Sequence No  5

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                4

Open LV               4

Max PV                0

Cur PV                1

Act PV                1

VG Size               354.13 GiB

PE Size               4.00 MiB

Total PE              90658

Alloc PE / Size       90658 / 354.13 GiB

Free  PE / Size       0 / 0

VG UUID               7mUrR8-pSbE-mlGn-q771-T1cd-mwgE-nmIcXS

   Step 5 : To check the lvdisplay

[root@subash ~]# lvdisplay

— Logical volume —

LV Path                /dev/ol/temp

LV Name                temp

VG Name                ol

LV UUID                0QGQNQ-d8kn-dmvT-wL5M-1eSL-3G6f-LyIMr4

LV Write Access        read/write

LV Creation host, time subash.ebs.com, 2020-07-21 12:14:38 +0530

LV Status              available

# open                 1

LV Size                20.00 GiB

Current LE             5120

Segments               1

Allocation             inherit

Read ahead sectors     auto

– currently set to     8192

Block device           249:2

 

— Logical volume —

LV Path                /dev/ol/swap

LV Name                swap

VG Name                ol

LV UUID                Gq99hH-NxAr-vXfb-GfDN-4ahl-bjh8-uYNlLc

LV Write Access        read/write

LV Creation host, time subash.ebs.com, 2020-07-21 12:14:38 +0530

LV Status              available

# open                 2

LV Size                18.00 GiB

Current LE             4608

Segments               1

Allocation             inherit

Read ahead sectors     auto

– currently set to     8192

Block device           249:1

 

— Logical volume —

LV Path                /dev/ol/root

LV Name                root

VG Name                ol

LV UUID                F0qHty-220k-YAaL-VP2Y-hGi4-fD5R-JrEbqE

LV Write Access        read/write

LV Creation host, time subash.ebs.com, 2020-07-21 12:14:38 +0530

LV Status              available

# open                 1

LV Size                25.00 GiB

Current LE             6400

Segments               1

Allocation             inherit

Read ahead sectors     auto

– currently set to     8192

Block device           249:0

 

— Logical volume —

LV Path                /dev/ol/u01

LV Name                u01

VG Name                ol

LV UUID                1z6wMS-TPPh-aUyH-Z0QQ-6Hws-tdAG-pDEOWt

LV Write Access        read/write

LV Creation host, time subash.ebs.com, 2020-07-21 12:14:39 +0530

LV Status              available

# open                 1

LV Size                291.13 GiB

Current LE             74530

Segments               1

Allocation             inherit

Read ahead sectors     auto

– currently set to     8192

Block device           249:3

  Step – 6 To create the sdb

[root@subash ~]# pvcreate /dev/sdb

Physical volume “/dev/sdb” successfully created.

[root@subash ~]# man vgcreate

[root@subash ~]# vgcreate ol /dev/sda2 /dev/sdb

/dev/ol: already exists in filesystem

Run `vgcreate –help’ for more information.

[root@subash ~]# vgdisplay

— Volume group —

VG Name               ol

System ID

Format                lvm2

Metadata Areas        1

Metadata Sequence No  5

VG Access             read/write

VG Status             resizable

MAX LV                0

Cur LV                4

Open LV               4

Max PV                0

Cur PV                1

Act PV                1

VG Size               354.13 GiB

PE Size               4.00 MiB

Total PE              90658

Alloc PE / Size       90658 / 354.13 GiB

Free  PE / Size       0 / 0

VG UUID               7mUrR8-pSbE-mlGn-q771-T1cd-mwgE-nmIcXS

 

[root@subash ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             5.4G     0  5.4G   0% /dev

tmpfs                5.4G     0  5.4G   0% /dev/shm

tmpfs                5.4G   13M  5.4G   1% /run

tmpfs                5.4G     0  5.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   25G   11G   15G  42% /

/dev/sda1            5.7G  303M  5.1G   6% /boot

/dev/mapper/ol-temp   20G   45M   19G   1% /temp

/dev/mapper/ol-u01   287G   47G  226G  17% /u01

tmpfs                1.1G   24K  1.1G   1% /run/user/0

 

[root@subash ~]# vgcreate ol /dev/sdb

/dev/ol: already exists in filesystem

Run `vgcreate –help’ for more information.

[root@subash ~]# vgcreate –help

vgcreate – Create a volume group

 

vgcreate VG_new PV …

[ -A|–autobackup y|n ] [ -c|–clustered y|n ] [ -l|–maxlogicalvolumes Number ] [ -p|–maxphysicalvolumes Number ] [ -M|–metadatatype lvm2|lvm1 ] [ -s|–physicalextentsize Size[m|UNIT] ] [ -f|–force ] [ -Z|–zero y|n ] [    –addtag Tag ] [    –alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] [    –metadataprofile String ] [    –labelsector Number ] [    –metadatasize Size[m|UNIT] ] [    –pvmetadatacopies 0|1|2 ] [    –vgmetadatacopies all|unmanaged|Number ] [    –reportformat basic|json ] [    –dataalignment Size[k|UNIT] ] [    –dataalignmentoffset Size[k|UNIT] ] [    –shared ] [    –systemid String ] [    –locktype sanlock|dlm|none ] [ COMMON_OPTIONS ]

 

Common options for lvm:

[ -d|–debug ] [ -h|–help ] [ -q|–quiet ] [ -v|–verbose ] [ -y|–yes ] [ -t|–test ] [    –commandprofile String ] [    –config String ] [    –driverloaded y|n ] [    –lockopt String ] [    –longhelp ] [    –profile String ] [    –version ]

 

Use –longhelp to show all options and advanced commands.

[root@subash ~]# dd if=/dev/zero of=/usr/tmp-dir bs=1024M count=2

2+0 records in

2+0 records out

2147483648 bytes (2.1 GB) copied, 27.0306 s, 79.4 MB/s

[root@subash ~]# mke2fs -j /usr/tmp-dir

\mke2fs 1.42.9 (28-Dec-2013)

/usr/tmp-dir is not a block special device.

Proceed anyway? (y,n) y

[root@subash ~]# mount -t ext3 -o loop /usr/tmp-dir /tmp

mount: wrong fs type, bad option, bad superblock on /dev/loop0,

missing codepage or helper program, or other error

 

In some cases useful info is found in syslog – try

dmesg | tail or so.

[root@subash ~]# mount -t ext3 -o loop /usr/tmp-dir /tmp

mount: wrong fs type, bad option, bad superblock on /dev/loop0,

missing codepage or helper program, or other error

 

In some cases useful info is found in syslog – try

dmesg | tail or so.

[root@subash ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             5.4G     0  5.4G   0% /dev

tmpfs                5.4G     0  5.4G   0% /dev/shm

tmpfs                5.4G   13M  5.4G   1% /run

tmpfs                5.4G     0  5.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   25G   13G   13G  50% /

/dev/sda1            5.7G  303M  5.1G   6% /boot

/dev/mapper/ol-temp   20G   45M   19G   1% /temp

/dev/mapper/ol-u01   287G   47G  226G  17% /u01

tmpfs                1.1G   24K  1.1G   1% /run/user/0

 

[root@subash ~]# lsblk

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

sda           8:0    0   390G  0 disk

├─sda1        8:1    0   5.9G  0 part /boot

└─sda2        8:2    0 354.1G  0 part

├─ol-root 249:0    0    25G  0 lvm  /

├─ol-swap 249:1    0    18G  0 lvm  [SWAP]

├─ol-temp 249:2    0    20G  0 lvm  /temp

└─ol-u01  249:3    0 291.1G  0 lvm  /u01

sdb           8:16   0    10G  0 disk

sr0          11:0    1  1024M  0 rom

[root@subash ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0x2a77af4d.

 

Command (m for help): m

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibility flag

d   delete a partition

g   create a new empty GPT partition table

G   create an IRIX (SGI) partition table

l   list known partition types

m   print this menu

n   add a new partition

o   create a new empty DOS partition table

p   print the partition table

q   quit without saving changes

s   create a new empty Sun disklabel

t   change a partition’s system id

u   change display/entry units

v   verify the partition table

w   write table to disk and exit

x   extra functionality (experts only)

 

Command (m for help): l

 

0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris

1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-

2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-

3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-

4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx

5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data

6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .

7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility

8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt

9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access

a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O

b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor

c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs

e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT

f  W95 Ext’d (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/

10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b

11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor

12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor

14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary

16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS

17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE

18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto

1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep

1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT

1e  Hidden W95 FAT1 80  Old Minix

 

Command (m for help): 8e

8: unknown command

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibility flag

d   delete a partition

g   create a new empty GPT partition table

G   create an IRIX (SGI) partition table

l   list known partition types

m   print this menu

n   add a new partition

o   create a new empty DOS partition table

p   print the partition table

q   quit without saving changes

s   create a new empty Sun disklabel

t   change a partition’s system id

u   change display/entry units

v   verify the partition table

w   write table to disk and exit

x   extra functionality (experts only)

 

Command (m for help): n

Partition type:

p   primary (0 primary, 0 extended, 4 free)

e   extended

Select (default p):

Using default response p

Partition number (1-4, default 1):

First sector (2048-20971519, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): 6G

Value out of range.

Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):

Using default value 20971519

Partition 1 of type Linux and of size 10 GiB is set

 

Command (m for help): p

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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 label type: dos

Disk identifier: 0x2a77af4d

 

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    20971519    10484736   83  Linux

 

Command (m for help): m

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibility flag

d   delete a partition

g   create a new empty GPT partition table

G   create an IRIX (SGI) partition table

l   list known partition types

m   print this menu

n   add a new partition

o   create a new empty DOS partition table

p   print the partition table

q   quit without saving changes

s   create a new empty Sun disklabel

t   change a partition’s system id

u   change display/entry units

v   verify the partition table

w   write table to disk and exit

x   extra functionality (experts only)

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@subash ~]# partprobe

[root@subash ~]# lsblk

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

sda           8:0    0   390G  0 disk

├─sda1        8:1    0   5.9G  0 part /boot

└─sda2        8:2    0 354.1G  0 part

├─ol-root 249:0    0    25G  0 lvm  /

├─ol-swap 249:1    0    18G  0 lvm  [SWAP]

├─ol-temp 249:2    0    20G  0 lvm  /temp

└─ol-u01  249:3    0 291.1G  0 lvm  /u01

sdb           8:16   0    10G  0 disk

└─sdb1        8:17   0    10G  0 part

sr0          11:0    1  1024M  0 rom

[root@subash ~]# pvcreate /dev/sdb1

Physical volume “/dev/sdb1” successfully created.

[root@subash ~]# vgextend ol /dev/sdb1

Volume group “ol” successfully extended

[root@subash ~]# lvextend -L +5G /dev/mapper/ol-uo1

Logical volume uo1 not found in volume group ol.

[root@subash ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             5.4G     0  5.4G   0% /dev

tmpfs                5.4G     0  5.4G   0% /dev/shm

tmpfs                5.4G   13M  5.4G   1% /run

tmpfs                5.4G     0  5.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   25G   13G   13G  50% /

/dev/sda1            5.7G  303M  5.1G   6% /boot

/dev/mapper/ol-temp   20G   45M   19G   1% /temp

/dev/mapper/ol-u01   287G   47G  226G  17% /u01

tmpfs                1.1G   24K  1.1G   1% /run/user/0

[root@subash ~]# lvextend -L +5G /dev/ol/ol-uo1

Logical volume ol-uo1 not found in volume group ol.

[root@subash ~]# lvextend -L +5G /dev/mapper/ol-u01

Size of logical volume ol/u01 changed from 291.13 GiB (74530 extents) to 296.13 GiB (75810 extents).

Logical volume ol/u01 successfully resized.

[root@subash ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             5.4G     0  5.4G   0% /dev

tmpfs                5.4G     0  5.4G   0% /dev/shm

tmpfs                5.4G   13M  5.4G   1% /run

tmpfs                5.4G     0  5.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   25G   13G   13G  50% /

/dev/sda1            5.7G  303M  5.1G   6% /boot

/dev/mapper/ol-temp   20G   45M   19G   1% /temp

/dev/mapper/ol-u01   287G   47G  226G  17% /u01

tmpfs                1.1G   24K  1.1G   1% /run/user/0

[root@subash ~]# man resize2fs

[root@subash ~]# resize2fs /dev/mapper/ol-u01

resize2fs 1.42.9 (28-Dec-2013)

Filesystem at /dev/mapper/ol-u01 is mounted on /u01; on-line resizing required

old_desc_blocks = 37, new_desc_blocks = 38

The filesystem on /dev/mapper/ol-u01 is now 77629440 blocks long.

 

[root@subash ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             5.4G     0  5.4G   0% /dev

tmpfs                5.4G     0  5.4G   0% /dev/shm

tmpfs                5.4G   13M  5.4G   1% /run

tmpfs                5.4G     0  5.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   25G   13G   13G  50% /

/dev/sda1            5.7G  303M  5.1G   6% /boot

/dev/mapper/ol-temp   20G   45M   19G   1% /temp

/dev/mapper/ol-u01   292G   47G  231G  17% /u01

tmpfs                1.1G   24K  1.1G   1% /run/user/0

 

Recent Posts

Start typing and press Enter to search