Thursday, September 29, 2016

.::: Troubleshoot Cannot Run Command df, df -kh Hang on Redhat/Rhel, Linux, FreeBSD :::.

This  manual page documents the GNU version of df.  df displays the amount of disk space available on the file system containing each file name argument.   If  no  file  name  is given, the space available on all currently mounted file systems is shown.  Disk  space  is  shown  in  1K  blocks  by default,  unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.

If an argument is the absolute file name of a disk device node  containing a  mounted  file  system, df shows the space available on that file system rather than on the file system containing the device node (which is always the root file system).  This version of df cannot show the space available on unmounted file systems, because on  most  kinds  of  systems  doing  so requires very nonportable intimate knowledge of file system structures.
     
1. User root cannot run command df -kh
[root@TEGUHTH ~]# df -kh
^C ^C
[root@TEGUHTH ~]# ^C

2. Another User can run command df -kh
[root@TEGUHTH ~]# su teguh
[teguh@TEGUHTH root]$ df -kh
df: `/root/.gvfs': Permission denied
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       145G   45G   93G  33% /
tmpfs            16G  248K   16G   1% /dev/shm
/dev/sda3        39G  6.7G   30G  19% /opt/TeguhServer
/dev/sdb1       260G   22G  225G   9% /opt/TeguhServer/backup
/dev/sdc8       2.0T   37G  1.8T   2% /opt/TeguhServer/berubah1
/dev/sdc3        48G  2.4G   44G   6% /opt/TeguhServer/berubah1/orasys
/dev/sdc6       9.5G   47M  9.0G   1% /opt/TeguhServer/berubah1/orasys/temp
/dev/sdc1       289G  642M  273G   1% /opt/TeguhServer/berubah1/orasys/temp/admin
/dev/sdc4        48G   52M   46G   1% /opt/TeguhServer/ext_tables
/dev/sda5       9.5G  1.6G  7.5G  17% /opt/TeguhServer/orasys/redo
/dev/sdc7       9.5G   22M  9.0G   1% /opt/TeguhServer/pesan
/dev/sdc2        96G   60M   92G   1% /opt/TeguhServer/pesan2
/dev/sdc5        20G  402M   18G   3% /opt/TeguhServer/static
/dev/sdb2       291G  8.6G  268G   4% /opt/TeguhServer/stats
/dev/sda6        22G  315M   20G   2% /var
[teguh@TEGUHTH root]$
[teguh@TEGUHTH root]$ id
uid=503(teguh) gid=100(users) groups=100(users),10(wheel)
[teguh@TEGUHTH root]$

3. Check dmess and find log about cannot mount
gvfs-fuse-daemon /root/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev 0 0


4. Check /etc/mtab & /etc/fstab & find gvfs-fuse-daemon /root/.gvfs
[root@TEGUHTH ~]# cat /etc/mtab
/dev/sda1 / ext4 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/sda3 /opt/TeguhServer ext4 rw 0 0
/dev/sdb1 /opt/TeguhServer/backup ext4 rw 0 0
/dev/sdc8 /opt/TeguhServer/berubah1 ext4 rw 0 0
/dev/sdc3 /opt/TeguhServer/berubah1/orasys ext4 rw 0 0
/dev/sdc6 /opt/TeguhServer/berubah1/orasys/temp ext4 rw 0 0
/dev/sdc1 /opt/TeguhServer/berubah1/orasys/temp/admin ext4 rw 0 0
/dev/sdc4 /opt/TeguhServer/ext_tables ext4 rw 0 0
/dev/sda5 /opt/TeguhServer/orasys/redo ext4 rw 0 0
/dev/sdc7 /opt/TeguhServer/pesan ext4 rw 0 0
/dev/sdc2 /opt/TeguhServer/pesan2 ext4 rw 0 0
/dev/sdc5 /opt/TeguhServer/static ext4 rw 0 0
/dev/sdb2 /opt/TeguhServer/stats ext4 rw 0 0
/dev/sda6 /var ext4 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
gvfs-fuse-daemon /root/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev 0 0

[root@TEGUHTH ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Mar  2 11:41:07 2016
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=01bb6b8d-0aa2-4d99-8d05-5ae26b251234 /                       ext4    defaults        1 1
UUID=dd370f16-cebc-48a2-9f38-dc0963611234 /opt/TeguhServer            ext4    defaults        1 2
UUID=f135e56b-9092-42bd-89bf-dffc4b221234 /opt/TeguhServer/backup     ext4    defaults        1 2
UUID=f6eff491-f543-4dd9-9d3c-67f5a41f1234 /opt/TeguhServer/berubah1   ext4    defaults        1 2
UUID=6018549d-d2b9-46da-a139-610a4cd71234 /opt/TeguhServer/berubah1/orasys ext4    defaults        1 2
UUID=a6078acf-8913-4a30-867b-149d72661234 /opt/TeguhServer/berubah1/orasys/temp ext4    defaults        1 2
UUID=9b7171a1-c845-4f06-915d-a8691c3e1234 /opt/TeguhServer/berubah1/orasys/temp/admin ext4    defaults        1 2
UUID=40d36a96-8716-4188-bae8-c4001f5b1234 /opt/TeguhServer/ext_tables ext4    defaults        1 2
UUID=e74c4770-8f46-42f4-b624-c2f2023d1234 /opt/TeguhServer/orasys/redo ext4    defaults        1 2
UUID=7d0cf020-d3a2-4df1-b75b-7d014bfa1234 /opt/TeguhServer/pesan   ext4    defaults        1 2
UUID=e7cab136-874e-41c4-9252-cd89865f1234 /opt/TeguhServer/pesan2  ext4    defaults        1 2
UUID=5c20ed15-6b0b-471b-a06a-84b4bf261234 /opt/TeguhServer/static     ext4    defaults        1 2
UUID=52c73a25-5655-40f7-9709-8caeb47e1234 /opt/TeguhServer/stats      ext4    defaults        1 2
UUID=66b70ee7-33bf-4e93-b68b-303220e81234 /var                    ext4    defaults        1 2
UUID=1a552df5-56bd-4488-8877-6e8284b41234 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
[root@TEGUHTH ~]#

5. Umount /root/.gvfs & delete
[root@TEGUHTH ~]#  umount/root/.gvfs
[root@TEGUHTH ~]#  rm -R /root/.gvfs

6. Exclude fuse.gvfs-fuse-daemon from  df
[root@TEGUHTH ~]#  df -x fuse.gvfs-fuse-daemon

7. Create/edit .bashrc root and add alias df='df -x fuse.gvfs-fuse-daemon'
[root@TEGUHTH ~]# pwd
/root
[root@TEGUHTH ~]# more .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias df='df -x fuse.gvfs-fuse-daemon'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi
[root@TEGUHTH ~]#

8. Run command df using root
[root@TEGUHTH ~]# df -kh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       145G   45G   93G  33% /
tmpfs            16G  248K   16G   1% /dev/shm
/dev/sda3        39G  6.7G   30G  19% /opt/TeguhServer
/dev/sdb1       260G   22G  225G   9% /opt/TeguhServer/backup
/dev/sdc8       2.0T   37G  1.8T   2% /opt/TeguhServer/berubah1
/dev/sdc3        48G  2.4G   44G   6% /opt/TeguhServer/berubah1/orasys
/dev/sdc6       9.5G   47M  9.0G   1% /opt/TeguhServer/berubah1/orasys/temp
/dev/sdc1       289G  642M  273G   1% /opt/TeguhServer/berubah1/orasys/temp/admin
/dev/sdc4        48G   52M   46G   1% /opt/TeguhServer/ext_tables
/dev/sda5       9.5G  1.6G  7.5G  17% /opt/TeguhServer/orasys/redo
/dev/sdc7       9.5G   22M  9.0G   1% /opt/TeguhServer/pesan
/dev/sdc2        96G   60M   92G   1% /opt/TeguhServer/pesan2
/dev/sdc5        20G  402M   18G   3% /opt/TeguhServer/static
/dev/sdb2       291G  8.6G  268G   4% /opt/TeguhServer/stats
/dev/sda6        22G  315M   20G   2% /var
[root@TEGUHTH ~]# ^C
[root@TEGUHTH ~]# ^C

9. Run command df using another user
[root@TEGUHTH ~]# su teguh
[teguh@TEGUHTH root]$ df -kh
df: `/root/.gvfs': Permission denied
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       145G   45G   93G  33% /
tmpfs            16G  248K   16G   1% /dev/shm
/dev/sda3        39G  6.7G   30G  19% /opt/TeguhServer
/dev/sdb1       260G   22G  225G   9% /opt/TeguhServer/backup
/dev/sdc8       2.0T   37G  1.8T   2% /opt/TeguhServer/berubah1
/dev/sdc3        48G  2.4G   44G   6% /opt/TeguhServer/berubah1/orasys
/dev/sdc6       9.5G   47M  9.0G   1% /opt/TeguhServer/berubah1/orasys/temp
/dev/sdc1       289G  642M  273G   1% /opt/TeguhServer/berubah1/orasys/temp/admin
/dev/sdc4        48G   52M   46G   1% /opt/TeguhServer/ext_tables
/dev/sda5       9.5G  1.6G  7.5G  17% /opt/TeguhServer/orasys/redo
/dev/sdc7       9.5G   22M  9.0G   1% /opt/TeguhServer/pesan
/dev/sdc2        96G   60M   92G   1% /opt/TeguhServer/pesan2
/dev/sdc5        20G  402M   18G   3% /opt/TeguhServer/static
/dev/sdb2       291G  8.6G  268G   4% /opt/TeguhServer/stats
/dev/sda6        22G  315M   20G   2% /var
[teguh@TEGUHTH root]$
[teguh@TEGUHTH root]$ id
uid=503(teguh) gid=100(users) groups=100(users),10(wheel)
[teguh@TEGUHTH root]$

No comments:

Post a Comment

Popular Posts