multipath ile kullanılan bir luna ihtiyaç kalmadığında sistemden kaldırılması;
Bir disk ünitesinden verilen bir diski(lun) linux sistemlerinden pat diye kaldırdığımızda bir sürü hata mesajları alırız. ihtiyacım kalmayan bir diski sistemden düzgün bir şekilde kaldırmak için öncelikle multipath den kaldırıp, arkadısndan disk leri sistemden silmemiz gerekir.
Aşağıdaki script bu işlem için bir örnektir.
###############################ÖRNEK#########################################
#!/bin/bash
tmpf="/tmp/deldevlst.txt"
if (( $# > 0 ))
then
export mpathdev=$1
dev=/dev/mapper/$mpathdev
if [ -e $dev ]
then
multipath -ll $mpathdev |egrep -v "status=active|size|status=enabled|$mpathdev"|sed 's/| `-//g'|sed 's/`-//g' |awk '{print $2}' > $tmpf
multipath -f $mpathdev && echo $mpathdev silindi..
for devname in `cat $tmpf`
do
echo 1 > /sys/block/$devname/device/delete && echo $devname Silindi..
done
echo $mpathdev baglantisini disk unitesinden iptal edebilirsiniz.
else
echo $dev bulunamadi
fi
else
echo Kullanim sekli: $0 multipath-name
fi
##################################ÖRNEK########################################
kullanımdan kaldırılacak disk veya diskler lvm için pv olarak tanımlı ise bu işlemlerden önce pvremove ile lvm özelliğide kaldırılmalı.
24 Ekim 2018 Çarşamba
2 Ekim 2018 Salı
RHEL 7 tabanlı sistemlerde initramfs dosyasının açılması
Mevcut initramfs dosyasını incelememiz gerektiğinde, aşağıdaki gibi initramfs açarak inceleyebiliriz.
[root@rhel7 tmp]# mkdir initramfs-extras
[root@rhel7 tmp]# cd initramfs-extras/
[root@rhel7 initramfs-extras]# cp /boot/initramfs-3.10.0-862.el7.x86_64.img .
[root@rhel7 initramfs-extras]# mv initramfs-3.10.0-862.el7.x86_64.img initramfs-3.10.0-862.el7.x86_64.img.gz
[root@rhel7 initramfs-extras]# gunzip initramfs-3.10.0-862.el7.x86_64.img.gz
[root@rhel7 initramfs-extras]# cpio -i < initramfs-3.10.0-862.el7.x86_64.img
126539 blocks
[root@rhel7 initramfs-extras]# ls
bin dev etc init initramfs-3.10.0-862.el7.x86_64.img lib lib64 proc root run sbin shutdown sys sysroot tmp usr var
[root@rhel7 initramfs-extras]#
[root@rhel7 tmp]# mkdir initramfs-extras
[root@rhel7 tmp]# cd initramfs-extras/
[root@rhel7 initramfs-extras]# cp /boot/initramfs-3.10.0-862.el7.x86_64.img .
[root@rhel7 initramfs-extras]# mv initramfs-3.10.0-862.el7.x86_64.img initramfs-3.10.0-862.el7.x86_64.img.gz
[root@rhel7 initramfs-extras]# gunzip initramfs-3.10.0-862.el7.x86_64.img.gz
[root@rhel7 initramfs-extras]# cpio -i < initramfs-3.10.0-862.el7.x86_64.img
126539 blocks
[root@rhel7 initramfs-extras]# ls
bin dev etc init initramfs-3.10.0-862.el7.x86_64.img lib lib64 proc root run sbin shutdown sys sysroot tmp usr var
[root@rhel7 initramfs-extras]#
28 Eylül 2018 Cuma
Eski şıkıştırılmış sistem loglarını incelemek
Linux sistemlerde eski log dosyaları fazla yer kaplamaması için, aşağıdaki gibi otomatik olarak şıkıştırılır.
fail2ban.log kern.log.2.gz syslog.1 Xorg.0.log.old
fail2ban.log.1 kern.log.3.gz syslog.2.gz xrdp-sesman.log
fail2ban.log.2.gz kern.log.4.gz syslog.3.gz
Bunları incelemiz gerektiğinde gzip ile açmak yerine zless aracını kullanabiliriz.
$ zless fail2ban.log.2.gz
Zless is a filter which allows examination of compressed or plain text
files one screenful at a time on a soft-copy terminal. It is the
equivalent of setting the environment variable LESSOPEN to '|gzip -cdfq
-- %s', and the environment variable LESSMETACHARS to
'<space><tab><newline>;*?"()<>[|&^`#\$%=~', and then running less.
However, enough people seem to think that having the command zless
available is important to be worth providing it.
fail2ban.log kern.log.2.gz syslog.1 Xorg.0.log.old
fail2ban.log.1 kern.log.3.gz syslog.2.gz xrdp-sesman.log
fail2ban.log.2.gz kern.log.4.gz syslog.3.gz
Bunları incelemiz gerektiğinde gzip ile açmak yerine zless aracını kullanabiliriz.
$ zless fail2ban.log.2.gz
Zless is a filter which allows examination of compressed or plain text
files one screenful at a time on a soft-copy terminal. It is the
equivalent of setting the environment variable LESSOPEN to '|gzip -cdfq
-- %s', and the environment variable LESSMETACHARS to
'<space><tab><newline>;*?"()<>[|&^`#\$%=~', and then running less.
However, enough people seem to think that having the command zless
available is important to be worth providing it.
1 Eylül 2018 Cumartesi
disklerin uzaktaki makineye 1-1 kopyalanması
Günün birinde bir sunucu taşımak zorunda kalır, fakat yeniden kurulum vs. ile uğraşmak istemiyorsanız, eski ve yeni yeni sunucuları live linux ile (tercihim ubuntu ) boot edip,
kaynak sunucu üzerinde;
dd if=/dev/sda | ssh root@1.2.3.4 "dd of=/dev/vda"
ile diski bire bir kopylayabilirsiniz.
1.2.3.4 yeni sunucunun ip adresi
vda yeni sunucudaki disk, sda eski sunucudaki disk
eyu eğlenceler
kaynak sunucu üzerinde;
dd if=/dev/sda | ssh root@1.2.3.4 "dd of=/dev/vda"
ile diski bire bir kopylayabilirsiniz.
1.2.3.4 yeni sunucunun ip adresi
vda yeni sunucudaki disk, sda eski sunucudaki disk
eyu eğlenceler
6 Ağustos 2018 Pazartesi
selinux - nginx
sudo cat /var/log/audit/audit.log | grep nginx | grep denied | sudo audit2allow -M nginx
cat nginx.te
module nginx 1.0;
require {
type unlabeled_t;
type httpd_t;
class dir read;
class file { getattr read };
}
#============= httpd_t ==============
#!!!! This avc is allowed in the current policy
allow httpd_t unlabeled_t:dir read;
allow httpd_t unlabeled_t:file read;
#!!!! This avc is allowed in the current policy
allow httpd_t unlabeled_t:file getattr;
semodule -i nginx.pp
systemctl restart nginx
17 Nisan 2018 Salı
ssh kullanıcı ayarlarım
linux sistemimdeki .ssh/config dosyasının temel satırları
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
StrictHostKeyChecking no
host mynode
hostname mynode.akyuz.tech
user root
ForwardAgent yes
ForwardX11 yes
TCPKeepAlive yes
ConnectTimeout 15
ConnectionAttempts 2
Port 22
DynamicForward 8989
LocalForward 127.0.0.1:5901 127.0.0.1:5901
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
StrictHostKeyChecking no
host mynode
hostname mynode.akyuz.tech
user root
ForwardAgent yes
ForwardX11 yes
TCPKeepAlive yes
ConnectTimeout 15
ConnectionAttempts 2
Port 22
DynamicForward 8989
LocalForward 127.0.0.1:5901 127.0.0.1:5901
30 Mart 2018 Cuma
RedHat reposunu yedeklemek
Bu gün boş boş otururken, redhat reposunu yedekleyen bir script hazırlayayım dedim. rhel reposunu yansilamak isteyenler, kendilerine uygun değişikliği yaparak kullanabilirler.
Tüm repoları indirebilmek için, rhn den repoları aktifleştirmek gerektiğinide unutmamak lazım. :)
Eyu eğlenceler.
################################################
#!/bin/bash
# Bu script Remzi AKYUZ tarafindan, redhat paketlerini yerelden kullanmak icin hazirlanmistir.
# Her hangi bir sorunuz olursa, lutfen sorunuz.
# eposta: remziakyuz@gmail.com
#set -x
# time reposync --gpgcheck -l --repoid=
repolar=( 'jbappplatform-4.3.0-fp-x86_64-server-5-rpm' 'jbappplatform-4.3.0-x86_64-server-5-rpm' 'jbappplatform-6.4-x86_64-server-5-rpm' \
'jb-ewp-5-x86_64-server-5-rpm' 'jb-ews-2-x86_64-server-5-rpm' 'jb-wfk-1-x86_64-server-5-rpm' \
'rhel-x86_64-rhev-agent-5-server' 'rhel-x86_64-server-5' \
'rhel-x86_64-server-5-mrg-management-2' 'rhel-x86_64-server-5-mrg-messaging-2' 'rhel-x86_64-server-5-thirdparty-oracle-java' \
'rhel-x86_64-server-cluster-5' 'rhel-x86_64-server-cluster-storage-5' 'rhel-x86_64-server-dts2-5-beta' 'rhel-x86_64-server-fastrack-5' \
'rhel-x86_64-server-productivity-5' 'rhel-x86_64-server-rhsclient-5' 'rhel-x86_64-server-scalefs-5' 'rhel-x86_64-server-supplementary-5' \
'rhel-x86_64-server-vt-5' 'rhn-tools-rhel-x86_64-server-5' )
count=0
cd /arsiv/redhat-repo/rhel-5
while [ "${repolar[$count]}" != "" ]
do
reponame="${repolar[$count]}"
if [ -x $reponame ]; then
echo repo olusturulmus
echo repolar guncellestirilecek
sleep 3
time reposync --gpgcheck -l --repoid=$reponame --download_path=$reponame
else
echo repo olusturuluyor $reponame
mkdir $reponame
createrepo $reponame
fi
let "count = $count + 1"
done
exit 0
################################################
Tüm repoları indirebilmek için, rhn den repoları aktifleştirmek gerektiğinide unutmamak lazım. :)
Eyu eğlenceler.
################################################
#!/bin/bash
# Bu script Remzi AKYUZ tarafindan, redhat paketlerini yerelden kullanmak icin hazirlanmistir.
# Her hangi bir sorunuz olursa, lutfen sorunuz.
# eposta: remziakyuz@gmail.com
#set -x
# time reposync --gpgcheck -l --repoid=
repolar=( 'jbappplatform-4.3.0-fp-x86_64-server-5-rpm' 'jbappplatform-4.3.0-x86_64-server-5-rpm' 'jbappplatform-6.4-x86_64-server-5-rpm' \
'jb-ewp-5-x86_64-server-5-rpm' 'jb-ews-2-x86_64-server-5-rpm' 'jb-wfk-1-x86_64-server-5-rpm' \
'rhel-x86_64-rhev-agent-5-server' 'rhel-x86_64-server-5' \
'rhel-x86_64-server-5-mrg-management-2' 'rhel-x86_64-server-5-mrg-messaging-2' 'rhel-x86_64-server-5-thirdparty-oracle-java' \
'rhel-x86_64-server-cluster-5' 'rhel-x86_64-server-cluster-storage-5' 'rhel-x86_64-server-dts2-5-beta' 'rhel-x86_64-server-fastrack-5' \
'rhel-x86_64-server-productivity-5' 'rhel-x86_64-server-rhsclient-5' 'rhel-x86_64-server-scalefs-5' 'rhel-x86_64-server-supplementary-5' \
'rhel-x86_64-server-vt-5' 'rhn-tools-rhel-x86_64-server-5' )
count=0
cd /arsiv/redhat-repo/rhel-5
while [ "${repolar[$count]}" != "" ]
do
reponame="${repolar[$count]}"
if [ -x $reponame ]; then
echo repo olusturulmus
echo repolar guncellestirilecek
sleep 3
time reposync --gpgcheck -l --repoid=$reponame --download_path=$reponame
else
echo repo olusturuluyor $reponame
mkdir $reponame
createrepo $reponame
fi
let "count = $count + 1"
done
exit 0
################################################
Kaydol:
Kayıtlar (Atom)
RedHat Enterprise Linux 9 ve 10 'da zaman aşımı
TMOUT, systemd-logind ve SSH; kullanıcıya neden mesajı gösterme; uygulamalı testler Tarih: 27.11.2026 İçindekiler 1 Özet 2 Bu...
-
Systemd ile Linux Sistem Kaynak Yönetimi: RHEL 7/8/9/10 Kapsamlı Rehberi Giriş Modern Linux dağıtımlarının neredeyse tamamı systemd servis...
-
Bu gün ttnetin hediyesi olan tilgin yönlendiriciyle biraz oynayayım dedim Matkap, ve rg316-rp-sma kablo alıp cihazın kapağını tekrar açtım. ...
-
🚀 Redis vs Valkey vs Dragonfly: 2025'te Hangi In-Memory Database Seçilmeli? 📊 Hızlı Özet Linux tabanlı sistemlerde yüksek performa...