课程第18/19次
2019-05-212019-05-23# cat /proc/partitions
major minor#blocksname
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
# df -Th
Filesystem Type SizeUsed Avail Use% Mounted on
/dev/mapper/rhel-root xfs 17G4.9G 13G29% /
devtmpfs devtmpfs894M 0894M 0% /dev
tmpfs tmpfs 1.5G 01.5G 0% /dev/shm
tmpfs tmpfs 910M2.8M908M 1% /run
tmpfs tmpfs 910M 0910M 0% /sys/fs/cgroup
/dev/sdb6 ext4 190M1.6M175M 1% /mnt
/dev/sda1 xfs 1014M178M837M18% /boot
tmpfs tmpfs 182M8.0K182M 1% /run/user/42
tmpfs tmpfs 182M 32K182M 1% /run/user/0
/dev/sr0 iso9660 4.2G4.2G 0 100% /run/media/root/RHEL-7.6 Server.x86_64
/dev/loop0 xfs 1014M 33M982M 4% /run/media/root/155b06c3-e700-4347-8247-52ec954369bc
# umount/mnt
# blkid/dev/sdb6
/dev/sdb6: LABEL="/mnt" UUID="27e8f7cb-5770-4711-be5f-710401a26bcb" TYPE="ext4"
# vim /etc/fstab
# e2label /dev/sdb6
/mnt
# vim /etc/fstab
# swapon -a
# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2097148 0 1
/dev/sdb5 partition 204796 0 1
# swapoff /dev/sdb5
# vim /etc/fstab
# blkid /dev/sdb5
/dev/sdb5: UUID="a52e60db-23e4-447c-b7e8-2250eace2e1a" TYPE="swap"
# vim /etc/fstab
# pvs
PV VG FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
# cat /proc/partitions
major minor#blocksname
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
# 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 IdSystem
/dev/sdb3 2048 2097151 1047552 5Extended
/dev/sdb5 4096 413695 204800 82Linux swap / Solaris
/dev/sdb6 415744 825343 204800 83Linux
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 IdSystem
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 IdSystem
/dev/sdb1 2048 526335 262144 8eLinux LVM
/dev/sdb2 526336 1050623 262144 8eLinux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# pvcreate /dev/sdb{1,2}
WARNING: dos signature detected on /dev/sdb1 at offset 510. Wipe it? : y
Wiping dos signature on /dev/sdb1.
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdb2" successfully created.
# pvs
PV VG FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
/dev/sdb1 lvm2 ---256.00m 256.00m
/dev/sdb2 lvm2 ---256.00m 256.00m
# vgcreate vol0/dev/sdb
Volume group "vol0" successfully created
# pvs
PV VG FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
/dev/sdb1vol0 lvm2 a--252.00m 252.00m
/dev/sdb2vol0 lvm2 a--252.00m 252.00m
# 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
# vgdisplayvol0
--- Volume group ---
VG Name vol0
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No1
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
FreePE / Size 126 / 504.00 MiB
VG UUID lTte1h-UeX6-gpJu-I6YF-NxDh-aHZM-YUFRyB
# vgremove /dev/vol0
Volume group "vol0" successfully removed
# vgcreate -s 16Mvol0/dev/sdb
Volume group "vol0" successfully created
# vgdisplayvol0
--- Volume group ---
VG Name vol0
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No1
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
FreePE / Size 30 / 480.00 MiB
VG UUID rFbSJL-mgbZ-PXfG-pXl1-cNgU-PbNM-T4qecJ
# 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
# pvs
PV VG FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
/dev/sdb1vol0 lvm2 a--240.00m 240.00m
/dev/sdb2vol0 lvm2 a--240.00m 240.00m
# sync
# partprobe /dev/sdb
# sync
# pvs
PV VG FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
/dev/sdb1vol0 lvm2 a--240.00m 240.00m
/dev/sdb2vol0 lvm2 a--240.00m 240.00m
# 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
# 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 FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
/dev/sdb1vol0 lvm2 a--240.00m 240.00m
vol0 lvm2 a-m240.00m 240.00m
# 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
# 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.
# man vgreduce
# 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.
# 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.
# pvs
PV VG FmtAttr PSize PFree
/dev/sda2rhel lvm2 a--<19.00g 0
/dev/sdb1vol0 lvm2 a--240.00m 240.00m
# 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.
# vgdisplay vol0
--- Volume group ---
VG Name vol0
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No8
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
FreePE / Size 16 / 256.00 MiB
VG UUID rFbSJL-mgbZ-PXfG-pXl1-cNgU-PbNM-T4qecJ
# 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
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.
# 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
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.
# 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
lv1vol0 -wi-a----- 208.00m
#
列出SELinux上下文策略的命令:
semanage fcontext -l/var/lib/samba/winbindd_privileged(/.*)? all files system_u:object_r:winbind_var_run
semanagefcontext -a -t samba_share_t '/sharedpath(/.*)?'
页:
[1]