Linux添加硬盘并扩容LVM磁盘空间—《江苏智简云网络安全小知识》
后台经常由小伙伴私信会问道Linux怎么添加硬盘并扩容LVM磁盘空间?今天呢我们江苏智简云的客服人员来给大家讲一下这方面的相关网络安全小知识!http://idc31.com/
Linux环境: virtual box 下,redhat5 64位版本,原来系统默认分区. 新添加一个8G的硬盘sdb,将新加的硬盘容量扩充到原来的/上去. 1.分区, [root@test ~]# fdisk -l Disk /dev/sda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 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 1044 8281507+ 8e Linux LVM
Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table
[root@test ~]# fdisk /dev/sdb -----此处有一段英文省略 Command (m for help): n(输入n) Command action e extended p primary partition (1-4) p(输入p) Partition number (1-4): 1 (输入1) First cylinder (1-1044, default 1): (回车) Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): (回车) Using default value 1044 Command (m for help): w(输入w) w保存退出!
2.创建pv [root@test ~]# pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created
查看pv root@test ~]# pvdisplay /dev/hdc: open failed: No medium found --- Physical volume --- PV Name /dev/sda2 VG Name VolGroup00 PV Size 7.90 GB / not usable 23.41 MB Allocatable yes (but full) PE Size (KByte) 32768 Total PE 252 Free PE 0 Allocated PE 252 PV UUID ntpCtU-7gX3-988d-ifQv-SCyb-oFcx-S0jFrM
"/dev/sdb1" is a new physical volume of "8.00 GB" --- NEW Physical volume --- PV Name /dev/sdb1 VG Name PV Size 8.00 GB Allocatable NO PE Size (KByte) 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID 2XiyBc-5hJD-LJDQ-Fslo-t3CD-go4j-Zt8nxO
3.查看vg vgdisplay /dev/hdc: open failed: No medium found --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 7.88 GB PE Size 32.00 MB Total PE 252 Alloc PE / Size 252 / 7.88 GB Free PE / Size 0 / 0 VG UUID Mjkp7h-lSOy-qR7r-RQ1b-FRrH-rNjQ-BOJYDY
4.扩容vg [root@test ~]# vgextend VolGroup00 /dev/sdb1 /dev/hdc: open failed: No medium found Volume group "VolGroup00" successfully extended
5.检查vg [root@test ~]# vgdisplay /dev/hdc: open failed: No medium found --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 15.84 GB PE Size 32.00 MB Total PE 507 Alloc PE / Size 252 / 7.88 GB Free PE / Size 255 / 7.97 GB VG UUID Mjkp7h-lSOy-qR7r-RQ1b-FRrH-rNjQ-BOJYDY
6.查看lv [root@test ~]# lvdisplay /dev/hdc: open failed: No medium found --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID KBRr5T-kBNg-UfqY-5kEE-snsd-eKl3-1dtUT9 LV Write Access read/write LV Status available # open 1 LV Size 6.88 GB Current LE 220 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0
--- Logical volume --- LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID YMu5P9-nuwE-GbD6-9T9P-knzk-H1rQ-ccyzYX LV Write Access read/write LV Status available # open 1 LV Size 1.00 GB Current LE 32 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1
7.扩容lv [root@test ~]# lvextend /dev/VolGroup00/LogVol00 /dev/sdb1 /dev/hdc: open failed: No medium found Extending logical volume LogVol00 to 14.84 GB Logical volume LogVol00 successfully resized
8.查看lv [root@test ~]# lvdisplay /dev/hdc: open failed: No medium found --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID KBRr5T-kBNg-UfqY-5kEE-snsd-eKl3-1dtUT9 LV Write Access read/write LV Status available # open 1 LV Size 14.84 GB Current LE 475 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0
--- Logical volume --- LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID YMu5P9-nuwE-GbD6-9T9P-knzk-H1rQ-ccyzYX LV Write Access read/write LV Status available # open 1 LV Size 1.00 GB Current LE 32 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1
9.扩容 / 磁盘空间 [root@test ~]# mount /dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) [root@test ~]# res reset resize reslisa restorecon restore.static resetall resize2fs restore restorecond [root@test ~]# resize2fs /dev/mapper/VolGroup00-LogVol0 VolGroup00-LogVol00 VolGroup00-LogVol01 [root@test ~]# resize2fs /dev/mapper/VolGroup00-LogVol00 resize2fs 1.39 (29-May-2006) Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 3891200 (4k) blocks. The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 3891200 blocks long.
[root@test ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 15G 6.2G 7.5G 46% / /dev/sda1 99M 13M 82M 14% /boot tmpfs 250M 0 250M 0% /dev/shm 磁盘空间添加完成 |
公司主页:http://idc31.com/
公司全称:江苏智简云计算有限公司
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
### 江苏智简,江苏智简云,江苏智简云计算,idc31.com,www.idc31.com,徐州华为云,徐州服务器租用,徐州服务器托管,徐州数据中心,徐州云服务器,徐州网站建设,徐州APP搭建,徐州小程序开发,徐州APP开发,徐州网络安全,徐州网络维护,徐州网站维护,徐州网站搭建,徐州网络搭建,徐州网络攻击解决方案,徐州租用服务器,徐州托管服务器,徐州电信机房,徐州联通机房,徐州移动机房,徐州单线机房,徐州双线机房,徐州多线机房,徐州BGP线路机房,徐州系统安装,徐州VPS,徐州虚拟空间,徐州域名注册,徐州网站下载 ,徐州idc公司,徐州网络公司,徐州IDC公司排名,徐州网络公司排名,徐州互联网公司,徐州互联网公司排名,江苏华为云,江苏服务器租用,江苏服务器托管,江苏数据中心,江苏云服务器,江苏网站建设,江苏APP搭建,江苏小程序开发,江苏APP开发,江苏网络安全,江苏网络维护,江苏网站维护,江苏网站搭建,江苏网络搭建,江苏网络攻击解决方案,江苏租用服务器,江苏托管服务器,江苏电信机房,江苏联通机房,江苏移动机房,江苏单线机房,江苏双线机房,江苏多线机房,江苏BGP线路机房,江苏系统安装,江苏VPS,江苏虚拟空间,江苏域名注册,江苏网站下载 ,江苏idc公司,江苏网络公司,江苏IDC公司排名,江苏网络公司排名,江苏互联网公司,江苏互联网公司排名,企业服务器租用,游戏服务器租用,华为云服务器,阿里云服务器,腾讯云服务器,百度云服务器 虚拟云主机,网站备案,云虚拟主机,徐州电信,高防IP,免费永久服务器,云服务器网站,企业云服务器,网站云服务器###