磁盘分区:
parted /dev/emcpowera
(parted) print
Model: Unknown (unknown)
Disk /dev/emcpowera: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
 
(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/emcpowera will be destroyed and all
data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
(parted) mkpart primary 0 4398GB
Warning: The resulting partition is not properly aligned for best performance.
 
Ignore/Cancel? i                                                          
(parted) print                                                            
Model: Unknown (unknown)
Disk /dev/emcpowera: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
 
(parted) set 1 lvm on                                                     
(parted) print                                                            
Model: Unknown (unknown)
Disk /dev/emcpowera: 4398GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
 
Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  4398GB  4398GB               primary  lvm
 
# partprobe /dev/emcpowera
 
 
创建pv(实体分割区)
[root@gps ~]# pvcreate -v /dev/emcpowera1
    Set up physical volume for "/dev/emcpowera1" with 8589934525 available sec
tors    Zeroing start of device /dev/emcpowera1
    Writing physical volume data to disk "/dev/emcpowera1"
  Physical volume "/dev/emcpowera1" successfully created
[root@gps ~]# pvdisplay 
  "/dev/emcpowera1" is a new physical volume of "4.00 TiB"
  --- NEW Physical volume ---
  PV Name               /dev/emcpowera1
  VG Name               
  PV Size               4.00 TiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               rXInos-ERGY-PtRM-3gdO-iuTc-FjUq-MsuOEK
 
[root@gps ~]# vgcreate -s 4M vg01 /dev/emcpowera1
  Volume group "vg01" successfully created
[root@gps ~]# vgdisplay
  --- Volume group ---
  VG Name               vg01
  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               4.00 TiB
  PE Size               4.00 MiB
  Total PE              1048575
  Alloc PE / Size       0 / 0   
  Free  PE / Size       1048575 / 4.00 TiB
  VG UUID               iLibwY-3PzY-msgG-SX0y-zWVf-1eXj-iAN2FU
 
[root@gps ~]# lvcreate  -l 100%FREE -n lv01 vg01
  Logical volume "lv01" created
[root@gps ~]# mkfs.ext4 /dev/vg01/lv01
mke2fs 1.43-WIP (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
268435456 inodes, 1073740800 blocks
53687040 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
32768 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, 214990848, 512000000, 550731776, 644972544
 
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done       
 
[root@gps ~]# mkdir /4t
[root@gps ~]# mount /dev/vg01/lv01 /4t
[root@gps ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/sda4              252G   91G  149G  39% /
tmpfs                   16G     0   16G   0% /dev/shm
/dev/sda2              190M   54M  127M  30% /boot
/dev/sda1              200M  260K  200M   1% /boot/efi
/dev/mapper/vg01-lv01  4.0T   67M  3.8T   1% /4t
[root@gps ~]# mount
/dev/sda4 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda2 on /boot type ext4 (rw)
/dev/sda1 on /boot/efi type vfat (rw,umask=0077,shortname=winnt)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/vg01-lv01 on /4t type ext4 (rw)
 
扩展1.5T
[root@gps ~]# fdisk /dev/emcpowerb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x16fa8030.
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-195812, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-195812, default 195812): 
Using default value 195812
 
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): p
 
Disk /dev/emcpowerb: 1610.6 GB, 1610612736000 bytes
255 heads, 63 sectors/track, 195812 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: 0x16fa8030
 
         Device Boot      Start         End      Blocks   Id  System
/dev/emcpowerb1               1      195812  1572859858+  8e  Linux LVM
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.
 
[root@gps ~]# pvcreate /dev/emcpowerb1
  Physical volume "/dev/emcpowerb1" successfully created
[root@gps ~]# vgextend vg01 /dev/emcpowerb1
  Volume group "vg01" successfully extended
[root@gps ~]# vgdisplay
  --- Volume group ---
  VG Name               vg01
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               5.46 TiB
  PE Size               4.00 MiB
  Total PE              1432573
  Alloc PE / Size       1048575 / 4.00 TiB
  Free  PE / Size       383998 / 1.46 TiB
  VG UUID               iLibwY-3PzY-msgG-SX0y-zWVf-1eXj-iAN2FU
 
 
[root@gps ~]# lvextend -l +100%FREE /dev/vg01/lv01 
  Extending logical volume lv01 to 5.46 TiB
  Logical volume lv01 successfully resized
 
[root@gps ~]# e2fsck -f /dev/vg01/lv01 
e2fsck 1.43-WIP (20-Jun-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
blocks
[root@gps ~]# resize2fs /dev/vg01/lv01 
resize2fs 1.43-WIP (20-Jun-2013)
Resizing the filesystem on /dev/vg01/lv01 to 1466954752 (4k) blocks.
The filesystem on /dev/vg01/lv01 is now 1466954752 blocks long.
 
[root@gps ~]# mount /dev/vg01/lv01 /4t
[root@gps ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/sda4              252G   91G  149G  39% /
tmpfs                   16G     0   16G   0% /dev/shm
/dev/sda2              190M   54M  127M  30% /boot
/dev/sda1              200M  260K  200M   1% /boot/efi
/dev/mapper/vg01-lv01  5.4T   58M  5.2T   1% /4t
[root@gps ~]# mount
/dev/sda4 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda2 on /boot type ext4 (rw)
/dev/sda1 on /boot/efi type vfat (rw,umask=0077,shortname=winnt)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/vg01-lv01 on /4t type ext4 (rw)
 
 
 
增加lv(在分区空间足够的情况下)
这里,我们新添加一块磁盘sdc20G,前期磁盘分区操作省略
[root@localhost /]# umount /lv01    先卸载
[root@localhost /]# pvcreate /dev/sdc1    增加pv实体分割区
[root@localhost /]# vgextend vg01 /dev/sdc1        将新加PV加入原有的VG01上
[root@localhost /]# lvextend -l 5120 /dev/vg01/lv01        增加lv
[root@localhost /]# resize2fs /dev/vg01/lv01                        手动
[root@localhost /]# mount /dev/vg01/lv01 /lv01
[root@localhost /]# df -h 
 
 
减少lv
[root@localhost /]# umount /lv01
[root@localhost /]# fsck -f /dev/vg01/lv01
[root@localhost /]# resize2fs /dev/vg01/lv01 102400这里更改文件系统指定大小要和lvreduce必须一致
[root@localhost /]# lvreduce -L 102400M /dev/vg01/lv01
(减小大小,要计算好,而且稍不注意,就可能让系统崩溃
 
 
 
 

parted LVM划分4T磁盘,在线扩展1.5T的更多相关文章

  1. LVM划分磁盘及扩容缩容

    lvm:logical volume monitor 逻辑卷管理器 作用: 采用lvm划分磁盘:磁盘空间不够时,方便扩展磁盘.物理卷加到卷组时被划分等大的pe,即pv是由众多pe构成.pe是卷组的最小 ...

  2. kvm linux虚拟机在线扩展磁盘

    说明: 1) vmware ESXi虚拟化平台也支持这台在线扩展磁盘功能. 2) kvm虚拟机也支持在线扩展磁盘功能,在线扩展有特定的使用环境,主要用于不能随便停用的生产环境中. 3) 经过测试KVM ...

  3. lvm讲解、磁盘故障小案例

    第4周第3次课(4月11日) 课程内容: 4.10/4.11/4.12 lvm讲解4.13 磁盘故障小案例 4.10/4.11/4.12 lvm讲解 lvm可以给磁盘扩容和缩容,结构图如下. 首先创建 ...

  4. 在线扩展根分区 red hat 4.8.3-9

    跑程序的时候发现报错,提示空间不足,仔细查看后发现是根分区已满 27G的空间只有20k剩余 考虑从/data分区压缩一点空间到/分区 切换到root用户 执行下面的命令 1. umount /data ...

  5. QEMU/KVM磁盘在线备份

    QEMU/KVM磁盘的在线完整及增量备份,是"打包"方案的一种具体实现,可实现基于时间点的备份,同时支持本地与远程2种备份方式,并可指定备份文件进行恢复. tag: qemu, k ...

  6. 在线添加磁盘,扩展LVM卷案例

    一.添加硬盘,在线扫描出来 首先到虚拟机那里添加一块硬盘,注意必须是SCSI类型的硬盘. 扫描硬盘,不用重启操作系统的. echo "- - -" > /sys/class/ ...

  7. parted 4T磁盘

    parted /dev/vdg mklabel gpt mkpart primary ext4 0% 100%

  8. CentOS 磁盘在线扩容

    场景介绍: 操作系统Centos7.x 系统有一块vdisk,容量为20G,共分为3个区(swap和boot分区为标准分区xfs文件系统,根分区为LVM分区,xfs文件系统) 业务需求:在VM系统不关 ...

  9. 六、LVM和从磁盘配额

    一.LVM概述 Logical Volume Manager,逻辑卷管理 优点:能够保证在现有数据不变的情况下,动态调整磁盘容量,从而提高磁盘管理的灵活性 /boot分区用于存放引导文件,不能基于LV ...

随机推荐

  1. ASP.NET MVC Filter- 登录验证 【异步刷新列表视图】

    public class TAjaxListLoginValidateAttribute : FilterAttribute, IAuthorizationFilter { public void O ...

  2. MySQL主从复制实现

    上回提到了用ThinkPHP框架来实现数据库的读写分离,现在就来简单说说MySQL的主从复制. 形式 一主一从(也就是这里要实现的形式) 主主复制 一主多从 多主一从(MySQL5.7开始支持) 联级 ...

  3. C# Byte[] 转String 无损转换

    C# Byte[] 转String 无损转换 转载请注明出处 http://www.cnblogs.com/Huerye/ /// <summary> /// string 转成byte[ ...

  4. 转→js数组遍历 千万不要使用for...in...

    看到一篇内容还不错,但是排版实在糟糕, 逼死强迫症患者啊,直接拉下去找原文连接,找到了,但是已经消失了···500错误... 第一次因为实在看不下去一篇博客的排版, 为了排版而转载... 转载地址:h ...

  5. adb install INSTALL_FAILED_ALREADY_EXISTS

    安装时候碰到的一个问题:已经签名的包,重新通过adb install 会提示安装错误.提示:Failure [INSTALL_FAILED_ALREADY_EXISTS] 为啥eclipse自己就可以 ...

  6. JavaScript - 原型

    一切皆为对象 殊不知,JavaScript的世界中的对象,追根溯源来自于一个 null 「一切皆为对象」,这句着实是一手好营销,易记,易上口,印象深刻. 万物初生时,一个null对象,凭空而生,接着O ...

  7. Https方式使用Git@OSC设置密码的方式

    Https方式使用Git@OSC设置密码的方式 62561_silentboy Zoker3 years ago member https方式每次都要输入密码,按照如下设置即可输入一次就不用再手输入密 ...

  8. angular开发单页面应用--页面资源部分

    关于angular是什么,能够干什么就不在这里解释了,自行搜索了,或者等稍晚一点再解释... angular适合开发单页面应用,这句话在介绍angular的网站和博客里都可以提到.因为angular是 ...

  9. yii2——自定义widget

    参考资料:http://www.bsourcecode.com/yiiframework2/how-to-create-custom-widget-in-yii2-0-framework/   如何使 ...

  10. Linux下的压缩和解压缩命令——gzip/gunzip

    gzip命令 gzip命令用来压缩文件.gzip是个使用广泛的压缩程序,文件经它压缩过后,其名称后面会多处".gz"扩展名. gzip是在Linux系统中经常使用的一个对文件进行压 ...