Compact Flash not automatically mounted but still visible

Posted on 2006-05-30
Last Modified: 2013-12-16
I have a linux box running kernel 2.6, when it boots it gets mounted by the following command in one of the startup scripts in /etc/init.d/
#Check compact flash
fsck -y /dev/hda1
# Mount CF
mount /mnt/CF

The entry in fstab is
/dev/hda1            /mnt/CF             ext2 defaults 0 0

It has worked flawlesly for a year, however I have recently had to upgrade the compact flash to a new model, unfortunately this model does not get mounted automatically, and when i issue the mount command from the command line instead of getting:
/dev/hda1 on /mnt/CF type ext2 (rw)
i don't get any entry for /mnt/CF

Still, and this is what reallly get's me, i can still access the card, and read/write the files, i thought this would be impossible as it's not mounted !. If i then issue manually  the mount /mnt/CF command again the CF gets mounted normally

Any idea of what could be going on? why is it failing and why is it that even if it's failing to mount i can access it?
Question by:ealdaz
    LVL 87

    Expert Comment

    Can you post the complete fstab here? Maybe the card gets mounted to some other mount point?

    Author Comment

    Here it is:

    #device                 mount point             type    flags           0 0
    /dev/mtdblock3          /                       jffs2   defaults        0 0
    tmpfs                   /var/tmp                tmpfs   defaults,size=4M 0 0
    none                    /proc                   proc    defaults        0 0
    none                    /dev/pts                devpts  defaults        0 0
    /dev/hda1            /mnt/CF             ext2 defaults 0 0
    /dev/sda1            /mnt/removable            vfat noauto,user 0 0

    LVL 87

    Expert Comment

    Have you checked the last line, /dev/sda1   /mnt/removable? I'm thinking that could be your CF drive. Normally /dev/hda... are IDE disks anyway, and /dev/sd.... are used for SCSI, SATA, USB etc. and card readers are usually connected to USB ports.

    Author Comment

    Hi rindy, thanks for your help
    My old CF was /dev/hda1 without a doubt (I've formatted it by accesing dev/hda )

    If i understood you correctly you think that maybe this new CF does not appear as /dev/hda1 but maybe as /dev/sda1 ?

    I'll check, but i would have thought that if that was the case it would appear under /mnt/removable not under /mnt/CF ?
    LVL 87

    Expert Comment

    It wouldn't show up at first at all, as /mnt/removable isn't mounted automatically, but if you do a manual mount (mount /dev/sda1) it would go to /mnt/removable.

    Author Comment

    OK, what puzzles me however is that if i enter the /mnt/CF directory i can see the files in the compact flash ? and normally one can't enter a directory if it's not mounted to anything... if there is any extra information i can provide that would help?
    LVL 87

    Expert Comment

    Not necessarily. A mount point is a folder on the HD (/mnt/CF) in your case, and of course it is possible to copy data to that folder, in particular as root. You'd have to check if this is the case with the flash card removed from the PC. If there are no files inside that folder then they actually are on your CF disk!

    Author Comment

    That is a very good point, i'll check it asap and let you know

    Author Comment

    Just checked, and as it turns out when the CF isn't mounted the files are copied on the /mnt/CF/ directory directly on the HD as you said, so i was indeed seeing the HD and not the CF.

    If i insert the CF card , mount it with mount /mnt/CF and the and do a mount i get as expected:
    /dev/hda1 on /mnt/CF type ext2 (rw)

    However i still have the problem that when the machine first boots the CF doesn't get mounted, (the old one did), why could that be, do some CF cards need more time than others to be ready to be mounted?

    This is the part of the script that mounts the CF, and it succeeds perfectly with the older CF

    + fsck -y /dev/hda1
    fsck 1.35 (28-Feb-2004)
    e2fsck 1.35 (28-Feb-2004)
    fsck.ext2: No such device or address while trying to open /dev/hda1
    Possibly non-existent or swap device?
    + mount /mnt/CF
    mount: /dev/hda1 is not a valid block device

    And as i say, once the booting process is over and i can log into the computer, by simply doing mount the CF gets mounted...

    Why would it be failing at boot time?

    LVL 87

    Expert Comment

    There could be a module or driver is needed and that isn't ready yet when the system tries mounting it.

    Author Comment

    How would you advice i modify the script to wait till it can mount the device?
    Would something like this work?
    while ! fsck -y /dev/hda1
               sleep 2

    is the syntax right?
    LVL 87

    Expert Comment

    I'm not very literate in scripts. I'd probably just put the mount command like when you mount it manually into a file inside /etc/init.d, then add a symlink to the runlevels you want it loaded in.
    /etc/rc.3 or /etc/rc.5
    The symlink filename would look similar to this:

    (S=Start, xx=numeric value where the lower number starts earlier).

    Author Comment

    That is where it is now, the thing is that mount fails because for whatever reason the CF is not ready, therefore I want to make sure i keep waiting and trying until it succeeds...

    LVL 87

    Expert Comment

    Try using a higher number for xx, like 99 so it is processed last.

    Author Comment

    Should have said, it's 99 now
    LVL 22

    Expert Comment

    One solution is to add the command:

    mount /mnt/CF

    to the end of /etc/rc.local

    This gets executed after every other other init script is run.

    Otherwise we need to try and find the source of the problem. Often this is as a result of modules not being installed correctly. Please provide the output from:




    Once the CF is mounted. I should then be able to tell you what you need to alter to get this to work automatically. I also need the text in /etc/modules.conf (or modprobe.conf) depending which you have.

    Author Comment

    That is the solution I had opted for, as my startup scripts (S99viper) starts a ppp0 connection which is very slow (30s), so mounting at the end of the script is succesful.
    However i would be very interested in understanding what's going on, so if you have a sec these are the outputs you have requested, after the device is mounted:

    alias net-pf-10       off
    alias net-pf-11       off
    alias net-pf-18       off
    alias net-pf-31       bluez

    alias block-major-3       ide-probe-mod
    alias block-major-22       ide-probe-mod

    alias char-major-6      lp
    alias char-major-10-250 hci_vhci
    alias char-major-89      i2c-dev
    alias char-major-108      ppp_generic

    alias tty-ldisc-3      ppp_async
    alias tty-ldisc-15       hci_uart
    alias bt-proto-0       l2cap
    alias bt-proto-2       sco

    # The module names for IDE changed between 2.4.21 and 2.4.22. However
    # 2.4.21 was broken for modules IDE so the changes have been backported
    # to 2.4.21.
    define KERNEL_VER `uname -r`
    if KERNEL_VER >= 2.4.21
      alias ide-mod           ide-core
      alias ide-probe-mod     ide-detect

    # Include board specific configuration if it exists...
    if -f /etc/modules.conf.board
    include /etc/modules.conf.board


    Module                  Size  Used by
    ide_disk               13664  2
    ppp_deflate             4576  0
    ppp_async               8992  1
    crc_ccitt               1504  1 ppp_async
    ppp_generic            22036  6 ppp_deflate,ppp_async
    slhc                    6176  1 ppp_generic
    ide_cs                  4836  1
    ide_core               81528  2 ide_disk,ide_cs
    pcmcia                 17960  3 ide_cs
    pxa2xx_cs               2148  2
    pxa2xx_core            10304  1 pxa2xx_cs
    pcmcia_core            36092  3 ide_cs,pcmcia,pxa2xx_core
    isp116x_hcd            14276  0
    usbcore                94716  2 isp116x_hcd
    ext2                   41444  1
    ds1307                  7196  0


    Linux version (ealdaz@EDU-LAPTOP) (gcc version 3.4.2) #1 Tue Jun 7 19:47:27 CEST 2005
    CPU: XScale-PXA255 [69052d06] revision 6 (ARMv5TE)
    CPU0: D VIVT undefined 5 cache
    CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
    CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
    Machine: Arcom VIPER SBC
    Memory policy: ECC disabled, Data cache writeback
    Memory clock: 99.53MHz (*27)
    Run Mode clock: 398.13MHz (*4)
    Turbo Mode clock: 398.13MHz (*1.0, active)
    On node 0 totalpages: 16384
      DMA zone: 16384 pages, LIFO batch:4
      Normal zone: 0 pages, LIFO batch:1
      HighMem zone: 0 pages, LIFO batch:1
    Built 1 zonelists
    Kernel command line: root=/dev/mtdblock2 rootfstype=jffs2 ro console=ttyS0,115200
    Map ISA IRQ 3 to IRQ 104
    Map ISA IRQ 4 to IRQ 105
    Map ISA IRQ 5 to IRQ 106
    Map ISA IRQ 6 to IRQ 107
    Map ISA IRQ 7 to IRQ 108
    Map ISA IRQ 10 to IRQ 109
    Map ISA IRQ 11 to IRQ 110
    Map ISA IRQ 12 to IRQ 111
    Map ISA IRQ 9 to IRQ 112
    Map ISA IRQ 14 to IRQ 113
    Map ISA IRQ 15 to IRQ 114
    IRQ2 (GPIO1): rising falling edges
    IRQ1 (GPIO0): rising edges
    IRQ25 (GPIO2): rising edges
    IRQ27 (GPIO4): rising edges
    IRQ26 (GPIO3): rising edges
    PID hash table entries: 512 (order: 9, 8192 bytes)
    Console: colour dummy device 80x30
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 64MB = 64MB total
    Memory: 63104KB available (1423K code, 273K data, 64K init)
    Calibrating delay loop... 397.31 BogoMIPS (lpj=1986560)
    Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    NET: Registered protocol family 16
    viper: setting CPU core voltage to 1.3V at 398.131MHz
    viper: this hardware version has no version register.
    PXA CPU frequency change support initialized
    NetWinder Floating Point Emulator V0.97 (double precision)
    JFFS2 version 2.2. (C) 2001-2003 Red Hat, Inc.
    Serial: 8250/16550 driver $Revision: 1.90 $ 59 ports, IRQ sharing enabled
    ttyS3 at MMIO 0x14300010 (irq = 27) is a 16550A
    ttyS4 at MMIO 0x14300000 (irq = 26) is a 16550A
    ttyS0 at MMIO 0x40100000 (irq = 15) is a FFUART
    ttyS1 at MMIO 0x40200000 (irq = 14) is a BTUART
    ttyS2 at MMIO 0x40700000 (irq = 13) is a STUART
    io scheduler noop registered
    smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <>
    IRQ1 (GPIO0): rising edges
    eth0: SMC91C11xFD (rev 1) at 0xc4856300 IRQ 1 [nowait]
    eth0: Ethernet addr: 00:80:66:10:28:19
    eth0: PHY LAN83C183 (LAN91C111 Internal)
    Probing VIPER flash device at physical address 0x04000000
    Probing flash at physical address 0x04000000
    flash: Found 1 x16 devices at 0x0 in 16-bit bank
    flash: Found an alias at 0x2000000 for the chip at 0x0
     Intel/Sharp Extended Query Table at 0x0031
    Using buffer write method
    cfi_cmdset_0001: Erase suspend on write enabled
    0: offset=0x0,size=0x20000,blocks=256
    Unlocking VIPER flash device
    VIPER flash unlocked
    cmdlinepart partition parsing not available
    Searching for RedBoot partition table in flash at offset 0x0
    3 RedBoot partitions found on MTD device flash
    Creating 3 MTD partitions on "flash":
    0x00000000-0x0001f000 : "FIS directory"
    0x0001f000-0x00020000 : "RedBoot config"
    0x00020000-0x02000000 : "filesystem"
    i2c /dev entries driver
    NET: Registered protocol family 2
    IP: routing cache hash table of 512 buckets, 4Kbytes
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    NET: Registered protocol family 1
    VFS: Mounted root (jffs2 filesystem) readonly.
    Freeing init memory: 64K
    usbcore: registered new driver usbfs
    usbcore: registered new driver hub
    116x: driver isp116x-hcd, Jun  7 2005
    116x: Found ISP116x Host Controller
    116x: ISP116x Host Controller, irq 25
    isp116x-hcd isp116x-hcd: new USB bus registered, assigned bus number 1
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 2 ports detected
    eth0: link down
    eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
    Linux Kernel Card Services
      options:  [pm]
    IRQ55 (GPIO32): edges
    Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
    ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
    IRQ31 (GPIO8): falling edges
    Probing IDE interface ide0...
    hda: TRANSCEND, CFA DISK drive
    ide0 at 0xc4860000-0xc4860007,0xc486000e on irq 31
    ide-cs: hda: Vcc = 3.3, Vpp = 0.0
    CSLIP: code copyright 1989 Regents of the University of California
    PPP generic driver version 2.4.2
    PPP Deflate Compression module registered
    hda: max request size: 128KiB
    hda: 506016 sectors (259 MB) w/1KiB Cache, CHS=502/16/63
    hda: cache flushes not supported
     hda: hda1
     hda: hda1
     hda: hda1
    Eep. Block 0x00120000 taken from free_list had free_size of 0x0000005c!!
    LVL 22

    Expert Comment

    Looks as if the module required by your card is in fact ide-cs. Unfortunately, the name of this driver has changed. Therefore adding the following command to you modules.conf has a good chance of solving it:

    alias ide-cs ide_cs

    which makes the kernel recognise that ide-cs requires the ide_cs module

    Alternatively, you could add the following line:

    post-install ide_core insmod ide_cs

    Which will forceably install the correct module once the ide_core module is installed.



    Author Comment

    I have tried these two options in the modules.con , but fails to mount for each
    alias ide-cs ide_cs

    alias ide_cs ide-cs

    I can try the other option, but i don't know where i should put

    post-install ide_core insmod ide_cs

    LVL 22

    Expert Comment

    Ooops - wrong way round - Should be:

    alias ide-cs ide_cs

    This makes ide-cs aliased to the real module that exists in the kernel(ide_cs)

    The alternative 'post-install' line can go anywhere after the:
    if KERNEL_VER >= 2.4.21
      alias ide-mod           ide-core
      alias ide-probe-mod     ide-detect


    Author Comment

    What I mean is that I tried putting
    alias ide-cs ide_cs
    in /etc/modules.conf
    and it didn't work
    and then tried the other way around
    alias ide-cs ide_cs
    and didn't work either

    I'll try the post-install option
    LVL 22

    Expert Comment

    NP - Check the output of dmesg once it has started up. This might provide you with additional clues as to what you need. The fundamental start point is that your kernel is working on the new name (ide_cs), where as the cardflash appears to want the old one (ide-cs).


    Author Comment

    OK, i will check dmesg.
    Just to double check that i understood.
    You know the kernel is working on ide_cs because that's what's been shown by lsmod
    However the CF card wants ide-cs because that's what shown by dmesg
    LVL 22

    Accepted Solution

    Yep - that's what it looks like. ide-cs got renamed to ide_cs somewhere in the 2.4 kernel development.

    Basically, we're trying to 'force' the boot process to load ide_cs when a device appears to be asking for ide-cs. (Alternatively, we can forceably 'insmod ide_cs' at some time during the boot process which will also work.

    The current process sticking the mount in the /etc/rc.local works....but doesn't quite have the 'elegance' that I'd like to see. Unfortunately, it's a fact of life with all systems that are reasonably complex, that it is often easier to go for the sightly more botched 'approach'...then again, it's always nice to understand exactly what's happening, in case you encounter the problem again:)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now