1

Recently, the DMA device of our lab is broken and the suspected problem is in the CF card which is in QNX4 format. I want to delete a file named 'calforce.dat' and recreate it by calibrating the device.

I mount the CF card in my device and got this result:

famer@iphyer:~$ sudo mount -t qnx4 /dev/sdb1 /mnt/
[sudo] password for famer: 
mount: warning: /mnt/ seems to be mounted read-only.
famer@iphyer:~$ cd /mnt
famer@iphyer:/mnt$ ls
bin           calfreq.dat  dma           dmasav.dat  fit2.dat      qgui
caldyn.dat    calraw.dat   dma21cfr.dat  dmausr.dat  lib           sbin
calfgen.dat   calres.dat   dmaclamp.dat  etc         license.dat   test_enu.str
calfgres.dat  calrpt.txt   dmaid.dat     exit_case   loader        usr
calforce.dat  devi-ads     dmamfg.dat    fit1.dat    loader_image

I want to delete the 'calforce.dat' file but all commands like writing and deleting have been denied by the read-only system.

Commands like:

famer@iphyer:/mnt$ sudo mount -o remount,rw /dev/sdb1
[sudo] password for famer: 
mount: warning: /mnt seems to be mounted read-only.

do not give any results.

How can I solve it?

Or, alternatively, can I can copy the files out of the CF card to new CF card. Do I need to format a new card before I can use it? Can I simply use something like GPart or fdisk to realize it?

========================================================================== Below is what I followed Gilles' suggestion below is what the kernel log since I insert the CF card.

Dec 15 12:51:13 MG kernel: [ 1477.242018] usb 1-1.1: new high-speed USB device number 3 using ehci-pci
Dec 15 12:51:13 MG kernel: [ 1477.349093] usb 1-1.1: New USB device found, idVendor=0bda, idProduct=0158
Dec 15 12:51:13 MG kernel: [ 1477.349099] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 15 12:51:13 MG kernel: [ 1477.349102] usb 1-1.1: Product: USB2.0-CRW
Dec 15 12:51:13 MG kernel: [ 1477.349105] usb 1-1.1: Manufacturer: Generic
Dec 15 12:51:13 MG kernel: [ 1477.349107] usb 1-1.1: SerialNumber: 20060413092100000
Dec 15 12:51:14 MG kernel: [ 1477.787682] usbcore: registered new interface driver usb-storage
Dec 15 12:51:14 MG kernel: [ 1477.816933] ums-realtek 1-1.1:1.0: USB Mass Storage device detected
Dec 15 12:51:14 MG kernel: [ 1477.818979] scsi6 : usb-storage 1-1.1:1.0
Dec 15 12:51:14 MG kernel: [ 1477.819043] usbcore: registered new interface driver ums-realtek
Dec 15 12:51:15 MG kernel: [ 1478.830020] scsi 6:0:0:0: Direct-Access     Generic- Multi-Card       1.00 PQ: 0 ANSI: 0 CCS
Dec 15 12:51:15 MG kernel: [ 1478.831859] sd 6:0:0:0: Attached scsi generic sg2 type 0
Dec 15 12:51:16 MG kernel: [ 1479.669070] sd 6:0:0:0: [sdb] 264096 512-byte logical blocks: (135 MB/128 MiB)
Dec 15 12:51:16 MG kernel: [ 1479.670566] sd 6:0:0:0: [sdb] Write Protect is off
Dec 15 12:51:16 MG kernel: [ 1479.670572] sd 6:0:0:0: [sdb] Mode Sense: 03 00 00 00
Dec 15 12:51:16 MG kernel: [ 1479.672012] sd 6:0:0:0: [sdb] No Caching mode page found
Dec 15 12:51:16 MG kernel: [ 1479.672016] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Dec 15 12:51:16 MG kernel: [ 1479.678399] sd 6:0:0:0: [sdb] No Caching mode page found
Dec 15 12:51:16 MG kernel: [ 1479.678404] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Dec 15 12:51:16 MG kernel: [ 1479.679767]  sdb: sdb1
Dec 15 12:51:16 MG kernel: [ 1479.683276] sd 6:0:0:0: [sdb] No Caching mode page found
Dec 15 12:51:16 MG kernel: [ 1479.683290] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Dec 15 12:51:16 MG kernel: [ 1479.683292] sd 6:0:0:0: [sdb] Attached SCSI removable disk
Dec 15 12:52:17 MG kernel: [ 1541.078472] QNX4 filesystem 0.2.3 registered.

Does it help?

  • Delete the question on Stack Overflow, otherwise this one will be closed as it against the rules here to cross post. – Anthon Dec 14 '14 at 8:58
  • OK! deleted the question! – sikisis Dec 14 '14 at 9:01
  • I'm unfamiliar with QNX4FS, but I suspect that there's an error in the filesystem, so it's getting mounted read-only to protect the data from (further) corruption. Is it possible that the card got corrupted due to power failure in the middle of a write? You can copy the whole filesystem on the CF card to a normal file on your hard drive using dd, and you can mount that file using the loop device. – PM 2Ring Dec 14 '14 at 12:42
  • The most likely explanation is that the card is read-only. Does it have a read-only switch? If so flip it. There may be clues in the kernel logs (/var/log/kern.log on most distributions), if you need help figuring them out edit your question to post the whole sequence of logs from the time you inserted the CF card. – Gilles Dec 14 '14 at 20:53
  • @Gilles I edited the post! – sikisis Dec 15 '14 at 5:02
2

As of Linux 3.18, the QNX4 filesystem driver only supports reading. (Source: the source). Ditto with QNX6.

There's an alternate driver with partial read-write support, but it's been unmaintained for several years; you'll probably have to run an older kernel or tweak the code to compile it on a recent kernel.

Alternatively, QNX supports reading ext2 filesystems (I'm not sure about ext4), so you could try making a copy of the CF card that's formatted as ext2. This may or may not be supported on your device though.

Alternatively, run QNX in a virtual machine to update the CF card content.

  • 1
    Using a virtual machine to update the card sounds like the best plan. But it's probably a good idea to back up the card's current contents (either using something like rsync or imaging the whole card using dd). – PM 2Ring Dec 15 '14 at 4:18
  • Yes,but to download QNX SDP 6.6.0 runtime ISO for VMware or virtual machine You must register your QNX Software Development Platform 6.6.x serial number. This seems terrible to realize for I have no time and money to get it. – sikisis Dec 15 '14 at 4:48
  • @PM2Ring YEAH.To backup the CF card to another CF card using dd is like this post Copy bootable linux compact flash to SD card But I only have one usb CF card reader? Can I store the data on my home directory and then transfer them to a new CF card? Or this method can not realize the system format of QNX4? – sikisis Dec 15 '14 at 5:14
  • @sikisis: Yes, you can use dd to store the card data as a single file to your hard drive, eg dd if=/dev/sde of=cfimage will save it to a file named cfimage in the current directory. And you can copy that image to a new card using dd of=/dev/sde if=cfimage. Virtual machine programs often use such disk image files to create fake devices. For this stuff, it doesn't matter what the filesystem is on the card, dd is just tranferring raw blocks of bytes. – PM 2Ring Dec 15 '14 at 5:24
  • @sikisis: There are options you could give dd to speed up the copying operation by specifying a larger block size, but the default settings work ok and are probably safest if you're not familiar with dd, especially if the card is corrupt. – PM 2Ring Dec 15 '14 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.