Linux下邏輯卷建立與管理

來源:互聯網
上載者:User

Linux下邏輯卷建立與管理 用虛擬機器加一塊硬碟後,查看硬碟狀況,使用fdisk-l命令: [root@jerrybj ~]# fdisk -l Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot     Start         End      Blocks  Id  System /dev/sda1   *           1          13      104391  83  Linux /dev/sda2             14        2610    20860402+ 8e  Linux LVM Disk /dev/sdb: 34.3 GB, 34359738368 bytes 255 heads, 63 sectors/track, 4177 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table 其中/dev/sdb是新添加的,一會拿來做邏輯卷。 下面繼續添加partition: [root@jerrybj ~]# fdisk /dev/sdb Command (m for help): n Command action    e   extended    p   primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-4177, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-4177, default4177): Using default value 4177 Command (m for help): p Disk /dev/sdb: 34.3 GB, 34359738368 bytes 255 heads, 63 sectors/track, 4177 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes    Device Boot      Start         End      Blocks  Id  System /dev/sdb1              1        4177    33551721  83  Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. 現在我把linux類型 分成LinuxLVM類型。 [root@jerrybj ~]# fdisk /dev/sdb Command (m for help): t Hex code (type L to list codes): L 。。。 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): w 下面建立pv、vg、lv [root@jerrybj ~]# pv pvchange  pvcreate   pvmove     pvresize  pvscan     pvck      pvdisplay  pvremove   pvs       pv.sh  [root@jerrybj ~]# pvcreate /dev/sdb1   Physical volume"/dev/sdb1" successfully created 然後建立vg [root@jerrybj ~]# vg vgcfgbackup    vgconvert      vgextend       vgmknodes      vgs vgcfgrestore  vgcreate       vgimport       vgreduce       vgscan vgchange      vgdisplay      vgimportclone  vgremove      vgsplit vgck          vgexport       vgmerge        vgrename [root@jerrybj ~]# vgcreate datavg /dev/sdb1  Volume group"datavg" successfully created 建立lv [root@jerrybj ~]# lv lvchange    lvdisplay    lvmchange    lvmsadc     lvreduce     lvresize lvconvert   lvextend     lvmdiskscan  lvmsar      lvremove     lvs lvcreate     lvm          lvmdump      lvm.static   lvrename    lvscan [root@jerrybj ~]# lvcreate -n lv_data1 -L 15g datavg   Logical volume"lv_data1" created [root@jerrybj ~]# lvcreate -n lv_dsk1 -L 4g datavg   Logical volume"lv_dsk1" created [root@jerrybj ~]# lvcreate -n lv_dsk2 -L 4g datavg   Logical volume"lv_dsk2" created [root@jerrybj ~]# lvcreate -n lv_dsk3 -L 4g datavg   Logical volume"lv_dsk3" created [root@jerrybj ~]# lvcreate -n lv_dsk4 -L 4g datavg   Logical volume"lv_dsk4" created 接下來格式化: [root@jerrybj ~]# mkfs.ext3 /dev/datavg/lv_data1 [root@jerrybj ~]# mkfs.ext3 /dev/datavg/lv_dsk1 [root@jerrybj ~]# mkfs.ext3 /dev/datavg/lv_dsk2 [root@jerrybj ~]# mkfs.ext3 /dev/datavg/lv_dsk3 [root@jerrybj ~]# mkfs.ext3 /dev/datavg/lv_dsk4 下面建立目錄: [root@jerrybj ~]# mkdir /u01 /dsk1 /dsk2 /dsk3 /dsk4 下面開機掛載: [root@jerrybj ~]# vi /etc/fstab 末尾添加如下內容: /dev/datavg/lv_data1   /u01                    ext3    defaults        0 0 /dev/datavg/lv_dsk1    /dsk1                   ext3    defaults        0 0 /dev/datavg/lv_dsk2    /dsk2                   ext3    defaults        0 0 /dev/datavg/lv_dsk3    /dsk3                   ext3    defaults        0 0 /dev/datavg/lv_dsk4    /dsk4                   ext3    defaults        0 0   [root@jerrybj ~]# mount /u01 [root@jerrybj ~]# mount /dsk1 [root@jerrybj ~]# mount /dsk2 [root@jerrybj ~]# mount /dsk3 [root@jerrybj ~]# mount /dsk4 大功告成!  

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.