Linux: Difference between revisions

From DWIKI
mNo edit summary
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Linux is a free Unix-type operating system originally created by [http://en.wikipedia.org/wiki/Linus_Torvalds Linus Torvalds] with the assistance of developers around the world. Developed under the [http://www.linux.org/info/gnu.html GNU General Public License] , the source code for Linux is freely available to everyone.
Linux is a free Unix-type operating system originally created by [http://en.wikipedia.org/wiki/Linus_Torvalds Linus Torvalds] with the assistance of developers around the world. Developed under the [http://www.linux.org/info/gnu.html GNU General Public License] , the source code for Linux is freely available to everyone.


== Links ==
== Links ==
*[[linux kernel]]
*[[Distributions]]


*[[Linux_kernel|linux kernel]]
*[[Distributions|Distributions]]
*https://kb.novaordis.com/index.php/Events_OS_Metrics
 


== Rescue CDs ==
== Rescue CDs ==
*[https://www.scientificlinux.org/downloads/ Scientific Linux]


*[[SystemRescueCd]]
*[https://www.scientificlinux.org/downloads/ Scientific Linux]  
*[http://www.knoppix.net/ Knoppix]


*[[SystemRescueCd|SystemRescueCd]]
*[http://www.knoppix.net/ Knoppix]
 
== Checking resources ==


==Checking resources==
  *inxi
  *inxi
  *http://www.slashroot.in/linux-system-io-monitoring
  *[http://www.slashroot.in/linux-system-io-monitoring http://www.slashroot.in/linux-system-io-monitoring]
===show what is doing most disk accesses===
 
=== show what is doing most disk accesses ===
 
  iotop  
  iotop  
  glances
  glances


===IO statistics===
=== IO statistics ===
 
  iostat
  iostat
  vmstat
  vmstat
Line 27: Line 38:
  atop
  atop


===CPU usage etc===
=== CPU usage etc ===
 
  top
  top
  atop
  atop
Line 35: Line 47:
  pidstat
  pidstat


==Administration==
== Administration ==
*[https://chrisdown.name/2018/01/02/in-defence-of-swap.html About swap]
 
*[http://www.suse.de/~agruen/acl/linux-acls/online/ POSIX ACLS]
*[https://chrisdown.name/2018/01/02/in-defence-of-swap.html About swap]  
*[[LVM]]
*[http://www.suse.de/~agruen/acl/linux-acls/online/ POSIX ACLS]  
*[[Linux Software Raid]]
*[[LVM|LVM]]  
*[http://www-128.ibm.com/developerworks/library/l-bootload.html Boot loader showdown: Getting to know LILO and GRUB]
*[[Linux_Software_Raid|Linux Software Raid]]  
*[http://www-128.ibm.com/developerworks/library/l-bootload.html Boot loader showdown: Getting to know LILO and GRUB]
 
*[[Linux_Power_Management|Linux Power Management]]  


*[[Linux Power Management]]
 
 
 
== FAQ ==
 
=== check if virtual of physicalmachine ===


==FAQ==
===check if virtual of physicalmachine===
  dmidecode -s system-manufacturer
  dmidecode -s system-manufacturer
  virt-who
  virt-who


 
=== watch which files a process opens ===
watch ls -l /proc/`pidof clamd`/fd
=== pam_succeed_if(sudo:auth): requirement "uid >= 1000" not met ===


=== Grow (GPT) last partition to max available ===


===pam_succeed_if(sudo:auth): requirement "uid >= 1000" not met===
===Grow (GPT) last partition to max available===
Where '3' is partition number
Where '3' is partition number
  parted /dev/sdf resize 3 100%
  parted /dev/sdf resize 3 100%
No longer allowed?
No longer allowed?


  gdisk
  gdisk


===timestamp to human readable===
=== timestamp to human readable ===
 
  date -d @1522142497
  date -d @1522142497
===List hardware===
 
*lshw
=== List hardware ===
*dmidecode
 
*lsusb
*lshw  
*hwinfo
*dmidecode  
*lspci
*lsusb  
*hwinfo  
*lspci  


  dmidecode -t baseboard
  dmidecode -t baseboard


===BLKRRPART: Device or resource busy===
=== BLKRRPART: Device or resource busy ===
 
spend all day or reboot
spend all day or reboot


 


=== calling ioclt to re-read partition table: Device or resource busy ===


===calling ioclt to re-read partition table: Device or resource busy===


=== rescan partition table ===


===rescan partition table===
Keep an eye on


Keep an eye on
  cat /proc/partitions
  cat /proc/partitions


Partition(s) have been written, but we have been unable to inform the kernel of the change
Partition(s) have been written, but we have been unable to inform the kernel of the change
  partprobe
  partprobe
  kpartx /dev/sdg
  kpartx /dev/sdg
  partx -uv /dev/sdg
  partx -uv /dev/sdg (this one worked on centos 7.3!)
  echo 1 > /sys/block/sde/device/rescan
  echo 1 > /sys/block/sde/device/rescan
Only one that seemed to work on (centos7.x)
Only one that seemed to work on (centos7.x)
  echo "- - -" > /sys/class/scsi_host/host2/scan
  echo "- - -" > /sys/class/scsi_host/host2/scan
The winner so far:
  blockdev --rereadpt /dev/sdg
  blockdev --rereadpt /dev/sdg


maybe
maybe
  hdparm -z /dev/sdg
  hdparm -z /dev/sdg


===Force reboot===
=== Force reboot ===
 
I found sometimes 'reboot' and 'shutdown' don't work in virtual machines, in that case try:
I found sometimes 'reboot' and 'shutdown' don't work in virtual machines, in that case try:
  #sync
  #sync
  echo s > /proc/sysrq-trigger
  echo s > /proc/sysrq-trigger
Line 105: Line 143:
  echo b > /proc/sysrq-trigger
  echo b > /proc/sysrq-trigger


===Mignight commander/dialog strange characters===
=== Mignight commander/dialog strange characters ===
 
Quick fix:
Quick fix:
  export LANG=en_US.ISO-8859-1
  export LANG=en_US.ISO-8859-1


This probleem seems to be related to screen/su -
This probleem seems to be related to screen/su -


===kpartx failing silently===
=== kpartx failing silently ===
 
No output/result when trying to create:
No output/result when trying to create:
  kpartx -lv /dev/mapper/foo
  kpartx -lv /dev/mapper/foo
this might means the device hasn't been partitioned
this might means the device hasn't been partitioned


No output when trying to delete:
No output when trying to delete:
  kpartx -d /dev/mapper/foop1
  kpartx -d /dev/mapper/foop1
means you should use
means you should use
  kpartx -d /dev/mapper/foo
  kpartx -d /dev/mapper/foo


 
 
=== Create swapfile ===
fallocate -l 4G /var/swapfile
mkswap /var/swapfile
Temporary:
swapon -v /var/swapfile
In fstab:
/var/swapfile swap swap sw,prio=-1
swapon failed: Invalid argument
problably trying to use fallocate on rhel/centos, use dd instead
=== partx: error adding partition ===


[[Category: System Administration]]
try kpartx instead
[[Category: Linux]]
  [[Category:System Administration]] [[Category:Linux]]

Revision as of 15:42, 16 July 2021

Linux is a free Unix-type operating system originally created by Linus Torvalds with the assistance of developers around the world. Developed under the GNU General Public License , the source code for Linux is freely available to everyone.


Links

 

Rescue CDs

 

Checking resources

*inxi
*http://www.slashroot.in/linux-system-io-monitoring

show what is doing most disk accesses

iotop 
glances

IO statistics

iostat
vmstat
dstat
ioping
atop

CPU usage etc

top
atop
htop
vtop
fio
pidstat

Administration

 


FAQ

check if virtual of physicalmachine

dmidecode -s system-manufacturer
virt-who

 

watch which files a process opens

watch ls -l /proc/`pidof clamd`/fd

pam_succeed_if(sudo:auth): requirement "uid >= 1000" not met

Grow (GPT) last partition to max available

Where '3' is partition number

parted /dev/sdf resize 3 100%

No longer allowed?

gdisk

timestamp to human readable

date -d @1522142497

List hardware

  • lshw
  • dmidecode
  • lsusb
  • hwinfo
  • lspci
dmidecode -t baseboard

BLKRRPART: Device or resource busy

spend all day or reboot

 

calling ioclt to re-read partition table: Device or resource busy

rescan partition table

Keep an eye on

cat /proc/partitions

Partition(s) have been written, but we have been unable to inform the kernel of the change

partprobe
kpartx /dev/sdg
partx -uv /dev/sdg (this one worked on centos 7.3!)
echo 1 > /sys/block/sde/device/rescan

Only one that seemed to work on (centos7.x)

echo "- - -" > /sys/class/scsi_host/host2/scan

The winner so far:

blockdev --rereadpt /dev/sdg

maybe

hdparm -z /dev/sdg

Force reboot

I found sometimes 'reboot' and 'shutdown' don't work in virtual machines, in that case try:

#sync
echo s > /proc/sysrq-trigger
#optionally umount
echo u > /proc/sysrq-trigger
#reboot
echo b > /proc/sysrq-trigger

Mignight commander/dialog strange characters

Quick fix:

export LANG=en_US.ISO-8859-1

This probleem seems to be related to screen/su -

kpartx failing silently

No output/result when trying to create:

kpartx -lv /dev/mapper/foo

this might means the device hasn't been partitioned

No output when trying to delete:

kpartx -d /dev/mapper/foop1

means you should use

kpartx -d /dev/mapper/foo

 

 


Create swapfile

fallocate -l 4G /var/swapfile
mkswap /var/swapfile

Temporary:

swapon -v /var/swapfile

In fstab: /var/swapfile swap swap sw,prio=-1

swapon failed: Invalid argument

problably trying to use fallocate on rhel/centos, use dd instead

partx: error adding partition

try kpartx instead