Cause: the command fdisk is not in your command search path.
Solution 1: Add fdisk to your command search path
The method is as follows:
First, check your current command search path:
[Root @ localhost sbin] # echo $ PATH
/Usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/X11R6/bin: /home/vincent/bin
Check the path of the fdisk command.
[Root @ localhost home] # whereis fdisk
Fdisk:/sbin/fdisk/usr/share/man/man8/fdisk.8.gz
We can see that the fdisk command is no longer in the current command search path
Then, add fdisk to the search path of the current command.
Ln-s/sbin/fdisk/usr/kerberos/bin
Now you have added fdisk to the search directory of the current command. Let's take a look.
[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 uuuclient
[Root @ localhost bin] # cd/usr/Kerberos/bin
[Root @ localhost bin] # ll
Total 836
Lrwxrwxrwx 1 Root 11 Aug 21 23: 46Fdisk
->/Sbin/fdisk
-Rwxr-XR-x 1 Root 101596 Nov 25 2008 FTP
-Rwxr-XR-x 1 Root 16212 Nov 25 2008 GSS-Client
-Rwxr-XR-x 1 Root 6864 Nov 25 2008 kdestroy
-Rwxr-XR-x 1 Root 22536 Nov 25 2008 kinit
-Rwxr-XR-x 1 Root 18364 Nov 25 2008 klist
-Rwxr-XR-x 1 Root 6880 Nov 25 2008 kpasswd
-Rwxr-XR-x 1 Root 6520 Nov 25 2008 krb524init
-Rwxr-XR-x 1 Root 43 Nov 25 2008 krlogin.
-Rwxr-xr-x 1 root 40 Nov 25 2008 krsh.
-Rwsr-xr-x 1 root 147663 Nov 25 2008 ksu
-Rwxr-xr-x 1 root 10072 Nov 25 2008 kvno
-Rwxr-xr-x 1 root 43396 Nov 25 2008 rcp
-Rwxr-xr-x 1 root 39696 Nov 25 2008 rlogin.
-Rwxr-xr-x 1 root 29792 Nov 25 2008 rsh
-Rwxr-xr-x 1 root 9172 Nov 25 2008 sim_client
-Rwxr-xr-x 1 root 215752 Nov 25 2008 telnet
-Rwxr-xr-x 1 root 8684 Nov 25 2008 uuclient
-Rwxr-xr-x 1 root 42607 Nov 25 2008 v4rcp
Run fdisk now.
[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
Succeeded. Because the virtual machine is used, other disks are not visible.
Method 2:
Super simple, use $ su-
Command.
[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