LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   fdisk -> unable to open (https://www.linuxquestions.org/questions/linux-general-1/fdisk-unable-to-open-37865/)

frankietomatoes 12-10-2002 11:53 AM

fdisk -> unable to open
 
Hi

I'm workikng with a ramdisk and cannot access my local HD once I've booted to the ramdisk.

used mknod to create /dev/hda, /dev/hdb

initrd# mknod hda b 3 0
initrd# mknod hda1 b 3 1
initrd# mknod hdb b 3 64
initrd# mknod hdb1 b 3 65
initrd# ls -al
...
brw-rw-r-- 1 root root 3, 0 Jan 1 01:00 hda
brw-rw-r-- 1 root root 3, 1 Jan 1 01:00 hda1
brw-rw-r-- 1 root root 3, 64 Jan 1 01:01 hdb
brw-rw-r-- 1 root root 3, 65 Jan 1 01:01 hdb1
...

initrd# fdisk /dev/hda

Unable to open /dev/hda

initrd# fdisk /dev/hdb

Unable to open /dev/hdb


Any ideas?

Thanks

unSpawn 12-10-2002 12:01 PM

Fdisk works on partitions, so try "fdisk /dev/hda<number>"

Thymox 12-10-2002 12:07 PM

Could you check the output of dmesg to see if your disk has been recognised? Have you got your /proc mounted? You could also check in there to see if the disk has been identified.

<edit>
UnSpawn, does fdisk not work on disks... when you have a blank disk, lets say, and you want to create partitions, would you not need to work on the disk rather than partition?
</edit>

frankietomatoes 12-10-2002 12:17 PM


initrd# dmesg

...
Kernel command line: console=ttyS0,115200 root=/dev/ram rw init=/linuxrc
Calibrating delay loop... 200.29 BogoMIPS
Memory: 125296k available (1128k kernel code, 360k data, 172k init, 0k highmem)
Dentry-cache hash table entries: 16384 (order: 5, 131072 bytes)
Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
Buffer-cache hash table entries: 8192 (order: 3, 32768 bytes)
Page-cache hash table entries: 32768 (order: 5, 131072 bytes)
PCI: Probing PCI hardware
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
devfs: v1.7 (20011216) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled
ttyS00 at 0xfdf04500x (irq = 3) is a 16550A
block: 256 slots per queue, batch=32
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
loop: loaded (max 8 devices)
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 1024 buckets, 8Kbytes
TCP: Hash tables configured (established 8192 bind 16384)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
RAMDISK: Compressed image found at block 0
Freeing initrd memory: 2288k freed
VFS: Mounted root (ext2 filesystem).
Mounted devfs on /dev
Freeing unused kernel memory: 172k init
pcimem: started
pcimem: open
pcimem: close
pcimem: open
pcimem: pci_addr 0x800000b4 (f=0x00000002) mapped to 0xc90020b4
pcimem: close
pcimem: terminated
initrd# ~
...

The drive is new and has no partitions.

Thymox 12-10-2002 12:22 PM

If the disk has no partitions, then there is no reason to mknod /dev/hda1. Also, your dmesg shows that hdb=your cd/dvd drive... do you need to mknod /dev/hdb1? Does fdisk /dev/hda throw a paddy if you do not mknod anything? What are you trying to put onto the disk, anyway?

frankietomatoes 12-10-2002 12:22 PM

initrd# ls -l /proc/

dr-xr-xr-x 3 root root 0 Jan 1 01:33 1
dr-xr-xr-x 3 root root 0 Jan 1 01:33 1028
dr-xr-xr-x 3 root root 0 Jan 1 01:33 2
dr-xr-xr-x 3 root root 0 Jan 1 01:33 21
dr-xr-xr-x 3 root root 0 Jan 1 01:33 26
dr-xr-xr-x 3 root root 0 Jan 1 01:33 3
dr-xr-xr-x 3 bin bin 0 Jan 1 01:33 31
dr-xr-xr-x 3 root root 0 Jan 1 01:33 4
dr-xr-xr-x 3 root root 0 Jan 1 01:33 5
dr-xr-xr-x 3 root root 0 Jan 1 01:33 74
dr-xr-xr-x 3 root root 0 Jan 1 01:33 75
dr-xr-xr-x 3 root root 0 Jan 1 01:33 76
dr-xr-xr-x 3 root root 0 Jan 1 01:33 77
dr-xr-xr-x 3 root root 0 Jan 1 01:33 78
dr-xr-xr-x 3 root root 0 Jan 1 01:33 79
dr-xr-xr-x 3 root root 0 Jan 1 01:33 84
dr-xr-xr-x 3 root root 0 Jan 1 01:33 85
dr-xr-xr-x 3 root root 0 Jan 1 01:33 852
dr-xr-xr-x 3 root root 0 Jan 1 01:33 853
dr-xr-xr-x 3 root root 0 Jan 1 01:33 86
dr-xr-xr-x 3 root root 0 Jan 1 01:33 bus
-r--r--r-- 1 root root 0 Jan 1 01:33 cmdline
-r--r--r-- 1 root root 0 Jan 1 01:33 cpuinfo
-r--r--r-- 1 root root 0 Jan 1 01:33 devices
-r--r--r-- 1 root root 0 Jan 1 01:33 dma
dr-xr-xr-x 2 root root 0 Jan 1 01:33 driver
-r--r--r-- 1 root root 0 Jan 1 01:33 execdomains
-r--r--r-- 1 root root 0 Jan 1 01:33 filesystems
dr-xr-xr-x 2 root root 0 Jan 1 01:33 fs
-r--r--r-- 1 root root 0 Jan 1 01:33 interrupts
-r--r--r-- 1 root root 0 Jan 1 01:33 iomem
-r--r--r-- 1 root root 0 Jan 1 01:33 ioports
dr-xr-xr-x 2 root root 0 Jan 1 01:33 irq
-r-------- 1 root root 134221824 Jan 1 01:33 kcore
-r-------- 1 root root 0 Jan 1 01:33 kmsg
-r--r--r-- 1 root root 0 Jan 1 01:33 ksyms
-r--r--r-- 1 root root 0 Jan 1 01:33 loadavg
-r--r--r-- 1 root root 0 Jan 1 01:33 locks
-r--r--r-- 1 root root 0 Jan 1 01:33 meminfo
-r--r--r-- 1 root root 0 Jan 1 01:33 misc
-r--r--r-- 1 root root 0 Jan 1 01:33 modules
-r--r--r-- 1 root root 0 Jan 1 01:33 mounts
dr-xr-xr-x 3 root root 0 Jan 1 01:33 net
-r--r--r-- 1 root root 0 Jan 1 01:33 partitions
-r--r--r-- 1 root root 0 Jan 1 01:33 pci
-rw-r--r-- 1 root root 0 Jan 1 01:33 ppc_htab
lrwxrwxrwx 1 root root 64 Jan 1 01:05 self -> 1028
-rw-r--r-- 1 root root 0 Jan 1 01:33 slabinfo
-r--r--r-- 1 root root 0 Jan 1 01:33 stat
-r--r--r-- 1 root root 0 Jan 1 01:33 swaps
dr-xr-xr-x 10 root root 0 Jan 1 01:33 sys
dr-xr-xr-x 2 root root 0 Jan 1 01:33 sysvipc
dr-xr-xr-x 4 root root 0 Jan 1 01:33 tty
-r--r--r-- 1 root root 0 Jan 1 01:33 uptime
-r--r--r-- 1 root root 0 Jan 1 01:33 version

unSpawn 12-10-2002 12:24 PM

Yeah, you're right Thymox, guess I was thinking of fsck instead of reading "fdisk", which is sad.
Btw good work on the stats, you did as well. Which isn't sad :-]

frankietomatoes 12-10-2002 12:29 PM

I am not 100% sure of the interface the HD is on or if there were any partitions on it.

To be safe I did mknod hda,b,a1,b1.

I need to have the root filesytem on this drive.

Currently I boot to the ramdisk(from flash) and twiddle my thumbs

Thymox 12-10-2002 12:30 PM

Quote:

Originally posted by frankietomatoes
initrd# ls -l /proc/
...
-r--r--r-- 1 root root 0 Jan 1 01:33 partitions
...

What does this say? cat /proc/partitions
Did you try doing the fdisk without mknoding anything?

frankietomatoes 12-10-2002 12:31 PM

initrd# cat /proc/partitions
major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

fdisk without mknod anything?

initrd# fdisk

Usage: fdisk [-l] [-b SSZ] [-u] device
E.g.: fdisk /dev/hda (for the first IDE disk)
or: fdisk /dev/sdc (for the third SCSI disk)
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
...
initrd# cat /proc/partitions
major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

initrd# fdisk /dev/hda

Unable to open /dev/hda
initrd# fdisk /dev/hdb

Unable to open /dev/hdb

nxny 12-10-2002 12:51 PM

Try
fdisk /dev/discs/disc0
fdisk /dev/cdroms/cdrom0

respectively for the first hard disk or the CDROM since you're using devfs.

or turn off DEVFS altogether and compile a new kernel.

More information here:
http://www.atnf.csiro.au/people/rgoo...ocs/devfs.html

HTH

frankietomatoes 12-10-2002 01:03 PM

I editted my original post with cdrom info, it was taken from a different console, wrong machine)




