原因:命令fdisk 不在你的命令搜索路径中
第一种解决办法,将fdisk添加到你的命令搜索路径中
方法如下:
先查看你当前的命令搜索路径:
[root@localhost sbin]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/vincent/bin
再查一下fdisk命令在哪个路径下
[root@localhost home]# whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
我们可看到fdisk 命令不再当前命令搜索路径里
那么我们将fdisk添加到当前命令搜索路径中即可
ln -s /sbin/fdisk /usr/kerberos/bin
好现在已经将fdisk 添加到当前命令搜索目录中去,我们可以去看一下
[root@localhost home]# cd /usr/kerberos/bin
[root@localhost bin]# ls
fdisk gss-client kinit kpasswd krlogin ksu rcp rsh telnet v4rcp
ftp kdestroy klist krb524init krsh kvno rlogin sim_client uuclient
[root@localhost bin]# cd /usr/kerberos/bin
[root@localhost bin]# ll
total 836
lrwxrwxrwx 1 root root 11 Aug 21 23:46 fdisk -> /sbin/fdisk
-rwxr-xr-x 1 root root 101596 Nov 25 2008 ftp
-rwxr-xr-x 1 root root 16212 Nov 25 2008 gss-client
-rwxr-xr-x 1 root root 6864 Nov 25 2008 kdestroy
-rwxr-xr-x 1 root root 22536 Nov 25 2008 kinit
-rwxr-xr-x 1 root root 18364 Nov 25 2008 klist
-rwxr-xr-x 1 root root 6880 Nov 25 2008 kpasswd
-rwxr-xr-x 1 root root 6520 Nov 25 2008 krb524init
-rwxr-xr-x 1 root root 43 Nov 25 2008 krlogin
-rwxr-xr-x 1 root root 40 Nov 25 2008 krsh
-rwsr-xr-x 1 root root 147663 Nov 25 2008 ksu
-rwxr-xr-x 1 root root 10072 Nov 25 2008 kvno
-rwxr-xr-x 1 root root 43396 Nov 25 2008 rcp
-rwxr-xr-x 1 root root 39696 Nov 25 2008 rlogin
-rwxr-xr-x 1 root root 29792 Nov 25 2008 rsh
-rwxr-xr-x 1 root root 9172 Nov 25 2008 sim_client
-rwxr-xr-x 1 root root 215752 Nov 25 2008 telnet
-rwxr-xr-x 1 root root 8684 Nov 25 2008 uuclient
-rwxr-xr-x 1 root root 42607 Nov 25 2008 v4rcp
好现在运行一下fdisk 看看
[root@localhost ~]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6 48163+ 83 Linux
/dev/sda2 7 515 4088542+ 83 Linux
/dev/sda3 516 949 3486105 83 Linux
/dev/sda4 950 1044 763087+ 5 Extended
/dev/sda5 950 1044 763056 82 Linux swap / Solaris
成功,因为用的是虚拟机,所以看不到其他盘。
第二种方法:
超级简单,使用 $ su -
命令即可。
[vincent@localhost grub]$ su -
Password:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6 48163+ 83 Linux
/dev/sda2 7 515 4088542+ 83 Linux
/dev/sda3 516 949 3486105 83 Linux
/dev/sda4 950 1044 763087+ 5 Extended
/dev/sda5 950 1044 763056 82 Linux swap / Solaris
该贴由koei转至本版2012-2-15 19:25:43