четвъртък, 26 юни 2008 г.

Using Philips GoGear SA4325 with Linux

I just bought new mp3 player Philips SA4325. It is nothing special - features 2Gb internal storage, OLED display and USB 2.0 mass storage protocol for transferring files. I encountered very strange problem - when I mounted the device for the first time everything was just fine - I was able to play the transferred songs. When I tried to do this for second time - the new files I uploaded were missing, and the first ones were broken. After couple of hours of trial and error process I (think) found what is the problem: by default the filesystem on the player is FAT16. It seems the player's firmware is not updating correctly FAT tables on filesystem when it scans for new files at startup. After I format the player and start it, then I run dosfsck, I get the following result:

root@buhtum:/home/svilen# dosfsck -v /dev/sdb1
dosfsck 2.11 (12 Mar 2005)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkdosfs"
Media byte 0xf8 (hard disk)
2048 bytes per logical sector
32768 bytes per cluster
1 reserved sector
First FAT starts at byte 2048 (sector 1)
2 FATs, 16 bit entries
120832 bytes per FAT (= 59 sectors)
Root directory starts at byte 243712 (sector 119)
512 root directory entries
Data area starts at byte 260096 (sector 127)
60076 data clusters (1968570368 bytes)
58 sectors/track, 224 heads
0 hidden sectors
961350 sectors total
FATs differ but appear to be intact. Use which FAT ?
1) Use first FAT
2) Use second FAT


One of the most critical parts of this "filesystem" is the actual file allocation table stored in a special place on the disk. Usually there are 2 copies of the information for higher reliability. It seems the player's firmware is not updating one of them. I solved the problem by formating the player with just one FAT table:

mkdosfs -S 2048 -F 16 -f 1 -v -n PHILIPS /dev/sdb1

Now I was able to mount few times the player, copy new files without worrying that they will disappear. The dosfsck is much more optimistic:

root@buhtum:/home/svilen# dosfsck -v /dev/sdb1
dosfsck 2.11 (12 Mar 2005)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkdosfs"
Media byte 0xf8 (hard disk)
2048 bytes per logical sector
32768 bytes per cluster
1 reserved sector
First FAT starts at byte 2048 (sector 1)
1 FATs, 16 bit entries
120832 bytes per FAT (= 59 sectors)
Root directory starts at byte 122880 (sector 60)
512 root directory entries
Data area starts at byte 139264 (sector 68)
60080 data clusters (1968701440 bytes)
58 sectors/track, 224 heads
0 hidden sectors
961350 sectors total
Checking for unused clusters.
/dev/sdb1: 9 files, 781/60080 clusters

Probably this trick will work on other players from SA43xx series.

Няма коментари: