fdisk issues on CentOS

Karandras

[H]ard|Gawd
Joined
Feb 16, 2001
Messages
1,873
Hey,

I'm trying to add a USB drive to my CentOS box to copy some backups to. However I can't get the drive information without fdisk. fdisk doesn't want to give me any information:

# cat /etc/*-release
CentOS release 5.3 (Final)
# fdisk -l
#

What is wrong? How can I fix this? Thanks for your help!
 
You'll need to run fdisk as the root user to get the listing.
Code:
[user@server ~]$sudo fdisk -l
or if you're not in the sudoers list
Code:
[user@server ~]$su - 
[root@server ~]$fdisk -l

edit:
Nevermind if you're already aware of it, but I feel compelled to point out that point release 5.3 is quite a bit behind from the current 5.11 release. You may want to put updating on the todo list.
 
Last edited:
Hey,

Thanks for the reply. This server is due to be decommissioned as soon as I have the time to get the clients off of it. Hence the lack of updates....

I'm running as root on there so fdisk should be working properly?
 
Hey,

Thanks for the reply. This server is due to be decommissioned as soon as I have the time to get the clients off of it. Hence the lack of updates....

I'm running as root on there so fdisk should be working properly?

I'd expect it to give you some sort of output when running as root, yes.

I just tried on my 5.11 box and, as a regular user, 'fdisk -l' gives no output and just returns a newline with command prompt. Switching user to root, it lists my disks as expected.

I'm not really sure on what to recommend poking at. I guess check your path and make sure you're running the desired fdisk (/sbin/fdisk), take a look at /var/log/messages and /var/log/secure to ensure that you are indeed switching to root. The whoami and id commands would also help with that.
example as root:
Code:
 #id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
 
Last edited:
Was the USB device detected by the system? Check the kernel ring buffer. You should see something like:

Code:
sean@sean-laptop ~ $ dmesg | tail -n 15
[694452.278306] usb 4-1: New USB device found, idVendor=13fe, idProduct=5200
[694452.278309] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[694452.278311] usb 4-1: Product: MKNUFDVS32GB
[694452.278312] usb 4-1: Manufacturer: MUSHKIN
[694452.278313] usb 4-1: SerialNumber: 070742D4101F6F96
[694452.278833] usb-storage 4-1:1.0: USB Mass Storage device detected
[694452.278904] scsi host8: usb-storage 4-1:1.0
[694453.281357] scsi 8:0:0:0: Direct-Access     MUSHKIN  MKNUFDVS32GB     PMAP PQ: 0 ANSI: 6
[694453.281519] sd 8:0:0:0: Attached scsi generic sg3 type 0
[694453.281685] sd 8:0:0:0: [sdc] 61767680 512-byte logical blocks: (31.6 GB/29.4 GiB)
[694453.282516] sd 8:0:0:0: [sdc] Write Protect is off
[694453.282521] sd 8:0:0:0: [sdc] Mode Sense: 2b 00 00 08
[694453.283350] sd 8:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[694453.391313]  sdc: sdc1
[694453.393870] sd 8:0:0:0: [sdc] Attached SCSI removable disk
 
Back
Top