tricks & tips of linux(s)

basit ve küçük ve bir o kadar güçlü komutcukları uygun senaryolar ile çalıştıracağımız bir guide oluşturmak istedim. ara ara güncellemeyi düşünüyorum.


yol -1

df -h ile disk boş gözükmesine rağmen “No space left on device” gibi bir hata almanız durumunda sebebi muhtemelen disk üzerinde ki inode kullanımından kaynaklı olacaktır.

df -i ile kontrol edebiliriz,

Index Node > kısaca metadata bilgileri tutar diyebiliriz. nedir bunlar ?

başlıca > attributes, disk block location(s), filesystem object (metadata)

metadata ise > (change, access, modify time), (group-id, user-id, permissions), (file size, file type)

tune2fs -l /path/to/device | grep -i inode 
Inode count: 196608 (byte) var olan limiti gösterecektir.

bir dosya/klasörün inode numarası öğrenmek için,

stat test.txt
File: ‘test.txt’
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 801h/2049d Inode: 786443 Links: 1
Access: (0644/-rw-r — r — ) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2015–12–03 02:25:30.111382807 -0800
Modify: 2015–12–03 02:25:30.111382807 -0800
Change: 2015–12–03 02:25:30.111382807 -0800
&&
ls -il ile directory içerisindekiler için 
tree -a -L 1 --inodes / > alternatif
find ./ -inum 786443 (devam ettirebilir)

sistem üzerindeki file ve directory sayıları için;

for i in /*; do echo $i; find $i |wc -l; done 

dinamik olarak boyut değişmediğinden (xfs, jfs, btrfs dışında zfs (no quota)) manuel bir şekilde boyutunu yükseltmek gerekir. (lvm)

A key design element of the ZFS file system is scalability. The file system itself is 128 bit, allowing for 256 quadrillion zettabytes of storage. All metadata is allocated dynamically, so no need exists to preallocate inodes or otherwise limit the scalability of the file system when it is first created. All the algorithms have been written with scalability in mind. Directories can have up to 248 (256 trillion) entries, and no limit exists on the number of file systems or the number of files that can be contained within a file system.

peki, inode kullanımını yükselmesine neden olabileceklerden bahsedelim. birincisi boyutu küçük ve çok fazla dosyalara sahip olmanız durumunda misal arşiv gibi yada mail sunucunuza spam mail gelmesi vs.. gibi ayrıca fazla kullanılan symbolic link gibi.

not: symlink yada soft link ayrı inode tutmaktadır. hard link orjinal inode referans olarak almaktadır. (orjinal dosya silinse bile hard link aktif olacaktır.)

root@ubuntu:/home/tuncay/BASH# ls -i
3673432 hardlink.txt 3673432 real.txt 3673433 symlink.txt

dosya formatlarının block’larına baktığımız zaman

yol 1.1

bir benzeri senaryoda ise disk size utilization 100% ve herhangi bir dosya silemeyecek durumundayız,

evet, ext2/3/4 dosya formatlarında