fdisk -lIf we have USB drive connected as /dev/sdc:
fdisk /dev/sdcCommand d can remove existing logical volumes on the USB drive.
Enter commands n, p, 1-3, +512M to create 3 logical volumes. For example we create first volume /dev/sdc1:
Command (m for help): p
Command (m for help): n
Partition number (1-3): 1
First sector (34-41943006, default 41940992): 34
Last sector, +sectors or +size{K,M,G,T,P}: +512M
Command (m for help): p
Command w saves new partition table and changes can not be undone.
Reload partition table:
partprobeFormat created discs:
pvcreate /dev/sdc1
pvcreate /dev/sdc2
pvcreate /dev/sdc3Verify:
pvdisplayCreate volume group DATA:
vgcreate DATA /dev/sdc1 /dev/sdc2 /dev/sdc3To be sure verify group capacity:
vgdisplayCreate physical volume from 100% of physical volume capacity.
lvcreate -l +100%FREE -n new_volume DATAFormat the new volume:
mkfs -t ext3 /dev/DATA/new_volumeCreate directory for mount:
mkdir /mnt/dynamicMount the new volume:
mount /dev/DATA/new_volume /mnt/dynamicMount verification:
df -hTMount verification using graphical interface:
system-config-lvm fdisk /dev/sdc
Command (m for help):n
Command (m for help):4
Command (m for help):p
<enter>
<enter>Command w saves new partition table and it can not be undone.
Verify partition table:
partprobeAdd new disk to physical LVL partition:
pvcreate /dev/sdc4Verify:
pvdisplayExtend volume group:
vgextend DATA /dev/sdc4Verify extended volume group:
vgdisplayExtend logical volume with 1 GB:
lvextend -L+1G /dev/DATA/new_volumeResize size of disk:
resize2fs /dev/DATA/new_volumeRemount:
mount -o remount /dev/DATA/new_volumeVerify:
df -hT umount /dev/DATA/new_volumeRemove logical volume:
lvremove /dev/DATA/new_volumeRemove volume group:
vgremove /dev/DATARemove physical volumes:
pvremove /dev/sdc1
pvremove /dev/sdc2
pvremove /dev/sdc3
pvremove /dev/sdc4Verification using graphical interface:
system-config-lvmWas this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.
We prepared for you video course Marian's BASH Video Training: Mastering Unix Shell, if you would like to get much more information.
Thank you. Marian Knezek