Linux: Difference between revisions

From DWIKI
mNo edit summary
(69 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]]


== Linux distributions ==
*[[Linux_kernel|linux kernel]]  
*[[Gentoo]]
*[[Distributions|Distributions]]  
*[[RedHat]]
*https://kb.novaordis.com/index.php/Events_OS_Metrics
*[[Slackware]]
*Linux on ircnet: #linux2
*[[Debian]]
 
 
== Rescue CDs ==
 
*[https://www.scientificlinux.org/downloads/ Scientific Linux]  


*[[SystemRescueCd|SystemRescueCd]]
*[http://www.knoppix.net/ Knoppix]
 
== 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]
*[[LVM|LVM]]
*[[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]]
 
== FAQ ==
=== check if interface exists ===
/sys/class/net/$IF
===check if virtual or physical machine===
dmidecode -s system-manufacturer
virt-who
lscpu
virt-what
===Find bios version===
dmidecode -s bios-version
=== 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
*lscpu
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!)
This one gave new disk size!
Verified: CentOS 6, Ubuntu 22
echo 1 > /sys/block/sde/device/rescan
Only one that seemed to work on (centos7.x)
echo "- - -" > /sys/class/scsi_host/host2/scan
or scan all:
echo "- - -" | tee /sys/class/scsi_host/host*/scan
The winner so far:
blockdev --rereadpt /dev/sdg
but may throw blockdev: ioctl error on BLKRRPART: Device or resource busy
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
===Find maximum depth of directory===
find /var/www -type d | awk -F"/" 'NF > max {max = NF} END {print max}'
  [[Category:System Administration]] [[Category:Linux]]


== Rescue CDs ==
*[https://www.scientificlinux.org/download/ Scientific Linux]
*[http://www.sysresccd.org SystemRescueCd]
*[http://www.knoppix.net/ Knoppix]


==Administration==
===pvcreate: Cannot use /dev/sdb: device is partitioned===
*[http://www.suse.de/~agruen/acl/linux-acls/online/ POSIX ACLS]
Even /proc/partitions will confirm there's no partitions, so to convince pvcreate:
*[[LVM]]
wipefs --all /dev/sdb
*[[Linux Software Raid]]
*[http://www-128.ibm.com/developerworks/library/l-bootload.html Boot loader showdown: Getting to know LILO and GRUB]

Revision as of 14:26, 22 May 2023

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

 


Administration

 



FAQ

check if interface exists

/sys/class/net/$IF

check if virtual or physical machine

dmidecode -s system-manufacturer
virt-who
lscpu
virt-what

Find bios version

dmidecode -s bios-version

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
  • lscpu
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!)

This one gave new disk size! Verified: CentOS 6, Ubuntu 22

echo 1 > /sys/block/sde/device/rescan

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

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

or scan all:

echo "- - -" | tee /sys/class/scsi_host/host*/scan

The winner so far:

blockdev --rereadpt /dev/sdg

but may throw blockdev: ioctl error on BLKRRPART: Device or resource busy


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


Find maximum depth of directory

find /var/www -type d | awk -F"/" 'NF > max {max = NF} END {print max}'


pvcreate: Cannot use /dev/sdb: device is partitioned

Even /proc/partitions will confirm there's no partitions, so to convince pvcreate:

wipefs --all /dev/sdb