1、添加文件系统
[root@sunlm ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_sunlm-lv_root
26G 19G 6.6G 74% /
tmpfs 872M 211M 661M 25% /dev/shm
/dev/sda1 477M 85M 363M 19% /boot
/dev/sr0 3.8G 3.8G 0 100% /mnt
[root@sunlm ~]# fdisk -l
Disk /dev/ram0: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram1: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram2: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram3: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram4: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram5: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram6: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram7: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram8: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram9: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram10: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram11: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram12: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram13: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram14: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/ram15: 16 MB, 16777216 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Note: sector size is 2048 (not 512)
Disk /dev/sr0: 4048 MB, 4048551936 bytes
64 heads, 32 sectors/track, 965 cylinders
Units = cylinders of 2048 * 2048 = 4194304 bytes
Sector size (logical/physical): 2048 bytes / 2048 bytes
I/O size (minimum/optimal): 2048 bytes / 2048 bytes
Disk identifier: 0x63d11a2c
Device Boot Start End Blocks Id System
/dev/sr0p1 * 1 3861 15814656 17 Hidden HPFS/NTFS
Partition 1 has different physical/logical endings:
phys=(1023, 63, 32) logical=(3860, 63, 32)
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 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: 0x000a9d7f
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 3917 30944256 8e Linux LVM
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x00000000
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x1fc42419
Device Boot Start End Blocks Id System
/dev/sdb1 1 1300 10442218+ 83 Linux
/dev/sdb2 1301 1950 5221125 83 Linux
/dev/sdb3 1951 2610 5301450 83 Linux
Disk /dev/mapper/vg_sunlm-lv_root: 28.5 GB, 28462546944 bytes
255 heads, 63 sectors/track, 3460 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: 0x00000000
Disk /dev/mapper/vg_sunlm-lv_swap: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 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: 0x00000000
[root@sunlm ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
[root@sunlm ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_sunlm
PV Size 29.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7554
Free PE 0
Allocated PE 7554
PV UUID uw9iRz-O7ON-4xdJ-U1pc-SZUI-F5Cf-EQ2462
"/dev/sdc" is a new physical volume of "10.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID FkVzd5-CMn3-u9H0-1rpf-Ay90-9BxO-d18Pii
[root@sunlm ~]# vgcreate vg_ogg /dev/sdc
Volume group "vg_ogg" successfully created
[root@sunlm ~]# vgdisplay
--- Volume group ---
VG Name vg_ogg
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 10.00 GiB
PE Size 4.00 MiB
Total PE 2559
Alloc PE / Size 0 / 0
Free PE / Size 2559 / 10.00 GiB
VG UUID wDPv3F-iwwC-piYL-PzAn-uafy-XBbv-ph2arX
--- Volume group ---
VG Name vg_sunlm
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 29.51 GiB
PE Size 4.00 MiB
Total PE 7554
Alloc PE / Size 7554 / 29.51 GiB
Free PE / Size 0 / 0
VG UUID NXAdAY-tMKL-xiP6-Q3Dz-MImx-VjLS-UHfLCE
[root@sunlm ~]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_sunlm/lv_root
LV Name lv_root
VG Name vg_sunlm
LV UUID tbpXgw-vdZi-UL2d-UJJv-eEEF-AICA-956sHQ
LV Write Access read/write
LV Creation host, time sunlm, 2019-09-07 02:28:55 +0800
LV Status available
# open 1
LV Size 26.51 GiB
Current LE 6786
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 251:0
--- Logical volume ---
LV Path /dev/vg_sunlm/lv_swap
LV Name lv_swap
VG Name vg_sunlm
LV UUID TFH1tc-5MXj-2HYr-8Khs-W7yF-5YVC-bzf75E
LV Write Access read/write
LV Creation host, time sunlm, 2019-09-07 02:28:56 +0800
LV Status available
# open 2
LV Size 3.00 GiB
Current LE 768
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 251:1
[root@sunlm ~]#
[root@sunlm ~]# lvcreate -l 2500 -n lv_ogg vg_ogg
Logical volume "lv_ogg" created.
[root@sunlm ~]# ll /dev/vg_ogg/lv_ogg
lrwxrwxrwx. 1 root root 7 Sep 7 22:51 /dev/vg_ogg/lv_ogg -> ../dm-2
[root@sunlm ~]# mkfs.ext4 /dev/vg_ogg/lv_ogg
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
640848 inodes, 2560000 blocks
128000 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2621440000
79 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@sunlm ~]# mount /dev/mapper/vg_ogg-lv_ogg /goldengate/
[root@sunlm ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_sunlm-lv_root
26G 19G 6.6G 74% /
tmpfs 872M 211M 661M 25% /dev/shm
/dev/sda1 477M 85M 363M 19% /boot
/dev/sr0 3.8G 3.8G 0 100% /mnt
/dev/mapper/vg_ogg-lv_ogg
9.5G 22M 9.0G 1% /goldengate
[root@sunlm ~]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_sunlm-lv_root
ext4 27228028 18936468 6885404 74% /
tmpfs tmpfs 892368 215752 676616 25% /dev/shm
/dev/sda1 ext4 487652 86714 371242 19% /boot
/dev/sr0 iso9660 3953100 3953100 0 100% /mnt
/dev/mapper/vg_ogg-lv_ogg
ext4 9948012 22488 9397140 1% /goldengate
[root@sunlm ~]# vim /etc/fstab
添加:
/dev/mapper/vg_ogg-lv_ogg /goldengate ext4 defaults 0 0
[root@sunlm ~]# reboot
2、卸载文件系统
umount /goldengate
lvremove /dev/vg_ogg/lv_ogg
vgremove vg_ogg
pvremove /dev/sdc
vim /etc/fstab,删除对应挂载信息
本文介绍了如何在Linux中管理文件系统,包括添加和卸载。通过编辑/etc/fstab文件来删除挂载信息以卸载文件系统。

被折叠的 条评论
为什么被折叠?



