Raid阵列与lvm逻辑卷组(中)

简介:

将其他磁盘分区加入逻辑卷并更改逻辑卷大小

9.将/dev/sde分区

[root@lyt ~]# fdisk /dev/sde

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

 

 

The number of cylinders for this disk is set to 2610.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-2610, default 1): 

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): +512M

 

Command (m for help): p

 

Disk /dev/sde: 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/sde1               1          63      506016   83  Linux

 

Command (m for help): w

 

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

Syncing disks.

 

10.更改磁盘分区类型:

[root@lyt ~]# fdisk /dev/sde

 

 

The number of cylinders for this disk is set to 2610.

 

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

 

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/sde: 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/sde1               1          63      506016   8e  Linux LVM

 

Command (m for help): w

 

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

Syncing disks.

 

11.将/dev/sde1加入到物理卷中

[root@lyt ~]# pvcreate /dev/sde1

  Physical volume "/dev/sde1" successfully created

12.将扩展卷组

[root@lyt ~]# vgextend vgtest /dev/sde1

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Volume group "vgtest" successfully extended

13.扩展逻辑卷lvtest的大小(有2中方法)

(1)将逻辑卷/dev/vgtest/lvtest的大小扩展为1500M

[root@lyt ~]# lvextend -L 1500M /dev/vgtest/lvtest    

  Extending logical volume lvtest to 1.46 GB

  Logical volume lvtest successfully resized

(2)将逻辑卷/dev/vgtest/lvtest的大小增加12M

[root@lyt ~]# lvextend -L+12M /dev/vgtest/lvtest 

  Extending logical volume lvtest to 1.48 GB

  Logical volume lvtest successfully resized
14.重新读取逻辑卷大小

[root@lyt ~]# resize2fs /dev/vgtest/lvtest 

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/vgtest/lvtest is mounted on /lvdate; on-line resizing required

Performing an on-line resize of /dev/vgtest/lvtest to 387072 (4k) blocks.

The filesystem on /dev/vgtest/lvtest is now 387072 blocks long.

15.减小逻辑卷大小(有2种方法)

[root@lyt ~]# umount /dev/vgtest/lvtest    #首先卸载逻辑卷

(1)将逻辑卷的大小减小到1500M

[root@lyt ~]# lvreduce -L 1500M /dev/vgtest/lvtest   #将逻辑卷减小到1500M

  WARNING: Reducing active logical volume to 1.46 GB

  THIS MAY DESTROY YOUR DATA (filesystem etc.)

Do you really want to reduce lvtest? [y/n]: y

  Reducing logical volume lvtest to 1.46 GB

  Logical volume lvtest successfully resized
(2)将逻辑卷的大小减小100M

[root@lyt ~]# lvreduce -L-100M /dev/vgtest/lvtest 

  WARNING: Reducing active logical volume to 1.37 GB

  THIS MAY DESTROY YOUR DATA (filesystem etc.)

Do you really want to reduce lvtest? [y/n]: y

  Reducing logical volume lvtest to 1.37 GB

  Logical volume lvtest successfully resized

16.清除逻辑卷(逻辑卷必须卸载后才能清除)

[root@lyt ~]# lvremove /dev/vgtest/lvtest 

Do you really want to remove active logical volume lvtest? [y/n]: y

  Logical volume "lvtest" successfully removed

17.清除卷组

[root@lyt ~]# vgremove /dev/vgtest

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Volume group "vgtest" successfully removed
18.清除物理卷

[root@lyt ~]# pvremove /dev/sd*     #将物理卷全部清除

  Physical Volume /dev/sda not found

  No physical volume label read from /dev/sda1

  Physical Volume /dev/sda1 not found

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Can't pvremove physical volume "/dev/sda2" of volume group "VolGroup00" without -ff

  Physical Volume /dev/sdb not found

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sdb1" successfully wiped

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sdb2" successfully wiped

  Physical Volume /dev/sdc not found

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sdc1" successfully wiped

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sdc2" successfully wiped

  Physical Volume /dev/sdd not found

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sdd1" successfully wiped

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sdd2" successfully wiped

  Physical Volume /dev/sde not found

  /dev/cdrom: open failed: Read-only file system

  Attempt to close device '/dev/cdrom' which is not open.

  Labels on physical volume "/dev/sde1" successfully wiped

19.浏览物理卷、卷组和逻辑卷的命令分别有:

pvscan和pvdisplay、vgscan和vgdisplay、lvscan和lvdisplay










本文转自 liuyatao666 51CTO博客,原文链接:http://blog.51cto.com/5503845/1124332,如需转载请自行联系原作者
目录
相关文章
|
8月前
|
文字识别
统一多模态Embedding, 通义实验室开源GME系列模型
随着多媒体应用的迅猛发展,用户产生的数据类型日益多样化,不再局限于文本,还包含大量图像、音频和视频等多模态信息。这为信息检索带来了前所未有的挑战与机遇。传统的信息检索模型多关注单一模态,如仅对文本或图像进行分析和搜索。
1458 6
|
iOS开发 MacOS
Qt 报错:Undefined symbols for architecture arm64
MacBook Pro Apple M1 使用 Qt 6.4.1 的时候碰到的报错,做了不同的尝试,最后解决了这个报错。
853 0
|
10月前
|
IDE 开发工具 Kotlin
Kotlin - 函数与Lambda表达式
Kotlin - 函数与Lambda表达式
75 0
|
前端开发 JavaScript Java
【前端技术】 ES6 介绍及常用语法说明
【前端技术】 ES6 介绍及常用语法说明
188 4
|
JavaScript 前端开发 编译器
TypeScript 学习笔记
TypeScript 学习笔记
|
机器学习/深度学习 传感器 算法
【滤波】基于平方根无迹卡尔曼滤波SR-UKF实现信号去噪附matlab代码
【滤波】基于平方根无迹卡尔曼滤波SR-UKF实现信号去噪附matlab代码
|
小程序
微信小程序:miniprogram-date或day.js进行时间格式化和解析
微信小程序:miniprogram-date或day.js进行时间格式化和解析
636 0
|
XML Android开发 数据格式
autojs简洁的登录界面
牙叔教程 简单易懂
556 0
|
PHP
【laravel】@3 artisan的灵活运用
【laravel】@3 artisan的灵活运用
161 0
【laravel】@3 artisan的灵活运用