Linux Logical Volume Management

Source: Internet
Author: User

One, the extended hard disk partition:fdisk/dev/sdbpartprobe //Do not restart to make the above operation effective   format:mkfs.ext3/dev/sdb1  Second, the steps to create a logical Volume: 1, Using the pvcreate command to process the Linux partition into physical volume (PV) 2, the created physical volume is processed by the Vgcreate command to a volume group (VG) 3, the volume group is divided into several logical volumes (LV) through the lvcreate command, we can format, mount, Delete, and so on, you can dynamically resize the logical volume, and the operation does not affect our data on the logical volume.  pvcreate/dev/sdb{1,2,3 ...} Pvscan View Physical Volume Information  pvdisplay view detailed parameters for each physical volume pvdisplay  [/dev/sdb{1,2,3 ...}]  pvremove Delete Physical Volume  vgcreate Create Volume group format: vgcreate [-S <8m|16m|...>] vg0/dev/sdb{1,2,3}  Vgdisplay View detailed parameters for individual volume groups  vgscan View information for a volume group Vgreduce shrinking a volume group: Removing a physical volume from a volume group Vgextend Extended Volume group: Adding a physical volume to a volume group Vgremove delete volume Group   v. Creation and management of logical volumes lvcreate creating logical volumes: Lvcreate-l 513m-n data vg0  format logical volumes: Mkfs.ext3/dev/vg0/datalvscan view Logical Volume Information  lvdisplay To view the specific parameters of a logical volume increase the logical volume size: lvextend command: lvextend-l +100m/dev/vg0/data  reduce the size of the logical Volume: Lvreduce-l -100m/dev/vg0/data  Resize2fs/dev/vg0/data make the above added immediate effect  lvremove Delete logical volumes   Six, LVM snapshots: 1, Snapshot creation: Lvcreate-l 64-s-N databack/dev/vg0/ data 2, snapshot deletion:lvremove/dev/vg0/databackup  VII, Mount  mount/dev/volgroup00/data/tmp/133 Set Persistent mount: #vi/etc/fstab/dev/volgroup0/data /tmp/123   ext3   defaults  1  2        assuming that the new hard drive is/dev/sdb (the IDE hard disk is/DEV/HDB), first use the FDISK command to create at least one new partition, such as/DEV/SDB1, and use the Fdisk tool's T command to modify the partition type to 8e (the type of LVM). Next: 1) Build physical Volume: pvcreate/dev/sdb1 2) Expand the original volume group, do not know your original volume group name, here is assumed to be vg0. Or you can use Vgscan to scan to get Vgextend/dev/vg0/dev/sdb13) DF to check where the original logical volume was mounted, assuming/MNTUMOUNT/MNT4) to extend your logical volume, The name of the logical volume can be seen in the DF command in the third step, assuming lv0lvextend-l +300m/dev/vg0/lv05) resize2fs/dev/vg0/lv06) mount/dev/vg0/lv0/mnt   http://wenku.baidu.com/view/8c73e8fff705cc17552709a7.html    --mount file system can not be extended?? [[email protected] ~]# resize2fs/dev/volgroup00/logvol00resize2fs 1.35 (28-feb-2004)/dev/VolGroup00/LogVol00 is mounted; Can ' t resize a mounted filesystem!  mke2fs-j/dev/logical Volume Group/Logical volume name  --[[email protected] ~]# mkfs-t ext3 VI Rtual_disk creating file Systems     directories within the same volume group, such as Mount-t EXT3/DEV/VOLGROUP00/LOGVOL02/HOME/CATTSOFT/ZCXC, the original data is unaffected , UmouNT post data is fine.    LV to first designate the partition flag as the 8e  Linux Lvmfdisk/dev/sdat input partition number, if you want to specify SDA10 enter 10, enter the input 8e, carriage return such as:/dev/sda10          55330       72809   140408100   8e  Linux lvm & nbsp;=============================================  to expand a hard drive in the Harvester: 1. Create a physical partition (PE): [[email protected] ~]# Fdisk/dev/sdb the number of cylinders for this disk was set to 70006.There are nothing wrong with that, but this is LA Rger than 1024,and could in certain setups cause problems with:1) software This runs at boot time (e.g., old versions of L ILO) 2) booting and partitioning software from other oss    (e.g., DOS fdisk, OS/2 fdisk)  command (M-Help ): Ncommand action   e   extended   p   primary partition (1-4) ppartition Number (1-4): 1First cylinder (1-70006, default 1): Using default value 1Last cylinder or +size or +sizem or +sizek (1-7000 6, default 70006): Using default Value 70006 command (M for help): Wthe partition table have been altered! calling ioctl () to re-read partition table. Syncing disks. [[email protected] ~]# partprobe //Do not restart to make the above operation effective  2, create a physical partition:[[email  Protected] ~]# pvcreate/dev/sdb1 3, expansion of existing volume group with new hard disk VolGroup00 "A volume group was not created originally": [[email protected] ~]#  Vgextend Volgroup/dev/sdb1 4, creating a new logical volume (The used logical volume needs to be umount before it can be extended): Lvcreate-l 515g-n  lv_home volgroup 5, Format Logical Volume: MKFS.EXT4/DEV/VOLGROUP/LV_HOME&NBSP;MKFS.EXT4/DEV/SDB1&NBSP;6, create new directory (can also be used): Mkdir/home 7, To mount a logical volume to a new directory: MOUNT/DEV/VOLGROUP00/LV_HOME/HOMEMOUNT/DEV/SDB1  /home 8, setting permanent mount: #vi/etc/fstab/dev/ volgroup00/lv_home/home                   ext4    DEFAULTS&NB Sp       1 3 (complete)/dev/sdb1               /home    &NBS P            ext4    defaults      &NBSp 1 3

Linux Logical Volume management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.