Hot answers tagged

19

a partial solution dd if=/dev/zero count=100 bs=1k of=fs.fat mkfs -t vfat fs.fat mount fs.fat /mnt ## as root # cp some file umount /mnt ## as root cp fs.fat fs.ref vi fs.ref ## change some bytes cp fs.ref fs.sampleX now you have a good fs (fs.fat) and a corrupted one (fs.ref) sudo mount -t vfat fs.ref /mnt mount: wrong fs type, bad option, bad ...


17

Dosfstools, which provides mkfs.vfat and friends, also provides dosfslabel to change the label.


12

The behaviour you're seeing is implemented in archives.c in the dpkg source, line 1030 (for version 1.18.1): debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup"); if (link(fnamevb.buf,fnametmpvb.buf)) ohshite(_("unable to make backup link of '%.255s' before installing new version"), ti->name); It seems to me that you could ...


9

I suspect you are using a mount command like the one below: mount -t msdos /dev/XYZ /mnt/test This will force the partition to be mounted in legacy DOS FAT filesystem which uses the 8.3 filename convention (See https://en.wikipedia.org/wiki/8.3_filename) instead of vfat which uses Long filenames (https://en.wikipedia.org/wiki/Long_filename). ...


6

It is probably the file-system on the usb-storage. FAT file system can only support file-names of 8+3 characters. This file-system is very old. It is only needed for backwards compatibility with very old systems. FAT also only support upper-case characters. As this is only one case, there is an option to map this to lower-case. This makes thing more ...


6

OK, I tried it. First two problems from the beginning: NO support for hard and symbolic links. It means that I had to copy each file, duplicating it and wasting space. Second problem: no special file support at all. This means things like /dev/console are unavailable at boot time to init before even /dev is remounted as tmpfs. Third problem: you will ...


5

My C is rough but it looks like the dirty bit is set when the superblock is read here. The commit explains why it was implemented the way it was. Windows may choose to not set the bit until after something is changed in the FS where linux takes a bit more paranoid approach of setting it upon mount. To me it seems like it's more efficient this way, to ...


5

You need to set codepage and charset in kernel options: make menuconfig -> File systems: -> Native language support: <*> Codepage 437 (United States, Canada) <*> NLS ISO 8859-1 (Latin 1; Western European Languages) -> DOS/FAT/NT Filesystems (437) Default codepage for FAT (iso8859-1) Default iocharset for FAT and then recompile ...


5

It seems that you do not have the "codepage cp437" support in the kernel. Try to Look inside your /proc/config.gz file and search for a line like CONFIG_NLS_CODEPAGE_437=m or CONFIG_NLS_CODEPAGE_437=y. If you do not find it, you'll have to recompile the kernel to add the needed module.


5

First thing that comes to mind is to mv the file(s) to a temporary, cp the temporary file to the old filename and delete the temporary. I just made a fast check: touch foo ls -l foo returns: 0 -rw-r--r-- 1 shunz shunz 0 2011-03-22 11:07 foo wait some minutes and then: mv foo bar ls -l bar 0 -rw-r--r-- 1 shunz shunz 0 2011-03-22 11:07 bar notice ...


4

ext3 stores the last mount time and can be retrieved with: dumpe2fs -h /dev/node I'm not sure that FAT stores this information.


3

This worked for me: # truncate -s 8G foobar # losetup -f --show foobar /dev/loop0 # mkdosfs -F 32 /dev/loop0 $((2*1024*1024)) mkfs.fat 3.0.25 (2014-01-17) Warning: block count mismatch: found 8388608 but assuming 2097152. Loop device does not match a floppy size, using default hd params # mount /dev/loop0 /mnt/tmp # df -h /mnt/tmp Filesystem Size Used ...


3

Try sudo mlabel -i <device> ::<label>, for example sudo mlabel -i /dev/sdb1 ::new_label. Reference: RenameUSBDrive on the Ubuntu community documentation.


3

I finally ended up using fatsort, which does the job nicely, and it's also a lot quicker than copying the files over and over.


3

You probably want to add a line like /dev/sdb1 /media/drive1 vfat dmask=000,fmask=0111,user 0 0 to /etc/fstab. The additional ,user in the options field allows any user to mount this filesystem, not just root.


3

You can check whether a file is fragmented or not using the filefrag utility. That way you could filter out the files that aren't fragmented, and do the copy/copy back only for already fragmented files. That should save you some time. However be aware that there is no guarantee the new file layout will be better than the old one. The best way is to ignore ...


3

I'm pretty sure the only reserved bytes are 0 (ASCII Nul) and 0x2f (ASCII '/', forward slash). You can easily make a file with '.', '\' and other funky things in it. Think "unicode file names", which contain all kinds of weird byte values. Naturally, you can't have duplicate file names in the same directory, so files named "." and ".." can't usually be ...


2

Rsync with --iconv would be an option, but you'd first need to define an encoding where ?, : and others are encoded with characters that are allowed on FAT filesystems. For your use case, you aren't using all the power of rsync for this. This task can be done in a few lines of shell script. Here's a bash script that copies ~/Music to /media/usb99, skipping ...


2

If it is for backup purposes, just stash away a tarball. No filename hassles that way.


2

Have a look at the ubuntu page about renaming usb drives, it's basically: mlabel -i <device> ::<label>


2

FAT16 can hold a very limited number of files on the root directory. My guess is that you are hitting that. Create a directory and put files in it.


2

On a filesystem that supports normal Unix file attributes, each file has a user who is designated as owner. Only the owner of a file may change its timestamps with utime. Other users aren't allowed to change timestamps, even if they have write permission. FAT filesystems don't record anything like an owner. The FAT filesystem driver pretends that a ...


2

You are confusing the rw option with the umask. The rw option merely dictates that the partition is not mounted read-only. The umask option dictates what permission that not set on files and directories. Your current umask of 022 sets the permission bits to 755 which translates to rwxr-xr-x. Change the umask to 000, which should give you 777 or rwxrwxrwx ...


1

You don't mention unmounting before ejecting the card. If that isn't an omission when writing the question, there's your problem. Writing to any kind of disk is buffered: the operating system accumulates data to write in memory, then writes it to the disk when it judges it to be convenient. The data isn't necessarily written to the disk in the same order ...


1

Point three and four don't make sense: /dev/sdb1 /media/usb1 vfat defaults 0 0 is ok, but is mounted with mount /dev/sdb1 or /media/usb1 /dev/sdb1 /media/usb1 msdos auto does not make sense, because "msdos" and "auto" are both for the filesystem type. You could try /dev/sdb1 /media/usb1 auto defaults 0 0 here. "noauto" in the options (here the "defaults" ...


1

FAT has a "hidden" flag, which works under windows unless you poke through the folder settings to show hidden files (which I tend to do as a 'standard thing' on new windows computers :P). I dont know if UNIX FAT or Mac OS would support that flag, unix standard is to prefix hidden stuff with a dot, mac I have no clue (or care) about but probably works the ...


1

If I'm not mistaken any filesystem supported by Windows (FAT/VFAT/FAT32/NTFS) should meet some standard naming conventions for valid file and directory names. The aforementioned list of characters are reserved characters which can't be used even with Unicode characters. I would say that Linux implementation of fat/vfat filesystems tries to be compliant ...


1

There are no inodes on most non-Unix file systems (like vfat). It's normal that none are shown. For the rest of the problem we need more info. Edit 1: From the du output we now know that there are 1999360-1142944=856416 blocks missing. With Linux file systems such differences can occur if an open file is deleted. You do not see it in the file system any ...


1

The solution is to use mkdosfs (mkfs.vfat) : it lets the user specify the volume label using the -n flag, and lowercase letters are kept lowercase, but this tool recreates the filesystem, so all data will be lost. The non-destructive solution below is a combination of the mlabel and dosfslabel command-line tools. Connect the device to the computer if ...


1

So far the only way I found to change FAT volume name whit lower cases is to edit it whit a hex-editor (copy the first few sectors whit dd to a temp file, edit it and copy it back). It works well so far (even whit FAT16) and neither fsck nor CHKDSK from Win7 complained. But no guarantee of course ;-)



Only top voted, non community-wiki answers of a minimum length are eligible