Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filesystem links on a FAT32 formatted storage

I know FAT32, as well as FAT16/12 neither support symbolic links nor hard-links. However I came up with this idea:

The FAT specification describes that every file is associated with a directory-entry. In my understanding, one could say that a file-entry in a directory somehow or other points to the file's content.

So, how can I define two directory-entries which point to the same file-content? Or, what could prevent me from doing so?

Use case: I have a USB mass storage device for my car radio, and I want to use directories as playlists since the radio software doesn't support playlists. So it isn't important to me how Windows behaves when doing this.

like image 272
fishbone Avatar asked Dec 28 '10 11:12

fishbone


People also ask

Does FAT32 support symbolic links?

Bookmark this question. Show activity on this post. I know FAT32, as well as FAT16/12 neither support symbolic links nor hard-links.

What is the FAT32 file system?

FAT32 is a disk format or filing system used to organise the files stored on a disk drive. The disk drive is marked up into addressable chunks called sectors and a “File Allocation Table” or FAT is created at the start of the drive so that each piece of information in the file can be found by the host computer.

What file systems support symbolic links?

Symbolic links are supported by POSIX and by most Unix-like operating systems, such as FreeBSD, Linux, and macOS. Limited support also exists in Windows 7 and Windows Vista, and to some degree in Windows 2000 and Windows XP in the form of shortcut files.

What is FAT32 file system in Linux?

The FAT32 filesystem stands for File Allocation Table and it was developed following on from previous filesystems such as FAT16 and FAT12. Even if FAT is not the default filesystem on most modern computers, it is still widely used on floppy disks and on USB drives.


2 Answers

This should work for simple issues. I.e. it works as a hack / workaround and I don't know what happens if you rename / move / remove files. So, you should not do this on your main hdd.

I edited the directory-entries manually using a hex editor. I modified clusters as well as file-sizes and successfully faked hardlinks. My car-radio and even Windows (7, 64Bit) have no problems with playing back the original and "hard-linked" mp3-Files I used.

When I'm opening the device again in the hex-editor none of my modifications are changed back (See chkdsk issue in answer #1 - but as far as I know chkdsk has to be started manually, anyways.

like image 54
fishbone Avatar answered Sep 17 '22 15:09

fishbone


What you are talking about ("two directory-entries which are pointing to the same file-content") are hard links. chkdsk will report them as cross-links and break them, "repairing" the files (in fact making the copies).

like image 38
Eugene Mayevski 'Callback Avatar answered Sep 16 '22 15:09

Eugene Mayevski 'Callback