Linux: Difference between revisions

From Han Wiki
Jump to navigation Jump to search
→‎File: add a User section
Line 55: Line 55:
! Command
! Command
|-
|-
| style="width: 50%;" | Create a volume group.
| style="width: 50%;" class="cli" | Create a volume group.
| style="width: 50%;" | <code>vgcreate vg1 /dev/sdb1 /dev/sdc1</code>
| style="width: 50%;" class="cli" | vgcreate vg1 /dev/sdb1 /dev/sdc1
|-
|-
| style="width: 50%;" | Add a physical volume to a volume group.
| style="width: 50%;" class="cli" | Add a physical volume to a volume group.
| style="width: 50%;" | <code>vgextend vg1 /dev/sdd1</code>
| style="width: 50%;" class="cli" | vgextend vg1 /dev/sdd1
|-
|-
| style="width: 50%;" | Display volume group.
| style="width: 50%;" class="cli" | Display volume group.
| style="width: 50%;" | <code>vgdisplay new_vg</code>
| style="width: 50%;" class="cli" | vgdisplay new_vg
|-
|-
| style="width: 50%;" | Scan disks for volume groups.
| style="width: 50%;" | Scan disks for volume groups.
| style="width: 50%;" | <code>vgscan</code>
| style="width: 50%;" class="cli" | vgscan
|-
|-
| style="width: 50%;" | Remove a physical volume from a volume group.
| style="width: 50%;" | Remove a physical volume from a volume group.
| style="width: 50%;" | <code>vgreduce group_name /dev/sdc1</code>
| style="width: 50%;" class="cli" | vgreduce group_name /dev/sdc1
|-
|-
| style="width: 50%;" | Change the maximum number of logical volumes of volume group vg00 to 128.
| style="width: 50%;" | Change the maximum number of logical volumes of volume group vg00 to 128.
| style="width: 50%;" | <code>vgchange -l 128 /dev/vg00</code>
| style="width: 50%;" class="cli" | vgchange -l 128 /dev/vg00
|-
|-
| style="width: 50%;" | Activate or deactivate a volume group.
| style="width: 50%;" | Activate or deactivate a volume group.
| style="width: 50%;" | <code>vgchange -a n my_volume_group</code>
| style="width: 50%;" class="cli" | vgchange -a n my_volume_group
|-
|-
| style="width: 50%;" | Remove a volume group.
| style="width: 50%;" | Remove a volume group.
| style="width: 50%;" | <code>vgremove officevg</code>
| style="width: 50%;" class="cli" | vgremove officevg
|-
|-
| style="width: 50%;" | Split the physical volumes of a volume group and create a new volume group.
| style="width: 50%;" | Split the physical volumes of a volume group and create a new volume group.
| style="width: 50%;" | <code>$ vgsplit bigvg smallvg /dev/ram15<br>Volume group "smallvg" successfully split from "bigvg"</code>
| style="width: 50%;" class="cli" | $ vgsplit bigvg smallvg /dev/ram15<br>Volume group "smallvg" successfully split from "bigvg"
|-
|-
| style="width: 50%;" | Merge the inactive volume group my_vg into the active or inactive volume group databases giving verbose runtime information.
| style="width: 50%;" | Merge the inactive volume group my_vg into the active or inactive volume group databases giving verbose runtime information.
| style="width: 50%;" | <code>vgmerge -v databases my_vg</code>
| style="width: 50%;" class="cli" | vgmerge -v databases my_vg
|-
|-
| style="width: 50%;" | Change the name of a volume group.
| style="width: 50%;" | Change the name of a volume group.
| style="width: 50%;" | <code>vgrename vg02 my_volume_group</code>
| style="width: 50%;" class="cli" | vgrename vg02 my_volume_group
|}
|}



Revision as of 05:57, 3 April 2018


SSH

Description Command
Create private/public SSH key file using 2048 bit encryption and with a comment. The command creates files under ~/.ssh folder. ssh-keygen -b 2048 -C user@host.domain
Push public SSH key to a server ssh-copy-id -p 41111 -i ~/.ssh/id_rsa.pub mhan@remote.server.com
Reset (SELinux) permissions related to SSH. This may be needed if all else fails to correct the issue of system not accepting public keys. restorecon -R -v ~/.ssh

Disk

LVM

Physical volume

Description Command
Initialize for use as LVM physical volume. pvcreate /dev/sdb1
Scanning for block devices. lvmdiskscan
Display the physical volumes. pvdisplay
Show all physical devices. pvscan
Prevent allocation of physical extents on the free space of one or more physical volumes. pvchange -x n /dev/sdb1
Resize. pvresize
Remove LVM label. pvremove

Volume group

Description Command
Create a volume group. vgcreate vg1 /dev/sdb1 /dev/sdc1
Add a physical volume to a volume group. vgextend vg1 /dev/sdd1
Display volume group. vgdisplay new_vg
Scan disks for volume groups. vgscan
Remove a physical volume from a volume group. vgreduce group_name /dev/sdc1
Change the maximum number of logical volumes of volume group vg00 to 128. vgchange -l 128 /dev/vg00
Activate or deactivate a volume group. vgchange -a n my_volume_group
Remove a volume group. vgremove officevg
Split the physical volumes of a volume group and create a new volume group. $ vgsplit bigvg smallvg /dev/ram15
Volume group "smallvg" successfully split from "bigvg"
Merge the inactive volume group my_vg into the active or inactive volume group databases giving verbose runtime information. vgmerge -v databases my_vg
Change the name of a volume group. vgrename vg02 my_volume_group

Users

UID or GID

Description Command
Check UID. id -u username
Check GID. id -g username
Check all of the groups a user belongs to. id -G username
Check UID and all of the groups a user belongs to. id username

File

Permissions

Letter Number
r 4
w 2
x 1
rw- 6
r-x 5
rwx 7