linux 创建LV /文件系统/扩大文件系统

linux 创建LV /文件系统/扩大文件系统实例

[root@r1c2b6 /]# lvcreate -L 100M -n xyy /dev/vg00 //建立lv
Rounding up size to full physical extent 128.00 MB
Logical volume "xyy" created
[root@r1c2b6 /]# mkfs -t ext3 /dev/vg00/xyy //创建文件系统
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
32768 inodes, 131072 blocks
6553 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
16 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

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

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@r1c2b6 /]# mount /dev/vg00/xyy /xyy //挂载到文件,根目录下有个/xyy文件
[root@r1c2b6 /]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/cciss/c0d0p1 3.9G 385M 3.3G 11% /
/dev/mapper/vg00-lvol7
39G 5.7G 32G 16% /home
/dev/mapper/vg00-lvol6
9.7G 151M 9.1G 2% /opt
/dev/mapper/vg00-lvol3
4.9G 139M 4.5G 3% /tmp
/dev/mapper/vg00-lvol5
4.9G 228M 4.4G 5% /var
/dev/mapper/vg00-lvol4
9.7G 2.5G 6.8G 27% /usr
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/mapper/vg00-xyy 124M 5.6M 113M 5% /xyy
[root@r1c2b6 /]# lvextend -L +200M /dev/vg00/xyy //扩展LV大小
Rounding up size to full physical extent 224.00 MB
Extending logical volume xyy to 352.00 MB
Logical volume xyy successfully resized
[root@r1c2b6 /]# resize2fs /dev/vg00/xyy //重新为LV在线创建文件系统
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg00/xyy is mounted on /xyy; on-line resizing required
Performing an on-line resize of /dev/vg00/xyy to 360448 (1k) blocks.
The filesystem on /dev/vg00/xyy is now 360448 blocks long.


[root@r1c2b6 /]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/cciss/c0d0p1 3.9G 385M 3.3G 11% /
/dev/mapper/vg00-lvol7
39G 5.7G 32G 16% /home
/dev/mapper/vg00-lvol6
9.7G 151M 9.1G 2% /opt
/dev/mapper/vg00-lvol3
4.9G 139M 4.5G 3% /tmp
/dev/mapper/vg00-lvol5
4.9G 228M 4.4G 5% /var
/dev/mapper/vg00-lvol4
9.7G 2.5G 6.8G 27% /usr
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/mapper/vg00-xyy 341M 6.1M 318M 2% /xyy
[root@r1c2b6 /]# umount /xyy //取消lv挂载
[root@r1c2b6 /]# lvremove /dev/vg00/xyy //删除lv
Do you really want to remove active logical volume xyy? [y/n]: y
Logical volume "xyy" successfully removed
[root@r1c2b6 /]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/cciss/c0d0p1 3.9G 385M 3.3G 11% /
/dev/mapper/vg00-lvol7
39G 5.7G 32G 16% /home
/dev/mapper/vg00-lvol6
9.7G 151M 9.1G 2% /opt
/dev/mapper/vg00-lvol3
4.9G 139M 4.5G 3% /tmp
/dev/mapper/vg00-lvol5
4.9G 228M 4.4G 5% /var
/dev/mapper/vg00-lvol4
9.7G 2.5G 6.8G 27% /usr
tmpfs 7.8G 0 7.8G 0% /dev/shm

[root@r1c2b6 /]# vgdisplay
--- Volume group ---
VG Name vg00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 14
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size 275.34 GB
PE Size 32.00 MB
Total PE 8811
Alloc PE / Size 2432 / 76.00 GB
Free PE / Size 6379 / 199.34 GB
VG UUID h62KMe-WrQO-tJ4o-0AmN-zkUs-HHhk-5p7iiv

[root@r1c2b6 /]# lvdisplay
--- Logical volume ---
LV Name /dev/vg00/lvol7
VG Name vg00
LV UUID T2jVvH-ndly-Kkvu-N2IR-YyNP-TrlI-OZlh15
LV Write Access read/write
LV Status available
# open 1
LV Size 40.00 GB
Current LE 1280
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/vg00/lvol6
VG Name vg00
LV UUID RJISQb-lVtd-9wiU-tUJv-2Z1t-5bKq-AxtQ0y
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 320
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Name /dev/vg00/lvol3
VG Name vg00
LV UUID 46XlPa-Gm1x-LWIE-7ngd-Alao-7NM9-72nTL6
LV Write Access read/write
LV Status available
# open 1
LV Size 5.00 GB
Current LE 160
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

--- Logical volume ---
LV Name /dev/vg00/lvol5
VG Name vg00
LV UUID aWbd1e-gjBd-lwDd-NoHG-IugQ-vddx-HEo4T6
LV Write Access read/write
LV Status available
# open 1
LV Size 5.00 GB
Current LE 160
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3

--- Logical volume ---
LV Name /dev/vg00/lvol4
VG Name vg00
LV UUID CRZDnC-TqtI-nlgE-Jo8o-R6Rr-EfAu-1QWlsT
LV Write Access read/write
LV Status available
# open 1
LV Size 10.00 GB
Current LE 320
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:4

--- Logical volume ---
LV Name /dev/vg00/lvol2
VG Name vg00
LV UUID CiwBMK-lkr8-YrS3-cJDL-3b4R-MZhN-cuLfsf
LV Write Access read/write
LV Status available
# open 1
LV Size 6.00 GB
Current LE 192
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:5

[root@r1c2b6 /]# lvdisplay -v /dev/vg00/lvol2
Using logical volume(s) on command line
--- Logical volume ---
LV Name /dev/vg00/lvol2
VG Name vg00
LV UUID CiwBMK-lkr8-YrS3-cJDL-3b4R-MZhN-cuLfsf
LV Write Access read/write
LV Status available
# open 1
LV Size 6.00 GB
Current LE 192
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:5

[root@r1c2b6 /]# lvdisplay -v /dev/vg00/xyy //查看已经删除
Using logical volume(s) on command line
One or more specified logical volume(s) not found.
[root@r1c2b6 /]#

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值