Noticed ide support was compiled as a module.

insmod ide-mod.o
insmod ide-probe-mod.o
insmod ide-disk.o

demsg
...
Uniform Multi-Platform E-IDE driver Revision: 6.31
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
HPT371: IDE controller on PCI bus 00 dev e0
PCI: Enabling device 00:1c.0 (0000 -> 0001)
HPT371: chipset revision 1
HPT371: not 100% native mode: will probe irqs later
HPT370: using 33MHz PCI clock
hdh: TOSHIBA MK6015MAP, ATA DISK drive
ide3 at 0x1810-0x1817,0x180e on irq 4
hdh: 11733120 sectors (6007 MB), CHS=12416/15/63
Partition check:
/dev/ide/host2/bus1/target1/lun0: [PTBL] [730/255/63] p1
...

initrd# ls /proc/ide/ -l
-r--r--r-- 1 root root 0 Jan 1 00:12 drivers
lrwxrwxrwx 1 root root 8 Jan 1 00:12 hdh -> ide3/hdh
-r--r--r-- 1 root root 0 Jan 1 00:12 hpt366
dr-xr-xr-x 3 root root 0 Jan 1 00:12 ide3


I created the hdh node, can anyone explain the

mknod //dev/hdh b 34 64

what do 34 and 64 stand for?

Thanks


All times are GMT -5. The time now is 01:37 AM.