/boot /dev/hda1 50 Megabytes swap /dev/hda2 256 Megabytes /dev/hda3 2 Gigabytes /home & nbsp; /dev/hda4 6 GigabytesIn this example, if the user wishes to increase the root partition, it would have to reformat your disk, or even move part of the data to another disk and mount the new partition as a root directory. Whereas, if the user uses LVM, he could simply decrease the size of /home and increase the root, or even add another disk and increase the root, without having to back up the data, format the partition, and copy the data back. Look at the same example using volumes:
/boot /dev/hda1 50Mb swap /dev/vg00/swap 256Mb /& nbsp; /dev/vg00/root 2 Gigabytes /home /dev/vg00/home 6 GigabytesIn large systems with many disks, it is almost impossible to manage the disks without the use of LVM. It’s important that you know that there are two versions of LVM: 1 and 2. Version 2 is supported by Kernel 2.6 and 3.x, and by Kernel 2.4 with the application of some patches. The only Linux partition that cannot be used with the volume manager is /boot.
# pvcreate /dev/sdb Physical volume “/dev/sdb” successfully created # pvcreate /dev/sdc Physical volume “/dev/sdc” created successfullyRemember to first change the type of the partitions with fdisk to 8e.
# vgcreate myvolume /dev/sdb /dev/sdc Volume group “myvolume” successfully created
# vgchange -a y myvolume 0 logical volume (s) in volume group “myvolume” now activeAfter the system is rebooted it is necessary to activate the volume group again. Therefore, it is necessary to include this command in the system load scripts.
# vgchange -a in my volume # vg remove my volume
# vg reduce my volume /dev/sdd
# lvcreate -L 1000 -n logic1 myvolume Logical volume “logic1” createdSince SDB and SDC each have 2GB, it is possible to create up to 4 volumes of 1GB each, or a single logical volume of 4GB, as in the example below:
# lvcreate -L 4000 -n logic1 my volume Logical volume “logic1” created
ACTIVATE: # lvchange -a and /dev/myvolume/logic1 DISABLE: # lvchange -a n /dev/myvolume/logic1
# mkfs.ext4 /dev/myvolume/logic1 mke2fs 1.41.14 (22-Dec-2010) Filesystem label= OS type: Linux (…) Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 25 mounts or 180 days, Whichever comes first. Use tune2fs -c or -i to override.After formatting the logical volume, it is necessary assemble it:
# mount /dev/myvolume/logic1 /dataAfter these steps, the logical volume will be ready for use.
# pvcreate /dev/hda8Assign it to the group:
# vgextend my /dev/hda8 groupDisassemble the logical volume:
# umount /dev/myvolume/logic1Increase the logical volume group:
# lvextend -L +13090M /dev/myvolume/logic1Search for error and repair:
# e2fsck -f /dev/myvolume/logic1Finally, we resized:
# resize2fs /dev/myvolume/logic1Now just assemble:
# mount /dev/myvolume/logic1 /dataDecreasing volume size Unmount the file system:
# umount /dev/myvolume/logic1Check the logical volume for errors:
# e2fsck -f /dev/myvolume/logic1Shrink the partition:
# resize2fs /dev/myvolume/logic1 524288Lower the logical volume:
# lvreduce -L -50M //dev/myvolume/logic1Remount the file system:
# mount /dev/myvolume/logic1 /data
The sudo command on Linux executes a given command as if it were another user.…
The ss command on Linux is extremely useful for investigating sockets, providing various information about…
Free Linux command shows the amount of total memory in use and available, as well…
The shell has structures for testing conditions and executing certain program sequences several times (loop),…
The /etc/fstab file stores the configuration of which devices should be mounted and what is…
The Netcat Command in Linux or nc is a utility used to do “almost anything”…
This website uses cookies.