|
2019-05-21 2019-05-23
- [root@station60 ~]# cat /proc/partitions
- major minor #blocks name
- 8 0 20971520 sda
- 8 1 1048576 sda1
- 8 2 19921920 sda2
- 8 16 1048576 sdb
- 8 19 0 sdb3
- 8 21 204800 sdb5
- 8 22 204800 sdb6
- 11 0 4391936 sr0
- 253 0 17821696 dm-0
- 253 1 2097152 dm-1
- 7 0 1048576 loop0
- [root@station60 ~]# df -Th
- Filesystem Type Size Used Avail Use% Mounted on
- /dev/mapper/rhel-root xfs 17G 4.9G 13G 29% /
- devtmpfs devtmpfs 894M 0 894M 0% /dev
- tmpfs tmpfs 1.5G 0 1.5G 0% /dev/shm
- tmpfs tmpfs 910M 2.8M 908M 1% /run
- tmpfs tmpfs 910M 0 910M 0% /sys/fs/cgroup
- /dev/sdb6 ext4 190M 1.6M 175M 1% /mnt
- /dev/sda1 xfs 1014M 178M 837M 18% /boot
- tmpfs tmpfs 182M 8.0K 182M 1% /run/user/42
- tmpfs tmpfs 182M 32K 182M 1% /run/user/0
- /dev/sr0 iso9660 4.2G 4.2G 0 100% /run/media/root/RHEL-7.6 Server.x86_64
- /dev/loop0 xfs 1014M 33M 982M 4% /run/media/root/155b06c3-e700-4347-8247-52ec954369bc
- [root@station60 ~]# umount /mnt
- [root@station60 ~]# blkid /dev/sdb6
- /dev/sdb6: LABEL="/mnt" UUID="27e8f7cb-5770-4711-be5f-710401a26bcb" TYPE="ext4"
- [root@station60 ~]# vim /etc/fstab
- [root@station60 ~]# e2label /dev/sdb6
- /mnt
- [root@station60 ~]# vim /etc/fstab
- [root@station60 ~]# swapon -a
- [root@station60 ~]# swapon -s
- Filename Type Size Used Priority
- /dev/dm-1 partition 2097148 0 1
- /dev/sdb5 partition 204796 0 1
- [root@station60 ~]# swapoff /dev/sdb5
- [root@station60 ~]# vim /etc/fstab
- [root@station60 ~]# blkid /dev/sdb5
- /dev/sdb5: UUID="a52e60db-23e4-447c-b7e8-2250eace2e1a" TYPE="swap"
- [root@station60 ~]# vim /etc/fstab
- [root@station60 ~]# pvs
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- [root@station60 ~]# cat /proc/partitions
- major minor #blocks name
- 8 0 20971520 sda
- 8 1 1048576 sda1
- 8 2 19921920 sda2
- 8 16 1048576 sdb
- 8 19 0 sdb3
- 8 21 204800 sdb5
- 8 22 204800 sdb6
- 11 0 4391936 sr0
- 253 0 17821696 dm-0
- 253 1 2097152 dm-1
- 7 0 1048576 loop0
- [root@station60 ~]# fdisk /dev/sdb
- Welcome to fdisk (util-linux 2.23.2).
- Changes will remain in memory only, until you decide to write them.
- Be careful before using the write command.
- Command (m for help): p
- Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
- Units = sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk label type: dos
- Disk identifier: 0x01a7270d
- Device Boot Start End Blocks Id System
- /dev/sdb3 2048 2097151 1047552 5 Extended
- /dev/sdb5 4096 413695 204800 82 Linux swap / Solaris
- /dev/sdb6 415744 825343 204800 83 Linux
- Command (m for help): d
- Partition number (3,5,6, default 6): 3
- Partition 3 is deleted
- Command (m for help): p
- Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
- Units = sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk label type: dos
- Disk identifier: 0x01a7270d
- Device Boot Start End Blocks Id System
- Command (m for help): n
- Partition type:
- p primary (0 primary, 0 extended, 4 free)
- e extended
- Select (default p): p
- Partition number (1-4, default 1):
- First sector (2048-2097151, default 2048):
- Using default value 2048
- Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +256M
- Partition 1 of type Linux and of size 256 MiB is set
- Command (m for help): t
- Selected partition 1
- Hex code (type L to list all codes): 8e
- Changed type of partition 'Linux' to 'Linux LVM'
- Command (m for help): n
- Partition type:
- p primary (1 primary, 0 extended, 3 free)
- e extended
- Select (default p): p
- Partition number (2-4, default 2):
- First sector (526336-2097151, default 526336):
- Using default value 526336
- Last sector, +sectors or +size{K,M,G} (526336-2097151, default 2097151): +256M
- Partition 2 of type Linux and of size 256 MiB is set
- Command (m for help): t
- Partition number (1,2, default 2):
- Hex code (type L to list all codes): 8e
- Changed type of partition 'Linux' to 'Linux LVM'
- Command (m for help): p
- Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 sectors
- Units = sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk label type: dos
- Disk identifier: 0x01a7270d
- Device Boot Start End Blocks Id System
- /dev/sdb1 2048 526335 262144 8e Linux LVM
- /dev/sdb2 526336 1050623 262144 8e Linux LVM
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- Syncing disks.
- [root@station60 ~]# pvcreate /dev/sdb{1,2}
- WARNING: dos signature detected on /dev/sdb1 at offset 510. Wipe it? [y/n]: y
- Wiping dos signature on /dev/sdb1.
- Physical volume "/dev/sdb1" successfully created.
- Physical volume "/dev/sdb2" successfully created.
- [root@station60 ~]# pvs
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- /dev/sdb1 lvm2 --- 256.00m 256.00m
- /dev/sdb2 lvm2 --- 256.00m 256.00m
- [root@station60 ~]# vgcreate vol0 /dev/sdb[12]
- Volume group "vol0" successfully created
- [root@station60 ~]# pvs
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- /dev/sdb1 vol0 lvm2 a-- 252.00m 252.00m
- /dev/sdb2 vol0 lvm2 a-- 252.00m 252.00m
- [root@station60 ~]# vgs
- VG #PV #LV #SN Attr VSize VFree
- rhel 1 2 0 wz--n- <19.00g 0
- vol0 2 0 0 wz--n- 504.00m 504.00m
- [root@station60 ~]# vgdisplay vol0
- --- Volume group ---
- VG Name vol0
- System ID
- Format lvm2
- Metadata Areas 2
- 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 2
- Act PV 2
- VG Size 504.00 MiB
- PE Size 4.00 MiB
- Total PE 126
- Alloc PE / Size 0 / 0
- Free PE / Size 126 / 504.00 MiB
- VG UUID lTte1h-UeX6-gpJu-I6YF-NxDh-aHZM-YUFRyB
-
- [root@station60 ~]# vgremove /dev/vol0
- Volume group "vol0" successfully removed
- [root@station60 ~]# vgcreate -s 16M vol0 /dev/sdb[12]
- Volume group "vol0" successfully created
- [root@station60 ~]# vgdisplay vol0
- --- Volume group ---
- VG Name vol0
- System ID
- Format lvm2
- Metadata Areas 2
- 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 2
- Act PV 2
- VG Size 480.00 MiB
- PE Size 16.00 MiB
- Total PE 30
- Alloc PE / Size 0 / 0
- Free PE / Size 30 / 480.00 MiB
- VG UUID rFbSJL-mgbZ-PXfG-pXl1-cNgU-PbNM-T4qecJ
-
- [root@station60 ~]# dd if=/dev/zero of=/dev/sdb2 bs=512 count=1
- 1+0 records in
- 1+0 records out
- 512 bytes (512 B) copied, 0.00253245 s, 202 kB/s
- [root@station60 ~]# pvs
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- /dev/sdb1 vol0 lvm2 a-- 240.00m 240.00m
- /dev/sdb2 vol0 lvm2 a-- 240.00m 240.00m
- [root@station60 ~]# sync
- [root@station60 ~]# partprobe /dev/sdb
- [root@station60 ~]# sync
- [root@station60 ~]# pvs
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- /dev/sdb1 vol0 lvm2 a-- 240.00m 240.00m
- /dev/sdb2 vol0 lvm2 a-- 240.00m 240.00m
- [root@station60 ~]# dd if=/dev/zero of=/dev/sdb2 bs=512 count=10
- 10+0 records in
- 10+0 records out
- 5120 bytes (5.1 kB) copied, 0.00273818 s, 1.9 MB/s
- [root@station60 ~]# pvs
- WARNING: Device for PV S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N not found or rejected by a filter.
- Couldn't find device with uuid S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N.
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- /dev/sdb1 vol0 lvm2 a-- 240.00m 240.00m
- [unknown] vol0 lvm2 a-m 240.00m 240.00m
- [root@station60 ~]# vgs
- WARNING: Device for PV S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N not found or rejected by a filter.
- Couldn't find device with uuid S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N.
- VG #PV #LV #SN Attr VSize VFree
- rhel 1 2 0 wz--n- <19.00g 0
- vol0 2 0 0 wz-pn- 480.00m 480.00m
- [root@station60 ~]# vgreduce --remove-missing
- No command with matching syntax recognised. Run 'vgreduce --help' for more information.
- Nearest similar command has syntax:
- vgreduce --removemissing VG
- Remove all missing PVs from a VG.
- [root@station60 ~]# man vgreduce
- [root@station60 ~]# vgreduce --removemissing
- No command with matching syntax recognised. Run 'vgreduce --help' for more information.
- Nearest similar command has syntax:
- vgreduce --removemissing VG
- Remove all missing PVs from a VG.
- [root@station60 ~]# vgreduce --removemissing vol0
- WARNING: Device for PV S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N not found or rejected by a filter.
- Couldn't find device with uuid S3U6Td-XCxI-yY3k-U5UH-xJka-Tz8e-aYTE2N.
- Wrote out consistent volume group vol0.
- [root@station60 ~]# pvs
- PV VG Fmt Attr PSize PFree
- /dev/sda2 rhel lvm2 a-- <19.00g 0
- /dev/sdb1 vol0 lvm2 a-- 240.00m 240.00m
复制代码- [root@station60 ~]# lvextend -L +500M /dev/vol0/lv1
- Rounding size to boundary between physical extents: 512.00 MiB.
- Size of logical volume vol0/lv1 changed from 208.00 MiB (13 extents) to 720.00 MiB (45 extents).
- Logical volume vol0/lv1 successfully resized.
- [root@station60 ~]# vgdisplay vol0
- --- Volume group ---
- VG Name vol0
- System ID
- Format lvm2
- Metadata Areas 3
- Metadata Sequence No 8
- VG Access read/write
- VG Status resizable
- MAX LV 0
- Cur LV 1
- Open LV 0
- Max PV 0
- Cur PV 3
- Act PV 3
- VG Size 976.00 MiB
- PE Size 16.00 MiB
- Total PE 61
- Alloc PE / Size 45 / 720.00 MiB
- Free PE / Size 16 / 256.00 MiB
- VG UUID rFbSJL-mgbZ-PXfG-pXl1-cNgU-PbNM-T4qecJ
-
- [root@station60 ~]# lvreduce -L -500M /dev/vol0/lv1
- Rounding size to boundary between physical extents: 496.00 MiB.
- WARNING: Reducing active logical volume to 224.00 MiB.
- THIS MAY DESTROY YOUR DATA (filesystem etc.)
- Do you really want to reduce vol0/lv1? [y/n]: y
- Size of logical volume vol0/lv1 changed from 720.00 MiB (45 extents) to 224.00 MiB (14 extents).
- Logical volume vol0/lv1 successfully resized.
- [root@station60 ~]# lvreduce -L 200M /dev/vol0/lv1
- Rounding size to boundary between physical extents: 208.00 MiB.
- WARNING: Reducing active logical volume to 208.00 MiB.
- THIS MAY DESTROY YOUR DATA (filesystem etc.)
- Do you really want to reduce vol0/lv1? [y/n]: y
- Size of logical volume vol0/lv1 changed from 224.00 MiB (14 extents) to 208.00 MiB (13 extents).
- Logical volume vol0/lv1 successfully resized.
- [root@station60 ~]# lvs
- LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
- root rhel -wi-ao---- <17.00g
- swap rhel -wi-ao---- 2.00g
- lv1 vol0 -wi-a----- 208.00m
- [root@station60 ~]#
复制代码
列出SELinux上下文策略的命令:
/var/lib/samba/winbindd_privileged(/.*)? all files system_ubject_r:winbind_var_run
- semanage fcontext -a -t samba_share_t '/sharedpath(/.*)?'
复制代码
|
|