• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Create and Manage LVM on Parrot OS 3.9

2194

To Create and Manage LVM on Parrot OS 3.9

LVM is a widely-used technique and extremely flexible disk management scheme for deploying logical rather than physical storage. With LVM, system administrator can easily resize and extend the logical drive when it is required. It is so simple to create and manage LVM on Parrot OS 3.9, and this tutorial demonstrates the same process. 


Creating Logical Volume Management 

It is very essential to add a new hardisk of any size. And for that, you need to check out the hard disks available on your machine. Run the following command for the same purpose. Add the new hard disk.

[root@linuxhelp]?[~]
 #fdisk -l
Disk /dev/sdb: 3 GiB, 3221225472 bytes, 6291456 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/sda: 18 GiB, 19327352832 bytes, 37748736 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: 0x59ef32fc

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *       2048   976895   974848  476M 83 Linux
/dev/sda2        976896  4882431  3905536  1.9G 82 Linux swap / Solaris
/dev/sda3       4882432 37746687 32864256 15.7G 83 Linux

And then, you need to create a new Partiton using fdisk tool. Run the following command for the same purpose. 
You need to select partition type as LVM .

 

[root@linuxhelp]?[~]
#fdisk /dev/sdb
Welcome to fdisk (util-linux 2.30.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.
Created a new DOS disklabel with disk identifier 0xf6c29730.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-6291455, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-6291455, default 6291455): +1G

Created a new partition 1 of type ' Linux'  and of size 1 GiB.
 
Command (m for help): p
Disk /dev/sdb: 3 GiB, 3221225472 bytes, 6291456 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: 0xf6c29730

Device     Boot Start     End Sectors Size Id Type
/dev/sdb1        2048 2099199 2097152   1G 83 Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition ' Linux'  to ' Linux LVM' .

Command (m for help): p
Disk /dev/sdb: 3 GiB, 3221225472 bytes, 6291456 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: 0xf6c29730

Device     Boot Start     End Sectors Size Id Type
/dev/sdb1        2048 2099199 2097152   1G 8e Linux LVM

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

 

 

And then, you need to initiate the partition /dev/sdb1 as an LVM physical volume . You shall do that by making use of pvcreate.

[root@linuxhelp]?[~]
#pvcreate /dev/sdb1
  Physical volume " /dev/sdb1"  successfully created.
[root@linuxhelp]?[~] 
#pvs
  PV         VG Fmt  Attr PSize PFree
  /dev/sdb1     lvm2 ---  1.00g 1.00g

 

You can also display and scan the properties of LVM physical volumes by making use of the following command. 

[root@linuxhelp]?[~]
#pvdisplay
  " /dev/sdb1"  is a new physical volume of " 1.00 GiB" 
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name               
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               CWNuoW-xfe6-A3DY-27oo-fXtL-nV9I-4VlWpx
   
[root@linuxhelp]?[~] 
#pvscan
  PV /dev/sdb1                      lvm2 [1.00 GiB]
  Total: 1 [1.00 GiB] / in use: 0 [0   ] / in no VG: 1 [1.00 GiB]

 

You should also create a volume group with name vg_newlvm and add /dev/sdb1 partition into that group.

[root@linuxhelp]?[~]
 #vgcreate vg1 /dev/sdb1
  Volume group " vg1"  successfully created

 

After that, you need to create a logical volume. Run the following command for that purpose.

[root@linuxhelp]?[~]
#lvcreate -n lv1 -l 100%FREE vg1
  Logical volume " lv1"  created.

 

You shall check the newly created logical volumes by making use of lvdisplay command.

??[root@linuxhelp]?[~]
???? #lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg1/lv1
  LV Name                lv1
  VG Name                vg1
  LV UUID                3aT3Iz-Ap3n-e22r-XaKT-eU4B-t3kB-BjsEt3
  LV Write Access        read/write
  LV Creation host, time linuxhelp, 2017-12-05 16:49:25 +0530
  LV Status              available
  # open                 0
  LV Size                1020.00 MiB
  Current LE             255
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

Use the mkfs command to format a newly created LVM.

[root@linuxhelp]?[~]
#mkfs.ext4 /dev/vg1/lv1
mke2fs 1.43.7 (16-Oct-2017)
Creating filesystem with 261120 4k blocks and 65280 inodes
Filesystem UUID: d348b933-25b9-4dc0-aed3-9c15095fc05a
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

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

 

 

