You may get an error when starting ssh on terminal,
#/etc/init.d/sshd start
touch: cannot touch `'/var/lock/subsys/sshd': No space left on device
touch: cannot touch `'/var/lock/subsys/sshd': No space left on device
Note:
When the sshd started through an init script a new file created in the /var/lock/subsys/ directory with the same name. Its would be /var/lock/subsys/sshd. When the service is stopped, the file will be removed from there.
Solution:
Do’nt have permission for creating files there or need to check disk space and inode space immediately.
Check Disk Space:
# df -h
File system Size Used Avail Use% Mounted on
/dev/sda1 15G 11G 4.2G 72% /
File system Size Used Avail Use% Mounted on
/dev/sda1 15G 11G 4.2G 72% /
Check Inode Space:
# df -i
File system Inodes IUsed IFree IUse% Mounted on
/dev/sda1 1923840 1923840 0 100% /
(or)
# df -ih
File system Inodes IUsed IFree IUse% Mounted on
/dev/sda1 1923840 1923840 0 100% /
(or)
# df -ih
You can trace the inode usage with below command and reduce unwanted files,
# echo "INODE USAGE for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"
Sample output:
INODE USAGE for: /
153 - bin
259 - boot
526 - dev
2641 - etc
23957 - home
11528 - lib
...
Total: 1923840
153 - bin
259 - boot
526 - dev
2641 - etc
23957 - home
11528 - lib
...
Total: 1923840
Finally, you can start the sshd services.
#/etc/init.d/sshd start
Great !