Record the log of creating LVM at one time and create LVM log records

Source: Internet
Author: User

Record the log of creating LVM at one time and create LVM log records

First, let's take a picture of laruence LVM. I feel this is the clearest picture.

 

# The following is a direct record using the Xshell logging system. Some Comments [BEGIN] 9:22:24 # Check the hard disk first. [root @ iZ23h637rtdZ ~] # Fdisk-lDisk/dev/vda: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00078f9c Device Boot Start End Blocks Id System/dev/vda1 * 1 7833 62912512 83 LinuxDisk/dev/vdb: 536.9 GB, 536870912000 bytes255 heads, 6 3 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal ): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System/dev/vdb1 1 65270 524281243 + 8e Linux LVM # The above shows that LVM already exists. however, to facilitate the demonstration. next, delete this [root @ iZ23h637rtdZ ~]. # Fdisk/dev/vdbWARNING: DOS-compatible mode is deprecated. it's stronugly recommended to switch off the mode (command 'C') and change display units to sectors (command 'U '). command (m for help): pDisk/dev/vdb: 536.9 GB, 536870912000 bytes255 heads, 63 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum /Optimal): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System/dev/vdb1 1 65270 524281243 + 8e Linux LVMCommand (m for help ): dSelected partition 1 Command (m for help): pDisk/dev/vdb: 536.9 GB, 536870912000 bytes255 heads, 63 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O siz E (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Blocks Id SystemCommand (m for help): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 1 First cylinder (1-65270, default 1): Using default value 1 Last cylinder, + cylinders or + size {K, M, g} (1-65270, default 65270): Using default value 65270 Command (m for help): pDisk/dev/vdb: 536. 9 GB, 536870912000 bytes255 heads, 63 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System/dev/vdb1 1 65270 524281243 + 83 Linux # here t is used to modify the format. LVM is required. therefore, we need to change the format to 8e. command (m for help): tSelected partition 1He X code (type L to list codes): 8 eChanged system type of partition 1 to 8e (Linux LVM) Command (m for help): pDisk/dev/vdb: 536.9 GB, 536870912000 bytes255 heads, 63 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Block S Id System/dev/vdb1 1 65270 524281243 + 8e Linux LVMCommand (m for help): wThe partition table has been altered! Calling ioctl () to re-read partition table. Syncing disks. [root @ iZ23h637rtdZ ~] # Partprobe Warning: WARNING: the kernel failed to re-read the partition table on/dev/vda (Device or resource busy ).
As a result, it may not reflect all of your changes until after reboot. [root @ iZ23h637rtdZ ~] # Fdisk-lDisk/dev/vda: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00078f9c Device Boot Start End Blocks Id System/dev/vda1 * 1 7833 62912512 83 LinuxDisk/dev/vdb: 536.9 GB, 536870912000 bytes255 heads, 6 3 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal ): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System/dev/vdb1 1 65270 524281243 + 8e Linux LVM [root @ iZ23h637rtdZ ~] # Pvscan No matching physical volumes found # create a pv first, followed by the specific path. [root @ iZ23h637rtdZ ~] # Pvcreate/dev/vdb1 Physical volume "/dev/vdb1" successfully created [root @ iZ23h637rtdZ ~] # Pvscan PV/dev/vdb1 lvm2 [499.99 GiB] Total: 1 [499.99 GiB]/in use: 0 [0]/in no VG: 1 [499.99 GiB] [root @ iZ23h637rtdZ ~] # Pvdisplay "/dev/vdb1" is a new physical volume of "499.99 GiB" --- NEW Physical volume --- PV Name/dev/vdb1 VG Name PV Size 499.99 GiB Allocatable no pe Size 0 total PE 0 Free PE 0 Allocated PE 0 pv uuid GOeBQF-iCCD-n7i7-Y4DT-U5PE-tjHK-B9Z3CL # re-create VG. because the entire block is used directly, the block name/dev/vdb1 is followed directly by the vg name. [root @ iZ23h637rtdZ ~] # Vgcreate mailbox_vg/dev/vdb1 Volume group "mailbox_vg" successfully created [root @ iZ23h637rtdZ ~] # Vgscan Reading all physical volumes. This may take a while... Found volume group "mailbox_vg" using metadata type lvm2 [root @ iZ23h637rtdZ ~] # Pvscan PV/dev/vdb1 VG mailbox_vg lvm2 [499.99 GiB/499.99 GiB free] Total: 1 [499.99 GiB]/in use: 1 [499.99 GiB]/in no VG: 0 [0] [root @ iZ23h637rtdZ ~] # Vgdisplay --- Volume group --- VG Name mailbox_vg System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 1 VG Access read/write VG Status resizable max lv 0 Cur LV 0 Open LV 0 Max PV 0 cur PV 1 Act PV 1 VG Size 499.99 GiB PE Size 4.00 MiB Total PE 127998 Alloc PE/Size 0/0 Free PE/Size 127998/499 .99 GiB vg uuid JjdDER-Y1OK-ICwZ-3FgC-cry2-bZYl-SqD3RP # The following needs to create LV. -l is followed by the number of PES. the above vgdi can be used. Splay command to view. # Follow the name of the lv. it can also be named casually, but I suggest you write a distinction here. otherwise, it is difficult to clarify. [root @ iZ23h637rtdZ ~] # Lvcreate-l 127998-n mailbox_lv mailbox_vg Logical volume "mailbox_lv" created [root @ iZ23h637rtdZ ~] # Lvdisplay --- Logical volume --- LV Path/dev/mailbox_vg/mailbox_lv LV Name mailbox_lv VG Name mailbox_vg lv uuid VPA4HE-22B4-gZc0-Qo8V-TO1C-tKaF-AT8s5T LV Write Access read/write LV Creation host, time iZ23h637rtdZ, 09:25:34 + 0800 LV Status available # open 0 LV Size 499.99 GiB Current LE 127998 Segments 1 Allocation inherit Read ahead sectors auto-currently set to 256 Block device 253: 0 [root @ iZ23h637rtdZ ~] # Fdisk-lDisk/dev/vda: 64.4 GB, 64424509440 bytes255 heads, 63 sectors/track, 7832 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical ): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00078f9c Device Boot Start End Blocks Id System/dev/vda1 * 1 7833 62912512 83 LinuxDisk/dev/vdb: 536.9 GB, 536870912000 bytes255 heads, 6 3 sectors/track, 65270 cylindersUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal ): 512 bytes/512 bytesDisk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System/dev/vdb1 1 65270 524281243 + 8e Linux LVMDisk/dev/mapper/mailbox_vg-mailbox_lv: 536.9 GB, 536862523392 bytes255 heads, 63 sectors/track, 65269 cylinder SUnits = cylinders of 16065*512 = 8225280 bytesSector size (logical/physical): 512 bytes/512 bytesI/O size (minimum/optimal): 512 bytes/512 bytesDisk identifier: 0x00000000 # created. format [root @ iZ23h637rtdZ ~] # Mkfs-t ext4/dev/mailbox_vg/mailbox_lv mke2fs 1.41.12 (17-May-2010) Filesystem label = OS type: LinuxBlock size = 4096 (log = 2) fragment size = 4096 (log = 2) Stride = 0 blocks, Stripe width = 0 blocks32768000 inodes, 131069952 blocks6553497 blocks (5.00%) reserved for the super userFirst data block = 0 Maximum filesystem blocks = 42949672964000 block groups32768 blocks per group, 32768 fragments per group8192 inode S per groupSuperblock backups stored on blocks: 32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,409 6000, 7962624,112 39424, 20480000,238 87872, 71663616,786 75968, 102400000 Writing inode tables: done Creating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 34 mounts or180 days, wh Ichever comes first. Use tune2fs-c or-I to override. # create a mount directory and mount it. [root @ iZ23h637rtdZ ~] # Mkdir/mail_mailbox [root @ iZ23h637rtdZ ~] # Mount/dev/Display all 179 possibilities? (Y or n) [root @ iZ23h637rtdZ ~] # Mount/dev/mailbox_vg/mailbox_lv/mail_mailbox/[root @ iZ23h637rtdZ ~] # Df-hFilesystem Size Used Avail Use % Mounted on/dev/vda1 59G 1.9G 55G 4%/tmpfs 3.9G 0 3.9G 0%/dev/shm/dev/mapper/mailbox_vg-mailbox_lv 493G 70 M 467G 1%/mail_mailbox # Use vim to modify the fstab file. enable automatic mounting upon startup. below is the content of cat/etc/fstab below. Here vim does not record ghost [root @ iZ23h637rtdZ ~] # Cat/etc/fstab # Created by anaconda on Thu Aug 14 21:16:42 2014 # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info # UUID = 94e4e384-0ace-437f-bc96-057dd64f42ee/ext4 ults, barrier = 0 1 1 tmpfs/dev/shm tmpfs defaults 0 0 devpts/dev/pts devpts gid = 5, mode = 620 0 0 sysfs/sys sysfs defaults 0 0 proc/proc defaults 0 0/dev/mailbox_vg/mailbox_lv/mail_mailbox ext4 defaults 1 2 [root @ iZ23h637rtdZ ~] # Define [root @ iZ23h637rtdZ ~] # Vim/etc/fstab # Run umount below and then mount-a to test whether fstab is normally written [root @ iZ23h637rtdZ ~] # Umount/mail_mailbox/[root @ iZ23h637rtdZ ~] # Df-hFilesystem Size Used Avail Use % Mounted on/dev/vda1 59G 1.9G 55G 4%/tmpfs 3.9G 0 3.9G 0%/dev/shm [root @ iZ23h637rtdZ ~] # Mount-a [root @ iZ23h637rtdZ ~] # Df-hFilesystem Size Used Avail Use % Mounted on/dev/vda1 59G 1.9G 55G 4%/tmpfs 3.9G 0 3.9G 0%/dev/shm/dev/mapper/mailbox_vg-mailbox_lv 493G 70 M 467G 1%/mail_mailbox [END] 9:32:31

This is the end. Integrate the relevant steps:

#fdisk /dev/vdb #pvcreate /dev/vdb1#vgcreate mailbox_vg /dev/vdb1#lvcreate -l 127998 -n mailbox_lv mailbox_vg#mkfs -t ext4 /dev/mailbox_vg/mailbox_lv #mkdir /mail_mailbox#mount /dev/mailbox_vg/mailbox_lv /mail_mailbox/

 

Related Article

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.