Later, you need to create the mount point and mount the new LVM as follows.

[root@linuxhelp]?[~]
#mkdir -p /data
[root@linuxhelp]?[~]
#mount /dev/vg1/lv1 /data/

 

And then, you need to verify the new disk layout in the following manner.

[root@linuxhelp]?[~]
#df -h
Filesystem           Size  Used Avail Use% Mounted on
udev                 441M     0  441M   0% /dev
tmpfs                 92M  6.6M   85M   8% /run
/dev/sda3             16G   12G  3.4G  78% /
tmpfs                456M     0  456M   0% /dev/shm
tmpfs                5.0M  4.0K  5.0M   1% /run/lock
tmpfs                456M     0  456M   0% /sys/fs/cgroup
/dev/sda1            453M   48M  378M  12% /boot
tmpfs                 92M   16K   92M   1% /run/user/1000
/dev/mapper/vg1-lv1  988M  2.6M  919M   1% /data

With this, this tutorial on Logical Volume Management in ParrotOs 3.9 comes to an end. 

Tags:
jackson
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to mirror LVM partition?

A

By using this "lvconvert" command you can mirror the LVM partition.

Q

How to mirror between two devices?

A

You can use this "pvmove" command to mirror bet

Say for example "pvmove -n /dev/vg1/lv1 /dev/sdb1 /dev/sda5" So pv move followed by two partitions

Q

How does LVM mirror differ from normal LVM?

A

LVM migration allows you to migrate the logical volumes to a new disk without any data loss and downtime.

Q

What is the maximum size of a single LV?

A

LV size is 2TB. For some older kernels, however, the limit was 1TB due to signedness problems in the block layer.

For 32-bit CPUs on 2.6 kernels, the maximum LV size is 16TB.

For 64-bit CPUs on 2.6 kernels, the maximum LV size is 8EB.

Q

How to reduce or shrink the size of the LVM partition?

A

Umount the filesystem by using "umount" command,

use resize2fs command , e.g resiz2fs /dev/mapper/myvg-mylv 10G

Related Tutorials in How to Create and Manage LVM on Parrot OS 3.9

Related Tutorials in How to Create and Manage LVM on Parrot OS 3.9

How to install Parrot security OS 3.1.1
How to install Parrot security OS 3.1.1
Aug 3, 2016
How to install Nmap Tool on ParrotOs 3.9
How to install Nmap Tool on ParrotOs 3.9
May 29, 2018
How to Manage and Create LVM on CentOS 7
How to Manage and Create LVM on CentOS 7
Mar 6, 2018
How to create and setup LUNs using LVM
How to create and setup LUNs using LVM
Jun 1, 2016
How to migrate from LVM Partitions to New Logical Volume
How to migrate from LVM Partitions to New Logical Volume
May 6, 2016
How to install ParrotOS 3.9
How to install ParrotOS 3.9
Dec 5, 2017
How to install LAMP Stack on Parrot 3.9
How to install LAMP Stack on Parrot 3.9
Dec 6, 2017
How To Manage LVM in Debian
How To Manage LVM in Debian
May 3, 2016

Related Forums in How to Create and Manage LVM on Parrot OS 3.9

Related Forums in How to Create and Manage LVM on Parrot OS 3.9

LVM (Logical Volume Manager)
connor class=
How to activate and deactivate Logical volumes, Volume group and Physical volume
Feb 16, 2017
pv command
muhammad class=
pvcreate command not found error
May 9, 2017
LVM (Logical Volume Manager)
caden class=
How to increase LVM size without unmounting
Feb 16, 2017
LVM (Logical Volume Manager)
dylan class=
How to rename Volume group in LVM without unmount
Feb 15, 2017
LVM (Logical Volume Manager)
daniel class=
To remove LVM partition in Linux
Feb 15, 2017
LVM (Logical Volume Manager)
john class=
How to create LVM for two Disks
Feb 15, 2017
LVM (Logical Volume Manager)
david class=
What is physical volume, Volume group and Logical volume concepts
Feb 15, 2017
LVM (Logical Volume Manager)
michael class=
How to display the Logical volumes created
Feb 16, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.