手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux fdisk LVM soft RAID 配置管理

[日期:2010-11-06] 来源:Linux社区  作者:wfliving [字体:大 中 小]
3.创建逻辑卷 (500M)
[root@localhost ~]# lvcreate -L 500M  vg1
  Logical volume "lvol0" created
[root@localhost ~]# lvdisplay vg1
  --- Logical volume ---
  LV Name                /dev/vg1/lvol0
  VG Name                vg1
  LV UUID                X0t8to-qvNP-smxr-xPOH-I8p9-c3Ht-V01Fy2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                500.00 MB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

4.格式化分区(ext3格式)
[root@localhost ~]# mkfs.ext3 /dev/vg1/lvol0   (或者可以写成  mkfs.ext3 /dev/mapper/vg1-lvol0)
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

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

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

同步分区表 : partprobe /dev/hdb

5.挂载使用:
[root@localhost ~]#mkdir -p /tmp/test1  (创建一个挂载点或者自己指定挂载点)
[root@localhost ~]#mount /dev/mapper/vg1-lvol0 /tmp/test1  (挂载)
[root@localhost ~]# df -lh
文件系统             容量  已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
                       18G  2.1G   15G  13% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 252M     0  252M   0% /dev/shm
/dev/mapper/vg1-lvol0
                      485M   11M  449M   3% /tmp/test1
[root@localhost test1]# mkdir 123 && touch 456
[root@localhost test1]# ll -trh
总计 14K
drwx------ 2 root root  12K 10-23 20:51 lost+found
drwxr-xr-x 2 root root 1.0K 10-23 20:54 test
-rw-r--r-- 1 root root    0 10-23 21:13 456
drwxr-xr-x 2 root root 1.0K 10-23 21:13 123

测试成功

解决方案2:在现有LVM环境中,给LVM扩容,增加300M使用空间


1.确定VG容量还有多少剩余空间
[root@localhost /]# vgdisplay vg1
  --- Volume group ---
  VG Name               vg1
  System ID           
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               952.00 MB
  PE Size               4.00 MB
  Total PE              238
  Alloc PE / Size       125 / 500.00 MB  (已经使用的容量)
  Free  PE / Size       113 / 452.00 MB    ( 空闲容量)
  VG UUID               erhVbI-5Ckz-befx-QpFZ-RbhV-Hl9K-qZ0x9Z

从以上信息可以看出,整个VG共有1G(实际使用 952M)空间,其中已经使用了100M,剩余452M可以增加

2. 增加分区VG容量300M
[root@localhost tmp]# lvextend -L +300M /dev/mapper/vg1-lvol0
 Logical volume lvol0 successfully resized

3.调整新增分区容量的文件系统
[root@localhost tmp]# resize2fs  -p /dev/mapper/vg1-lvol0
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/vg1-lvol0 is mounted on /tmp/test1; on-line resizing required
Performing an on-line resize of /dev/mapper/vg1-lvol0 to 819200 (1k) blocks.
The filesystem on /dev/mapper/vg1-lvol0 is now 819200 blocks long.linux
相关资讯       Linux服务器 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款