精华内容
下载资源
问答
  • linux创建vg、lv

    千次阅读 2018-12-26 08:02:34
    LVM磁盘管理 一、LVM简介...... 二、 LVM基本术语......3、 创建VG.. 7 4、 创建LV.. 9 5、LV格式化及挂载... 10 一、LVM简介 LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由Heinz Mauelshagen在...

     

    LVM磁盘管理

    一、LVM简介... 1

    二、 LVM基本术语... 2

    三、 安装LVM... 3

    四、 创建和管理LVM... 4

    2、 创建PV.. 6

    3、 创建VG.. 7

    4、 创建LV.. 9

    5、LV格式化及挂载... 10

    一、LVM简介

    LVM是 Logical Volume Manager(逻辑卷管理)的简写,它由Heinz Mauelshagen在Linux 2.4内核上实现。LVM将一个或多个硬盘的分区在逻辑上集合,相当于一个大硬盘来使用,当硬盘的空间不够使用的时候,可以继续将其它的硬盘的分区加入其中,这样可以实现磁盘空间的动态管理,相对于普通的磁盘分区有很大的灵活性。

    与传统的磁盘与分区相比,LVM为计算机提供了更高层次的磁盘存储。它使系统管理员可以更方便的为应用与用户分配存储空间。在LVM管理下的存储卷可以按需要随时改变大小与移除(可能需对文件系统工具进行升级)。LVM也允许按用户组对存储卷进行管理,允许管理员用更直观的名称(如"sales'、 'development')代替物理磁盘名(如'sda'、'sdb')来标识存储卷。

    如图所示LVM模型:

    clip_image002[7]

    由四个磁盘分区可以组成一个很大的空间,然后在这些空间上划分一些逻辑分区,当一个逻辑分区的空间不够用的时候,可以从剩余空间上划分一些空间给空间不够用的分区使用。

    二、 LVM基本术语

    前面谈到,LVM是在磁盘分区和文件系统之间添加的一个逻辑层,来为文件系统屏蔽下层磁盘分区布局,提供一个抽象的盘卷,在盘卷上建立文件系统。首先我们讨论以下几个LVM术语:

    物理存储介质(The physical media):这里指系统的存储设备:硬盘,如:/dev/hda1、/dev/sda等等,是存储系统最低层的存储单元。

    物理卷(physical volume):物理卷就是指硬盘分区或从逻辑上与磁盘分区具有同样功能的设备(如RAID),是LVM的基本存储逻辑块,但和基本的物理存储介质(如分区、磁盘等)比较,却包含有与LVM相关的管理参数。

    卷组(Volume Group):LVM卷组类似于非LVM系统中的物理硬盘,其由物理卷组成。可以在卷组上创建一个或多个“LVM分区”(逻辑卷),LVM卷组由一个或多个物理卷组成。

    逻辑卷(logical volume):LVM的逻辑卷类似于非LVM系统中的硬盘分区,在逻辑卷之上可以建立文件系统(比如/home或者/usr等)。

    PE(physical extent):每一个物理卷被划分为称为PE(Physical Extents)的基本单元,具有唯一编号的PE是可以被LVM寻址的最小单元。PE的大小是可配置的,默认为4MB。

    LE(logical extent):逻辑卷也被划分为被称为LE(Logical Extents) 的可被寻址的基本单位。在同一个卷组中,LE的大小和PE是相同的,并且一一对应。

    简单来说就是:

    PV:是物理的磁盘分区

    VG:LVM中的物理的磁盘分区,也就是PV,必须加入VG,可以将VG理解为一个仓库或者是几个大的硬盘。

    LV:也就是从VG中划分的逻辑分区

    如下图所示PV、VG、LV三者关系:

    clip_image004[7]

    三、 安装LVM
    首先确定系统中是否安装了lvm工具:
        [root@www root]# rpm –qa|grep lvm
        lvm-1.0.3-4
    如果命令结果输入类似于上例,那么说明系统已经安装了LVM管理工具;如果命令没有输出则说明没有安装LVM管理工具,则需要从网络下载或者从光盘装LVM rpm工具包。

    四、 创建和管理LVM

    要创建一个LVM系统,一般需要经过以下步骤:
    1、 创建分区

    使用分区工具(如:fdisk等)创建LVM分区,方法和创建其他一般分区的方式是一样的,区别仅仅是LVM的分区类型为8e。如下列图所示:

    clip_image006[8]

    查看磁盘分区表

    clip_image008[6]

    使用fdisk创建分区,根据设备文件的绝对路径(/dev/hda)进入分区管理

    clip_image010[6]

    clip_image012[6]

    一定要指定分区的格式为8e,这是LVM的分区格式

    2、 创建PV

     

    clip_image014[6]

    3、 创建VG

    clip_image016[6]

    clip_image018[6]

    创建完成VG之后,才能从VG中划分一个LV。

    4、 创建LV

    clip_image020[6]

    创建了一个名字为lvData,容量大小是100M的分区,其中:-L:指定LV的大小 -n:指定LV的名。Vo1Group00:表示从这个VG中划分LV;

    5、LV格式化及挂载

    下一步需要对LV进行格式化(使用mksf进行格式化操作),然后LV才能存储资料

    clip_image022[6]

    将格式化后的LV分区挂载到指定的目录下,就可以像普通目录一样存储数据了

    clip_image024[6]

    挂载之后,可以看到此LV的容量。

    如果要在系统启动的时候启动LV,最好是将lvData写入fstable 文件中,如下所示:

    clip_image026[6]

    使用Vim编辑器,打开/etc/fstab,在最后一行添加如图中所示,其中/dev/VolGroup00/lvData指定需要挂载的分区LV,/root/test指定要挂载的目录(挂载点),ext3分区文件系统格式,其它使用默认即可

     

    扩容当前分区

    一、首先创建一块新的分区:

    fdisk  /dev/hda

    n

    l        #选择逻辑分区,如果没有,则首先创建扩展分区,然后再添加逻辑分区(硬盘:最多四个分区P-P-P-P或P-P-P-E)

    6        #分区号(从5开始),/dev/hda6

    t      8e   #分区类型8e表示LVM分区

    w        #写入分区表

    partprobe   #重读分区表

    mkfs –t ext3 /dev/hda6 #格式化

    partx /dev/hda #查看当前硬盘的分区表及使用情况

    二、创建PV,扩容VG,LV

    pvcreate /dev/hda6

    vgdisplay #查看当前已经存在的VG信息,以存在VG:VolGroup00为例

    vgextend VolGroup00 /dev/hda6    #扩展VolGroup00

    lvdisplay #查看已经存在的LV信息,以存在LV:LogVol01为例

    lvextend –L 1G /dev/VolGroup00/LogVol01 #扩展LV

    resize2fs /dev/VolGroup00/LogVol01 #执行该重设大小,对于当前正在使用的LogVol01有效

    df –h #查看挂载情况,已经扩容

     

    展开全文
  • linux pv vg lv 的创建

    2021-03-04 15:04:36
    [root@localhost ~]# pvcreate /dev/sdc3 ----------...[root@localhost ~]# vgcreate -s 48m vg2 /dev/sdc3 -------创建vg + 容量+VG名称+ 分区路径 Volume group "vg2" successfully created [root@localhost ~]#...

    [root@localhost ~]# pvcreate /dev/sdc3     ------------创建PV+分区路径
      Physical volume "/dev/sdc3" successfully created.
    [root@localhost ~]# vgcreate -s 48m vg2 /dev/sdc3 -------创建vg + 容量+VG名称+ 分区路径
      Volume group "vg2" successfully created
    [root@localhost ~]# lvcreate -L 1g -n lv2 /dev/vg2    ----------创建lv+容量+lv名称+所使用的vg名称
      Rounding up size to full physical extent 1.03 GiB
      Logical volume "lv2" created.
    [root@localhost ~]# lvs   ----------查看创建后的lv信息
      LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      app  rhel -wi-ao---- <1.80g                                                    
      root rhel -wi-ao---- 12.00g                                                    
      swap rhel -wi-ao----  6.00g                                                    
      lv1  vg1  -wi-ao----  1.00g                                                    
      lv2  vg2  -wi-a-----  1.03g         --------此为最新创建的                                            
    [root@localhost ~]# mkfs.ext4 /dev/vg2/lv2    -------格式化lv 
    mke2fs 1.44.3 (10-July-2018)
    Creating filesystem with 270336 4k blocks and 67680 inodes
    Filesystem UUID: e4a7b4ad-8d12-4eea-a431-bc505a9fae1a
    Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done

    [root@localhost ~]# mkdir /app/lv2    --------创建挂载目录
    mkdir: cannot create directory ‘/app/lv2’: File exists
    [root@localhost ~]# mount /dev/vg2/lv2 /app/lv2  --------挂载新lv到挂载点
    [root@localhost ~]# df -Th  -------查看详细的挂载信息   带文件type
    Filesystem            Type      Size  Used Avail Use% Mounted on
    devtmpfs              devtmpfs  888M     0  888M   0% /dev
    tmpfs                 tmpfs     904M     0  904M   0% /dev/shm
    tmpfs                 tmpfs     904M  9.8M  894M   2% /run
    tmpfs                 tmpfs     904M     0  904M   0% /sys/fs/cgroup
    /dev/mapper/rhel-root xfs        12G  3.9G  8.2G  32% /
    /dev/mapper/rhel-app  xfs       1.8G   46M  1.8G   3% /app
    /dev/sda1             ext4      190M  131M   45M  75% /boot
    tmpfs                 tmpfs     181M   16K  181M   1% /run/user/42
    tmpfs                 tmpfs     181M  3.5M  178M   2% /run/user/0
    /dev/sr0              iso9660   6.7G  6.7G     0 100% /run/media/root/RHEL-8-0-0-BaseOS-x86_64
    /dev/mapper/vg1-lv1   ext4      976M  2.6M  907M   1% /app/lv1
    /dev/mapper/vg2-lv2   ext4     1008M  2.6M  936M   1% /app/lv2
    [root@localhost ~]# dd if=/dev/zero of=/app/lv2/testfile bs=10 count=10    --------查看文件系统是否有效
    10+0 records in
    10+0 records out
    100 bytes copied, 0.000185469 s, 539 kB/s
     

    展开全文
  • linux 创建pv vg lv

    2014-01-19 14:11:08
    linux创建pv vg lv ,多个磁盘pv(物理卷)组成存储池vg(卷组),vg又可以划分多个逻辑卷lv,在lv下可以建立文件系统
  • linux-vg磁盘(信息)迁移

    万次阅读 2017-05-18 17:48:05
    场景:主机A下在一块磁盘B上创建vg_1,并且创建了LV_1挂载在/mnt/test下,里面有数据;使用CentOS Linux系统。 需求:把主机A的磁盘b迁到主机B,还原VG且数据在主机B能查看。   步骤:A备份vg,将主机A的磁盘b迁...

    vg磁盘(信息)迁移


    场景:主机A下在一块磁盘B上创建了vg_1,并且创建了LV_1挂载在/mnt/test下,里面有数据;使用CentOS Linux系统。

    需求:将主机A的磁盘b迁到主机B,还原VG且数据在主机B能查看。

    步骤:主机A备份vg,将主机A的磁盘b迁到主机B,将备份文件拷贝到主机B,还原vg,激活vg,挂载。


    1、在主机A备份VG

    [root@l-a ~]#vgcfgbackup vg_1

    此时会在目录/etc/lvm/backup下生成一个vg_1文件。


    2、将主机A的磁盘b迁到主机B;这里省略操作步骤。


    3、将主机A的备份文件vg_1拷贝到主机B对应的目录,因主机B没有目录,需要手动创建目录/etc/lvm/backup。


    4、拷贝文件到主机B后,开始还原vg:

    [root@l-b ~]#vgcfgrestorevg_1


    5、激活卷组

    [root@l-b ~]#vgchange -ay

    激活前在/dev下是看不到vg_1这个文件夹的,激活成功后就会有。


    6、挂载逻辑卷(挂载文件系统)

    [root@l-b ~]#mount /dev/vg_1/lv_1 /mnt/test

    进入/mnt/test查看是否有原主机A的数据,如果有就算成功迁移了数据。


    展开全文
  • linux创建VG并增加

    千次阅读 2017-11-30 07:11:43
    /dev/sda1 * 1 64 512000 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 64 13055 104344576 8e Linux LVM Disk /dev/sdb: 536.9 GB, 536870912000 bytes 255 heads, 63 sectors/track, ...
    [root@app_mf ~]# fdisk -l
    
    Disk /dev/sda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00044402
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       13055   104344576   8e  Linux LVM
    
    Disk /dev/sdb: 536.9 GB, 536870912000 bytes
    255 heads, 63 sectors/track, 65270 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_swap: 16.9 GB, 16911433728 bytes
    255 heads, 63 sectors/track, 2056 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_home: 36.2 GB, 36247175168 bytes
    255 heads, 63 sectors/track, 4406 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    [root@app_mf ~]# vgs
    vgs      vgscan   vgsplit  
    [root@app_mf ~]# vgscan
      Reading all physical volumes.  This may take a while...
      Found volume group "VolGroup" using metadata type lvm2
    [root@app_mf ~]# lvscan
      ACTIVE            '/dev/VolGroup/lv_root' [50.00 GiB] inherit
      ACTIVE            '/dev/VolGroup/lv_home' [33.76 GiB] inherit
      ACTIVE            '/dev/VolGroup/lv_swap' [15.75 GiB] inherit
    [root@app_mf ~]# 
    [root@app_mf ~]# 
    [root@app_mf ~]# ls
    anaconda-ks.cfg  Desktop  Documents  Downloads  install.log  install.log.syslog  Music  Pictures  Public  Templates  Videos
    [root@app_mf ~]# ls /dev/sd*
    /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb
    [root@app_mf ~]# fdisk /dev/sdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel with disk identifier 0xdce240ae.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.
    
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition 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): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
    [root@app_mf ~]# fdisk -l
    
    Disk /dev/sda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00044402
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       13055   104344576   8e  Linux LVM
    
    Disk /dev/sdb: 536.9 GB, 536870912000 bytes
    255 heads, 63 sectors/track, 65270 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xdce240ae
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       65270   524281243+  83  Linux
    
    Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_swap: 16.9 GB, 16911433728 bytes
    255 heads, 63 sectors/track, 2056 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_home: 36.2 GB, 36247175168 bytes
    255 heads, 63 sectors/track, 4406 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    [root@app_mf ~]# ls /dev/sd*
    /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1
    [root@app_mf ~]# fdisk -l
    
    Disk /dev/sda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00044402
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       13055   104344576   8e  Linux LVM
    
    Disk /dev/sdb: 536.9 GB, 536870912000 bytes
    255 heads, 63 sectors/track, 65270 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xdce240ae
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       65270   524281243+  83  Linux
    
    Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_swap: 16.9 GB, 16911433728 bytes
    255 heads, 63 sectors/track, 2056 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_home: 36.2 GB, 36247175168 bytes
    255 heads, 63 sectors/track, 4406 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    [root@app_mf ~]# fdisk /dev/sdb
    
    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').
    
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 8e
    Changed system type of partition 1 to 8e (Linux LVM)
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
    [root@app_mf ~]# fdisk -l
    
    Disk /dev/sda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00044402
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       13055   104344576   8e  Linux LVM
    
    Disk /dev/sdb: 536.9 GB, 536870912000 bytes
    255 heads, 63 sectors/track, 65270 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xdce240ae
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       65270   524281243+  8e  Linux LVM
    
    Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_swap: 16.9 GB, 16911433728 bytes
    255 heads, 63 sectors/track, 2056 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_home: 36.2 GB, 36247175168 bytes
    255 heads, 63 sectors/track, 4406 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    [root@app_mf ~]# pvs
    pvs     pvscan  
    [root@app_mf ~]# pvscan
      PV /dev/sda2   VG VolGroup   lvm2 [99.51 GiB / 0    free]
      Total: 1 [99.51 GiB] / in use: 1 [99.51 GiB] / in no VG: 0 [0   ]
    [root@app_mf ~]# pvcreate /dev/sdb1
      Writing physical volume data to disk "/dev/sdb1"
      Physical volume "/dev/sdb1" successfully created
    [root@app_mf ~]# pvscan
      PV /dev/sda2   VG VolGroup        lvm2 [99.51 GiB / 0    free]
      PV /dev/sdb1                      lvm2 [499.99 GiB]
      Total: 2 [599.50 GiB] / in use: 1 [99.51 GiB] / in no VG: 1 [499.99 GiB]
    [root@app_mf ~]# pvdisplay /dev/sdb1
      "/dev/sdb1" is a new physical volume of "499.99 GiB"
      --- NEW Physical volume ---
      PV Name               /dev/sdb1
      VG Name               
      PV Size               499.99 GiB
      Allocatable           NO
      PE Size               0   
      Total PE              0
      Free PE               0
      Allocated PE          0
      PV UUID               1yLeK9-ikD0-pReB-Px6Q-bmha-3Gc8-vG4kgN
       
    [root@app_mf ~]# vgcreate ftpvg /dev/sdb1
      Volume group "ftpvg" successfully created
    [root@app_mf ~]# vgdisplay ftpvg
      --- Volume group ---
      VG Name               ftpvg
      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               zCxsZ6-oKK0-GRSb-urkD-KL27-G9LN-lbNqqj
       
    [root@app_mf ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           50G  4.6G   43G  10% /
    tmpfs                  16G     0   16G   0% /dev/shm
    /dev/sda1             485M   55M  405M  12% /boot
    /dev/mapper/VolGroup-lv_home
                           34G  176M   32G   1% /home
    [root@app_mf ~]# vgscan 
      Reading all physical volumes.  This may take a while...
      Found volume group "ftpvg" using metadata type lvm2
      Found volume group "VolGroup" using metadata type lvm2
    [root@app_mf ~]# lvcreate -L 500G -n lvftp ftpvg
      Volume group "ftpvg" has insufficient free space (127998 extents): 128000 required.
    [root@app_mf ~]# lvcreate -L 450G -n lvftp ftpvg
      Logical volume "lvftp" created
    [root@app_mf ~]# lvc
    lvchange   lvconvert  lvcreate   
    [root@app_mf ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           50G  4.6G   43G  10% /
    tmpfs                  16G     0   16G   0% /dev/shm
    /dev/sda1             485M   55M  405M  12% /boot
    /dev/mapper/VolGroup-lv_home
                           34G  176M   32G   1% /home
    [root@app_mf ~]# fdisk -l
    
    Disk /dev/sda: 107.4 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00044402
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          64      512000   83  Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2              64       13055   104344576   8e  Linux LVM
    
    Disk /dev/sdb: 536.9 GB, 536870912000 bytes
    255 heads, 63 sectors/track, 65270 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xdce240ae
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       65270   524281243+  8e  Linux LVM
    
    Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
    255 heads, 63 sectors/track, 6527 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_swap: 16.9 GB, 16911433728 bytes
    255 heads, 63 sectors/track, 2056 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/VolGroup-lv_home: 36.2 GB, 36247175168 bytes
    255 heads, 63 sectors/track, 4406 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    
    Disk /dev/mapper/ftpvg-lvftp: 483.2 GB, 483183820800 bytes
    255 heads, 63 sectors/track, 58743 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
    
    [root@app_mf ~]# mount /dev/mapper/ftpvg-lvftp /tmp/ftp
    mount: you must specify the filesystem type
    [root@app_mf ~]# mke2fs -j /dev/
    Display all 206 possibilities? (y or n)
    [root@app_mf ~]# mke2fs -j /dev/vga_arbiter 
    anaconda-ks.cfg      .gconfd/             .nautilus/
    .bash_history        .gnome2/             Pictures/
    .bash_logout         .gnote/              Public/
    .bash_profile        .gnupg/              .pulse/
    .bashrc              .gstreamer-0.10/     .pulse-cookie
    .cache/              .gtk-bookmarks       .recently-used.xbel
    .config/             .gvfs/               .spice-vdagent/
    .cshrc               .ICEauthority        .ssh/
    .dbus/               .imsettings.log      .tcshrc
    Desktop/             install.log          Templates/
    Documents/           install.log.syslog   Videos/
    Downloads/           .lftp/               .xsession-errors
    .esd_auth            .local/              
    .gconf/              Music/               
    [root@app_mf ~]# mke2fs -j /dev/vga_arbiter 
    anaconda-ks.cfg      .gconfd/             .nautilus/
    .bash_history        .gnome2/             Pictures/
    .bash_logout         .gnote/              Public/
    .bash_profile        .gnupg/              .pulse/
    .bashrc              .gstreamer-0.10/     .pulse-cookie
    .cache/              .gtk-bookmarks       .recently-used.xbel
    .config/             .gvfs/               .spice-vdagent/
    .cshrc               .ICEauthority        .ssh/
    .dbus/               .imsettings.log      .tcshrc
    Desktop/             install.log          Templates/
    Documents/           install.log.syslog   Videos/
    Downloads/           .lftp/               .xsession-errors
    .esd_auth            .local/              
    .gconf/              Music/               
    [root@app_mf ~]# mke2fs -j /dev/f
    fb          fd0u1040    fd0u1680    fd0u1840    fd0u800     floppy-fd0
    fb0         fd0u1120    fd0u1722    fd0u1920    fd0u820     ftpvg/
    fd/         fd0u1440    fd0u1743    fd0u360     fd0u830     full
    fd0         fd0u1600    fd0u1760    fd0u720     floppy      fuse
    [root@app_mf ~]# mke2fs -j /dev/ftpvg/lvftp 
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    29491200 inodes, 117964800 blocks
    5898240 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    3600 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks: 
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
            102400000
    
    Writing inode tables: done                            
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: 
    done
    
    This filesystem will be automatically checked every 32 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    [root@app_mf ~]# 
    [root@app_mf ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           50G  4.6G   43G  10% /
    tmpfs                  16G     0   16G   0% /dev/shm
    /dev/sda1             485M   55M  405M  12% /boot
    /dev/mapper/VolGroup-lv_home
                           34G  176M   32G   1% /home
    [root@app_mf ~]# mount /dev/ftpvg/lvftp /tmp/ftp
    [root@app_mf ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           50G  4.6G   43G  10% /
    tmpfs                  16G     0   16G   0% /dev/shm
    /dev/sda1             485M   55M  405M  12% /boot
    /dev/mapper/VolGroup-lv_home
                           34G  176M   32G   1% /home
    /dev/mapper/ftpvg-lvftp
                          443G  199M  421G   1% /tmp/ftp
    [root@app_mf ~]# cd /tmp/ftp
    [root@app_mf ftp]# ls
    lost+found
    [root@app_mf ftp]# ls
    lost+found
    [root@app_mf ftp]# ls -clt
    total 16
    drwx------ 2 root root 16384 Aug 22 18:00 lost+found
    [root@app_mf ftp]# mkdir office
    [root@app_mf ftp]# mkdir netbill
    [root@app_mf ftp]# mkdir tax_client
    [root@app_mf ftp]# ls
    lost+found  netbill  office  tax_client
    [root@app_mf ftp]# ls -clt
    total 28
    drwxr-xr-x 2 root root  4096 Aug 22 18:06 tax_client
    drwxr-xr-x 2 root root  4096 Aug 22 18:06 netbill
    drwxr-xr-x 2 root root  4096 Aug 22 18:06 office
    drwx------ 2 root root 16384 Aug 22 18:00 lost+found
    [root@app_mf ftp]# cat /etc/passwd
    root:x:0:0:root:/root:/bin/bash
    bin:x:1:1:bin:/bin:/sbin/nologin
    daemon:x:2:2:daemon:/sbin:/sbin/nologin
    adm:x:3:4:adm:/var/adm:/sbin/nologin
    lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
    sync:x:5:0:sync:/sbin:/bin/sync
    shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
    halt:x:7:0:halt:/sbin:/sbin/halt
    mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
    uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
    operator:x:11:0:operator:/root:/sbin/nologin
    games:x:12:100:games:/usr/games:/sbin/nologin
    gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
    ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
    nobody:x:99:99:Nobody:/:/sbin/nologin
    dbus:x:81:81:System message bus:/:/sbin/nologin
    usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
    rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin
    avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
    hsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologin
    oprofile:x:16:16:Special user account to be used by OProfile:/home/oprofile:/sbin/nologin
    vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
    rtkit:x:499:497:RealtimeKit:/proc:/sbin/nologin
    abrt:x:173:173::/etc/abrt:/sbin/nologin
    saslauth:x:498:76:"Saslauthd user":/var/empty/saslauth:/sbin/nologin
    postfix:x:89:89::/var/spool/postfix:/sbin/nologin
    ntp:x:38:38::/etc/ntp:/sbin/nologin
    apache:x:48:48:Apache:/var/www:/sbin/nologin
    avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
    rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
    nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
    haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
    pulse:x:497:495:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
    gdm:x:42:42::/var/lib/gdm:/sbin/nologin
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
    tcpdump:x:72:72::/:/sbin/nologin
    bgs:x:500:500::/tmp/ftp/bgs:/sbin/nologin
    office:x:501:501::/tmp/ftp/office:/sbin/nologin
    netbill:x:502:502::/tmp/ftp/netbill:/sbin/nologin
    tax_client:x:503:503::/tmp/ftp/tax_client:/sbin/nologin
    [root@app_mf ftp]# chown office.office office
    [root@app_mf ftp]# chown netbill.netbill netbill
    [root@app_mf ftp]# chown tax_client.tax_client tax_client
    [root@app_mf ftp]# ll
    total 28
    drwx------ 2 root       root       16384 Aug 22 18:00 lost+found
    drwxr-xr-x 2 netbill    netbill     4096 Aug 22 18:06 netbill
    drwxr-xr-x 2 office     office      4096 Aug 22 18:06 office
    drwxr-xr-x 2 tax_client tax_client  4096 Aug 22 18:06 tax_client
    [root@app_mf ftp]# passwd netbill
    Changing password for user netbill.
    New password: 
    BAD PASSWORD: it is based on a dictionary word
    BAD PASSWORD: is too simple
    Retype new password: 
    passwd: all authentication tokens updated successfully.
    [root@app_mf ftp]# 

    展开全文
  • linuxVG的管理

    2010-04-13 09:28:20
    1. 首先用 fdisk 创建两个分区 /dev/hda7 和 /dev/hda8,选择分区大小为 1G。结果如下:   Device Boot Start End Blocks Id System /dev/hdb1 1 2117 1000251 83 Linux...
  • Linux LVM之VG

    2017-11-12 17:01:00
    关于VG的操作 VG的命令会更多 vgs:简要显示vg信息 ...vgcreate:创建VG vgreduce:VG缩减容量 vgscan:VG扫描 vgremove:删除VG vgck:检测VG vgimport:导入VG vgexport:导出VG vgrename:VG重命名 vg...
  • 某客户的一台PC服务器连接了一台HP EVA 的FC SAN存储,划了一个6T的LUN分作一个单独的VG使用,在某一次异常掉电之后,发现该VG完全丢失,使用vgs/pvs/lvs命令均无法找到此VG及PV、LV,但在/dev下能看到SAN存储的两条...
  • 2.vg名为cl,无剩余空间; 3.目标:将新增的块设备格式化后加入cl并新建文件系统。 操作步骤: 1.查看新增的块设备 [root@localhost ~]# fdisk -l 2.对硬盘分区 [root@localhost ~]# fdisk /dev/sdc 查看...
  • linux lvm 简介之一 创建 vg,lv,fs mount

    千次阅读 2016-05-18 09:17:06
    lvm 是linux 很强大的功能,掌握lvm的常用功能是必备技能,此处省去若干废话。 下面是常用的操作方法: 新挂载的裸盘创建分区 # fdisk /dev/sdb 假如被创建成如下分区 ...创建vg # vgcreate vgoradata /dev/sd...
  • #pvcreate /dev/hdb5 /dev/hdd5#pvscan#pvdisplay"/dev/hdb5" is a new physical volume of "1023.69 MB"--- NEW Physical volume ---PV Name /dev/hdb5VG NamePV Size 1023.69 MBAlloc...
  • linux创建PV/VG/LV

    2015-11-26 11:07:00
    然后创建VG并将多个PV加到VG里-->然后创建LV-->格式化分区-->mount分区 1.创建PV pvcreate /dev/sdb pvcreate /dev/sdc pvcreate /dev/sde 2.创建VG并将多个PV加到VG vgcreate vg_test /dev/sdb ...
  • Linux中的创建LVM-PV-VG-LV

    千次阅读 2019-06-24 14:36:27
    Linux中的创建PV-VG-LV 操作系统为Linux5.5 LVM是逻辑盘卷管理(LogicalVolumeManager)的简称,他是磁盘管理的另一种工具,就目前基本上所有操作系统均支持,LVM是建立在硬盘和分区之上的一个逻辑层,来提高磁盘...
  • linux vg lv pv

    2017-06-26 17:24:00
    pv由物理卷或者分区组成 pv可以组成一个或者多个vg vg可以分成多个lv 方便扩展 pvs vgs lvs 可以查看当前存在的pv vg lv 我的centos硬盘20g 使用了一段时间 加了100g 这时候 我们可以使用扩展来扩展我们的分区...
  • 磁盘: 磁盘结构介绍 ...扩展分区:直接从硬盘上划分,但是不直接格式化使用,而是在上面创建多个小分区 逻辑分区:逻辑分区就是扩展分区创建的小分区 分区表,只记录 主分区+扩展分区,每记...
  • 为裸盘分区 查看硬盘分区 fdisk -l 进入分区管理 fdisk /dev/sda 创建PV 创建PV pvcreate /dev/sda1 pvcreate /dev/sdb1 pvcreate /dev/sdc1 ...创建VG 创建VG vgcreate ...
  • linux创建PV/VG/LV/

    2013-08-08 17:40:53
    然后创建VG。之后将多个PV加到VG里。然后创建LV。文件系统 pvcreate /dev/sdhpvcreate /dev/sdgpvcreate /dev/sdfpvcreate /dev/sdepvcreate /dev/sdd vgcreate vg_dss_oracle_back /dev/sdh /dev/sdg /dev/sdf /...
  • LVM逻辑卷管理一PVVGLV的创建-Linux
  • linux LVM pv vg lv

    2013-12-10 15:50:57
    VG新建LV->给LV格式化文件系统->mount到我们需要的目录 前提: 我要从VolGroup00的VG新建一个名叫vps的LV,大小为100G,要挂在的目录是/vps 1.创建LV ? 1 2 [root@test ~]# lvcreate ...
  • 近期和其它同事参与了存储的划分,由于工作...---1 操作系统版本[root@chen ~]# cat /etc/issueRed Hat Enterprise Linux Server release 6.4 (Santiago)Kernel \r on an \m---2 需要创建LVM的磁盘[root@chen ~]# fd...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 15,905
精华内容 6,362
关键字:

linux新建vg

linux 订阅