linux, virtualbox and centOS7 Add a new 20GB hard disk to CentOS1 in the virtual
ID: 3840403 • Letter: L
Question
linux, virtualbox and centOS7
Add a new 20GB hard disk to CentOS1 in the virtual machine’s storage settings then do the following:
*Use fdisk to create a single LVM partition on the new 20GB hard disk.
*Setup the 20GB LVM parition as a LVM physical volume.
*Create a new volume group called vg and add the new 20GB physical volume to it.
*Create 3 new logical volumes within the volume group each 5GB in size (names: backup, data, videos).
*Format the first logical volume (backup) as ext3.
*Format the second logical volume (data) as ext4.
*Format the third logical volume (videos) as xfs.
*Create mount points for each logical volume in /mnt (/mnt/backup, /mnt/data, /mnt/videos).
*Manually use the mount command to mount each logical volume to the new directories created in /mnt.
*Add entries in /etc/fstab for the new logical volumes so that they are mounted during startup.
Explanation / Answer
ANSWER:
list the disk using below command:
#fdisk - 1
Now partition the listed disk, Consider xyz as listed disk
#fdisk/dev/xyz
use 'n' to create the partition and save the changes with 'w' command.
partition type: p (select 'p' for primary partition)
Define the size of the partition:
Last sector, +sectors or +size{K,M,G}: +20G
After partitioning use below command to verify your partition:
# fdisk -l
Creating physical Volume use below command:
# pvcreate/dev/xyz
Create volume group vg using below command:
# vgcreate testvg/dev/xyz/dev/vg
you can use below command's to display all the details of the volume group:
# vgdisplay
Now to create 3 new logical volumes within the volume group each 5GB in size (names: backup, data, videos)
# lvcreate -n backup --size 5G vg
# lvcreate -n data --size 5G vg
# lvcreate -n videos --size 5G vg
Format the first logical volume (backup) as ext3
# mkfs.ext3/dev/vg/backup
Format the second logical volume (data) as ext4
# mkfs.ext4/dev/vg/data
Format the third logical volume (videos) as xfs
# mkfs.xfs/dev/vg/videos
Mounting
# mkdir/mnt/dev/vg
# mount/dev/mnt/backup
#mkdir/mnt/dev/vg
# mount/dev/mnt/data
#mkdir/mnt/dev/vg
#mount /dev/mnt/videos
To check the mount status use below command:
$ mount
Adding entries in /etc/fstab for the new logical volumes so that they are mounted during startup add the below line in /etc/fstab
/dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt ext3 defaults 0 0
/dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt ext4 defaults 0 0
/dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt xfs defaults 0 0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.