Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
3
answers
207
views
How to find the filesystem type of an USB key to mount it correctly?
I have to mount a old USB key formatted with FAT filesystem. The mount must be executed automatically by a `udev` rule which executes a bash script. When the USB key is inserted in the USB port, the script, for now, executes the command: ``` blkid -o udev /dev/sda1 ``` where `/dev/sda1` is the parti...
I have to mount a old USB key formatted with FAT filesystem. The mount must be executed automatically by a
udev
rule which executes a bash script.
When the USB key is inserted in the USB port, the script, for now, executes the command:
blkid -o udev /dev/sda1
where /dev/sda1
is the partition present inside the USB and formatted with FAT32 (or FAT16) filesystem.
The output of the previous command for the USB key **is empty**.
The output of the same command (blkid
) for other USB keys contains the udev
variable ID_FS_TYPE
; possible values of ID_FS_TYPE
are: vfat
, ntfs
, exfat
.
So an empty output for the execution of blkid
happens only for this old USB and I'm not able to know why it happens only for it.
### Different options for mount
command if the filesystem is vfat
###
If the value of the variable ID_FS_TYPE
is vfat
the script must execute the following mount
command:
> mount -o rw,relatime,users,gid=100,umask=000,shortname=mixed,utf8=1,flush /dev/sda1 /mount/point
While if the filesystem is not vfat
the options for the mount
command can be the following:
mount -o rw,relatime /dev/sda1 /mount/point
With the particular USB key (1 GB and very old) the script by the command blkid
, can't determine that the filesystem type is vfat
so it executes the second mount
command; the result is that the permissions for the mount point directory (called /media/sda1
) are:
> ls -l /media/
total 16
drwxr-xr-x 3 root root 16384 Jan 1 1970 sda1
while I need:
# ls -l /media/
total 16
drwxrwxrwx 3 root root 16384 Jan 1 1970 sda1
I need those permissions because **all users must be able to write on the USB** and not only the proprietary (that is root
in my context).
### Find file system type by other commands ###
[This link](https://unix.stackexchange.com/questions/53313/how-to-show-the-filesystem-type-via-the-terminal) gives other tips to get the filesystem type of this particular USB key. So I have tried other commands:
- lsblk -n -o FSTYPE /dev/sda1
: also in this case, for my specific USB key, the output of the command is empty
- the output of the command file -sL /dev/sda1
instead is very long; I show this output below:
> file -sL /dev/sda1
/dev/sda1: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "MSDOS5.0", sectors/cluster 32, reserved sectors 8, root entries 512, Media descriptor 0xf8, sectors/FAT 240, sectors/track 63, heads 255, hidden sectors 2048, sectors 1966080 (volumes > 32 MB), reserved 0x1, serial number 0xa4906b9d, unlabeled, FAT (16 bit)
In this output it is present the info FAT (16 bit)
, but it is not clear that the filesystem of the partition of the USB key is formatted vfat
. If I execute the previous file -sL
command on a USB key formatted by NTFS filesystem the output of the command is:
> file -sL /dev/sda
/dev/sda: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS ", sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255, dos < 4.0 BootSector (0x0), FAT (1Y bit by descriptor); NTFS, sectors/track 63, physical drive 0x80, sectors 15654911, $MFT start cluster 786432, $MFTMirror start cluster 2, bytes/RecordSegment 2^(-1*246), clusters/index block 1, serial number 030fcd5a9fcd56a1c; contains bootstrap BOOTMGR
In this output is present the string NTFS
, but is present also the string FAT
, so with this output it is not easy to establish that the filesystem is vfat
and not ntfs
.
### The question ###
Is there a command other than the previous ones that can provide the filesystem of an USB key before mounting it?
User051209
(498 rep)
Apr 22, 2025, 01:27 PM
• Last activity: Apr 29, 2025, 12:22 PM
3
votes
3
answers
879
views
How to determine, with certainty, the filesystem type of a partition from the outputs of the Linux "file -s" command?
My problem is to *decode* the output of the command `file -s /dev/sdX` on my system (where `/dev/sdX` is the device file associated to a USB key). Below I'll show the output of the command `file -s /dev/sdX` where the device file `/dev/sda1` is a partition formatted with a `FAT32` filesystem, while...
My problem is to *decode* the output of the command
file -s /dev/sdX
on my system (where /dev/sdX
is the device file associated to a USB key).
Below I'll show the output of the command file -s /dev/sdX
where the device file /dev/sda1
is a partition formatted with a FAT32
filesystem, while the device /dev/sdb
is a partition formatted with a NTFS
filesystem.
### Output of file
command for a FAT32
filesystem ###
In the case of the FAT32
filesystem the output of the file
command is:
> file -s /dev/sda1
/dev/sda1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors/cluster 8, Media descriptor 0xf8, sectors/track 62, heads 31, hidden sectors 2048, sectors 1966080 (volumes > 32 MB), FAT (32 bit), sectors/FAT 1920, reserved 0x1, serial number 0x4ba3ff5b, unlabeled
In the output is present the information , FAT (32 bit), sectors/FAT 1920,
which could be enough to say that the filesystem type is FAT32, but in the next paragraph I'll show that the string FAT
is also present in the output of the file
command in the case of an NTFS
filesystem.
### Output of file
command for a NTFS
filesystem ###
In the case of a NTFS
filesystem the output of the file
command is:
> file -s /dev/sdb
/dev/sdb: DOS/MBR boot sector, code offset 0x52+2, OEM-ID "NTFS ", sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255, dos file -s /dev/sdf
/dev/sdf: DOS/MBR boot sector
In this case exfat
is not present in the output.
### Output of file
for ext4
###
file -s /dev/sdb1
/dev/sdb1: Linux rev 1.0 ext4 filesystem data, UUID=38bc3d5b-381e-4f19-8640-c77d9483882b (needs journal recovery) (extents) (64bit) (large files) (huge files)
In this case is present the info ext4 filesystem data,
.
In these 4 examples (FAT32, NTFS, EXFAT, EXT4) the output of the file
command appears very different for different filesystem types, so it is difficult to find a simple rule to decide the filesystem type by this output.
___
**EDIT**
To clarify why I'm trying to use the file
command *to get information about the filesystem type of a USB*, please read [this post](https://unix.stackexchange.com/questions/794029/how-to-find-the-filesystem-type-of-the-partition-of-an-usb-before-mount-it) .
User051209
(498 rep)
Apr 22, 2025, 04:00 PM
• Last activity: Apr 24, 2025, 03:24 PM
1
votes
1
answers
195
views
/etc/fstab mounting with auto buffer flushing
My `/etc/fstab` line for the SD I'm willing to mount looks like: ``` /dev/mmcblk1 /media/sd_card vfat user,rw,umask=000,sync 0 2 ``` With this line I'm able to mount the SD, but everytime I want to unplug the SD I have to execute `blockdev --flushbufs /dev/mmcblk1` if I want to make the written chan...
My
/etc/fstab
line for the SD I'm willing to mount looks like:
/dev/mmcblk1 /media/sd_card vfat user,rw,umask=000,sync 0 2
With this line I'm able to mount the SD, but everytime I want to unplug the SD I have to execute blockdev --flushbufs /dev/mmcblk1
if I want to make the written changes take effect.
What means, that if I dont execute the blockdev
-command all the written changes are lost after unplugging the SD.
The weird thing is, that I all the time I was using this line, I thought everything is working fine...
So what am I doing wrong?
----------
I'm working on the jetson tx2 with Ubuntu 16.04 running on it.
JulianW
(143 rep)
Aug 22, 2019, 11:08 AM
• Last activity: Oct 19, 2024, 09:55 AM
2
votes
2
answers
284
views
Create FAT-formatted disk image that can fit 1G file
I'm struggling to create a FAT-formatted a disk image that can store a file of known size. In this case, a 1 GiB file. For example: ```bash # Create a file that's 1 GiB in size. dd if=/dev/zero iflag=count_bytes of=./large-file bs=1M count=1G # Measure file size in KiB. LARGE_FILE_SIZE_KIB="$(du --s...
I'm struggling to create a FAT-formatted a disk image that can store a file of known size. In this case, a 1 GiB file.
For example:
# Create a file that's 1 GiB in size.
dd if=/dev/zero iflag=count_bytes of=./large-file bs=1M count=1G
# Measure file size in KiB.
LARGE_FILE_SIZE_KIB="$(du --summarize --block-size=1024 large-file | cut --fields 1)"
# Create a FAT-formatted disk image.
mkfs.vfat -vv -C ./disk.img "${LARGE_FILE_SIZE_KIB}"
# Mount disk image using a loopback device.
mount -o loop ./disk.img /mnt
# Copy the large file to the disk image.
cp --archive ./large-file /mnt
The script fails with the following output:
++ dd if=/dev/zero iflag=count_bytes of=./large-file bs=1M count=1G
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 39.6962 s, 27.0 MB/s
+++ du --summarize --block-size=1024 large-file
+++ cut --fields 1
++ LARGE_FILE_SIZE_KIB=1048580
++ mkfs.vfat -vv -C ./disk.img 1048580
mkfs.fat 4.2 (2021-01-31)
Auto-selecting FAT32 for large filesystem
Boot jump code is eb 58
Using 32 reserved sectors
Trying with 8 sectors/cluster:
Trying FAT32: #clu=261627, fatlen=2048, maxclu=262144, limit=65525/268435446
Using sector 6 as backup boot sector (0 = none)
./disk.img has 64 heads and 63 sectors per track,
hidden sectors 0x0000;
logical sector size is 512,
using 0xf8 media descriptor, with 2097144 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 2048 sectors, and provides 261627 clusters.
There are 32 reserved sectors.
Volume ID is f0de10c3, no volume label.
++ mount -o loop ./disk.img /mnt
++ cp --archive ./large-file /mnt
cp: error writing '/mnt/large-file': No space left on device
How do I create a FAT-formatted disk image that's large enough store a file of known size?
Resources:
- https://linux.die.net/man/1/dd
- https://linux.die.net/man/8/mkfs.vfat
- https://linux.die.net/man/8/mount
- https://linux.die.net/man/1/cp
- https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system#Size_limits
#### EDIT 1
My assumption was that mkfs.vfat -C ./disk.img N
would create an image that has N
KiBs of usable space, but I guess that's not the case.
#### EDIT 2
It seems like a dead end to try to calculate exactly how big the disk image needs to be to store a file of known size because of the complexities around FAT sector/cluster size limits.
As suggested in the answers, I've settled for adding 20% extra space to the disk image to allow for FAT overhead.
jdeanwallace
(123 rep)
Apr 26, 2024, 12:42 PM
• Last activity: Apr 30, 2024, 01:35 PM
0
votes
1
answers
106
views
dpkg -i my-kernel_5.10.9-2lEIW6BD_arm64.deb fails with "unable to make backup link of './boot/Image' before installing new version: Operation not..."
I've made my own kernel package for a custom iMX8M board, which passes lintian without warnings or errors. The top three layers of the package tree are: ``` /tmp/my-kernel_5.10.9-2lEIW6BD_arm64 |-- DEBIAN | |-- control | `-- preinst |-- boot | |-- Image | `-- dtbs | `-- imx8mq-smarc.dtb |-- lib | `-...
I've made my own kernel package for a custom iMX8M board, which passes lintian without warnings or errors.
The top three layers of the package tree are:
/tmp/my-kernel_5.10.9-2lEIW6BD_arm64
|-- DEBIAN
| |-- control
| `-- preinst
|-- boot
| |-- Image
| `-- dtbs
| `-- imx8mq-smarc.dtb
|-- lib
| `-- modules
`-- usr
`-- share
`-- doc
preinst makes sure that /boot is mounted:
fadedbee@box ~ $ sudo cat /tmp/my-kernel_5.10.9-2lEIW6BD_arm64/DEBIAN/preinst
#!/bin/bash
set -e
if grep -qs '/dev/mmcblk1p1 /boot' /proc/mounts; then
echo "/boot is mounted."
else
echo "/boot is not yet mounted, mounting..."
mount /dev/mmcblk1p1 /boot
fi
exit 0
It mounts /boot, if not already mounted and relies on the dpkg to put all of the files in place.
It currently fails.
root@arm:~# dpkg -i /tmp/my-kernel_5.10.9-2lEIW6BD_arm64.deb
(Reading database ... 45956 files and directories currently installed.)
Preparing to unpack .../my-kernel_5.10.9-2lEIW6BD_arm64.deb ...
/boot is not yet mounted, mounting...
Unpacking my-kernel (5.10.9) ...
dpkg: error processing archive /tmp/my-kernel_5.10.9-2lEIW6BD_arm64.deb (--install):
unable to make backup link of './boot/Image' before installing new version: Operation not permitted
Errors were encountered while processing:
/tmp/my-kernel_5.10.9-2lEIW6BD_arm64.deb
The permissions on /boot/Image are as expected:
root@arm:~# ls -lsa /boot/Image
28680 -rwxr-xr-x 1 root root 29366784 Mar 25 11:48 /boot/Image
The /boot partition is vfat and mounted R/W:
root@arm:~# mount | grep boot
/dev/mmcblk1p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
Why might this operation be failing?
Is there a work-around?
---
Update: I've checked what's inside a "normal" debian kernel package. It also relies on normal behaviour to install the kernel image in /boot.
root@debian:/tmp/tmp# tree -L 3
.
├── boot
│ ├── config-6.1.0-18-amd64
│ ├── System.map-6.1.0-18-amd64
│ └── vmlinuz-6.1.0-18-amd64
├── lib
│ └── modules
│ └── 6.1.0-18-amd64
└── usr
└── share
├── bug
├── doc
└── lintian
10 directories, 3 files
fadedbee
(1113 rep)
Mar 26, 2024, 11:19 AM
• Last activity: Mar 27, 2024, 09:15 AM
7
votes
3
answers
15635
views
rsync to USB flash drive always transferring all data
When `rsync`ing a directory to a freshly plugged-in external USB flash drive, via rsync -av /source/ /dest/ all files get transferred (i.e. rewritten) despite no changes in the files. Note that overwriting the files only takes place once the USB is un- and replugged. Doing the `rsync` command twice...
When
rsync
ing a directory to a freshly plugged-in external USB flash drive, via
rsync -av /source/ /dest/
all files get transferred (i.e. rewritten) despite no changes in the files.
Note that overwriting the files only takes place once the USB is un- and replugged. Doing the rsync
command twice in a row without unplugging the drive in-between does successfully skip the whole directory contents.
Including the -u
update option and explicitly adding the -t
option did not change anything.
The mount point remains the same (i.e. /media/user/
, the drive is automouted by xfce
, the /dev/sdxy
obviously changes)
The hard drive source is ext4
, while the USB is vfat
with utf8
character encoding.
What could be the reason for this behaviour is it the change in the /dev/
name entry? How can I make rsync
run with properly recognizing file changes? My backup should just take seconds without this, while it now is always minutes due to the large amount of data being overwritten repeatedly, nor is the massive writing the best for the flash drive's life time expectancy.
FelixJN
(14014 rep)
Mar 2, 2016, 11:00 PM
• Last activity: Mar 10, 2024, 05:38 PM
0
votes
0
answers
79
views
mkfs.vfat -- No such file or directory
I'm on Debian Bookworm. I am trying to format my USB drive to FAT32 filesystem. ``` ~$ lsblk -f NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS sdb └─sdb1 ntfs SONY 2DE23E532C9D2CAC ``` When I tried `mkfs` I get the following error: ``` sudo mkfs -t vfat /dev/sdb1 [sudo] password for vrgovin...
I'm on Debian Bookworm.
I am trying to format my USB drive to FAT32 filesystem.
~$ lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sdb
└─sdb1
ntfs SONY 2DE23E532C9D2CAC
When I tried mkfs
I get the following error:
sudo mkfs -t vfat /dev/sdb1
[sudo] password for vrgovinda:
mkfs: failed to execute mkfs.vfat: No such file or directory
I have the following installed:
exfatprogs
udisks2
Is there anything I am doing wrong?
Please help.
Thanks in advance.
vrgovinda
(349 rep)
Aug 21, 2023, 02:18 AM
• Last activity: Aug 21, 2023, 09:36 AM
40
votes
5
answers
92608
views
exFAT vs NTFS on Linux
Situation: I need a filesystem on thumbdrives that can be used across Windows and Linux. Problem: By default, the common FS between Windows and Linux are just exFAT and NTFS (at least in the more updated kernels) Question: In terms of performance on Linux (since my base OS is Linux), which is a bett...
Situation: I need a filesystem on thumbdrives that can be used across Windows and Linux.
Problem: By default, the common FS between Windows and Linux are just exFAT and NTFS (at least in the more updated kernels)
Question: In terms of performance on Linux (since my base OS is Linux), which is a better FS?
Additional information: If there are other filesystems that you think is better and satisfies the situation, I am open to hearing it.
EDIT 14/4/2020: ExFAT is being integrated into the Linux kernel and may provide better performance in comparison to NTFS (which I have learnt since that the packages that read-write to NTFS partitions are not the fastest [granted, it is a great interface]). Bottom line is still -- if you need the journal to prevent simple corruptions, go NTFS.
EDIT 18/9/2021: NTFS is now being integrated into the Linux kernel (soon), and perhaps this will mean that NTFS performance will be much faster due to the lesser overhead than when it was a userland module.
EDIT 15/6/2022: The NTFS3 kernel driver is officially part of the Linux Kernel as of version 5.15 (Released November 2021). Will do some testing and update this question with results.
Timothy Wong
(601 rep)
Apr 4, 2017, 06:37 AM
• Last activity: Feb 22, 2023, 10:23 AM
5
votes
2
answers
967
views
Can I install GNU/Linux on a FAT drive?
Out of curiosity, is this possible nowadays? I remember some old Slackware versions did support FAT root partition but I am not sure if this is possible with modern kernels and if there are any distros offering such an option. I am interested in pure DOS FAT (without long names support), VFAT 16/32...
Out of curiosity, is this possible nowadays? I remember some old Slackware versions did support FAT root partition but I am not sure if this is possible with modern kernels and if there are any distros offering such an option. I am interested in pure DOS FAT (without long names support), VFAT 16/32 and exFAT.
PS: Don't tell me I shouldn't, I am not going to use this in production unless necessary :-)
Ivan
(18358 rep)
Dec 8, 2015, 07:13 PM
• Last activity: Sep 3, 2022, 08:22 AM
1
votes
2
answers
2495
views
Mount an USB key drive VFAT file system as user, or at least having writing rights on its contents
I'm trying to mount a `VFAT` file system placed on a USB key drive, so that I can manipulate the drive contents. 12:10 boffi@debian:~ $ lsblk | grep sdc sdc 8:32 1 7.5G 0 disk └─sdc1 8:33 1 7.5G 0 part 12:10 boffi@debian:~ $ grep sdc /etc/fstab /dev/sdc /home/boffi/key vfat noauto,rw,user 0 0 /dev/s...
I'm trying to mount a
VFAT
file system placed on a USB key drive, so that I can manipulate the drive contents.
12:10 boffi@debian:~ $ lsblk | grep sdc
sdc 8:32 1 7.5G 0 disk
└─sdc1 8:33 1 7.5G 0 part
12:10 boffi@debian:~ $ grep sdc /etc/fstab
/dev/sdc /home/boffi/key vfat noauto,rw,user 0 0
/dev/sdc1 /home/boffi/key vfat noauto,rw,user 0 0
12:11 boffi@debian:~ $ mount /dev/sdc1 /home/boffi/key
mount: /home/boffi/key: must be superuser to use mount.
dmesg(1) may have more information after failed mount system call.
12:11 boffi@debian:~ $
If I use sudo
everything is fine, except I have no writing rights on the contents...
12:17 boffi@debian:~ $ sudo mount /dev/sdc1 /home/boffi/key
[sudo] password for boffi: ***************
12:17 boffi@debian:~ $ ls -l key | head -3
total 27600
drwxr-xr-x 6 root root 16384 Oct 6 2013 00_roba_dal_mac/
drwxr-xr-x 4 root root 16384 Oct 12 2013 00_shenker/
12:17 boffi@debian:~ $
Of course I'm doing something wrong, could you please help me?
gboffi
(1376 rep)
Aug 17, 2022, 10:23 AM
• Last activity: Aug 18, 2022, 03:39 PM
19
votes
2
answers
59509
views
What is a vfat signature?
Recently, I have noticed that I cannot access my USB flash drive filesystem (it was of FAT type, as far as I can remember). Fedora did not mount it automatically and `lsblk` could not see the partition. So, I decided to create new partition (instead of wiping the device at first) with `fdisk`. The p...
Recently, I have noticed that I cannot access my USB flash drive filesystem (it was of FAT type, as far as I can remember). Fedora did not mount it automatically and
lsblk
could not see the partition. So, I decided to create new partition (instead of wiping the device at first) with fdisk
.
The process was straightforward (fdisk
did not complain a bit), but I noticed that fdisk
asks me as a last step about removing a thing called "vfat signature":
Created a new partition 1 of type 'Linux' and of size 7.3 GiB.
Partition #1 contains a vfat signature.
Do you want to remove the signature? [Y]es/[N]o:
I am aware that happily creating new partition in such a case may not be the best thing. I do not know yet, what I would like to/should do. However, nonetheless, primarily I am curious, so I would like to know:
1. **What is a "vfat signature"?**
2. **What is the reason that fdisk
detects it?**
3. **What is the purpose that fdisk
detects it?**
4. **Is it somehow related to a term that I have encountered in the context of Windows, "disk signature"?**
5. **Why would I like to remove it or not?**
I have searched for a similar question here, but found only [this question](https://unix.stackexchange.com/questions/395950/fdisk-partition-contains-a-ntfs-signature-remove-it) which does not answer my doubts.
Silv
(355 rep)
Oct 26, 2018, 03:37 PM
• Last activity: Aug 2, 2022, 08:32 PM
1
votes
0
answers
642
views
How to debug why uid,gid,umask,fmask and dmask mount options are ignored?
I am running a Live ISO of Kubuntu 22.04 LTS (AKA Jammy Jellyfish). What I am trying to do has most likely nothing to do with KDE, so one may assume I am running Ubuntu. I am trying to mount a `FAT32` partition in read-write mode for current user. On this Live ISO the user is called `kubuntu` (it is...
I am running a Live ISO of Kubuntu 22.04 LTS (AKA Jammy Jellyfish). What I am trying to do has most likely nothing to do with KDE, so one may assume I am running Ubuntu.
I am trying to mount a
FAT32
partition in read-write mode for current user. On this Live ISO the user is called kubuntu
(it is ubuntu
in case of Ubuntu). There is also a root
which always has all permissions, obviously. But I want to make it work for a regular user.
Lets assume I have the partition device path in shell variable P
and mount point path in MP
. I tried to execute such command
sudo mount $P $MP
Then when I call
mount | grep $MP
I can see such mount type and options applied (please note fmask
and dmask
options values):
type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
When I call stat $MP | grep Uid:
I get this:
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
It completely matches to what one would expect when doing mount as root
when options with values like fmask=0022,dmask=0022
have been applied.
I tried to find an information about how to make mounted FS work for a regular user. All the recommendations are about uid
,gid
,umask
,fmask
, dmask
and how to use those. While I am pretty happy with fmask=0022,dmask=0022
I also decided to try to reset those as well. So I ended up trying this (added redundancy, just in case):
sudo mount -o uid=$(id -u),gid=$(id -g),umask=0000,fmask=0000,dmask=0000 $P $MP
And guess what? The result is exactly the same as I mentioned above. It is
type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
Same thing with stat $MP | grep Uid:
. It returns
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
There are no write permissions for my kubuntu
user.
I checked sudo dmesg | tail -n 2
and cat /var/log/syslog | tail -n 2
. I usually triggering "sysrq: Emergency Sync" by pressing Alt+(SysRq/PrtScr, S)
right before I do something like above (sudo mount ...
). This way I have a "checkpoint" in logs which consist of 2 lines with text fragments sysrq: Emergency Sync
and Emergency Sync complete
. So as usual I triggered "sysrq: Emergency Sync" and then called sudo mount ...
. After checking both logs all I saw was just those 2 lines related to "sysrq: Emergency Sync". There is nothing related to mount
command which would shed some light on why it ignored mount options.
So here are the questions:
- Why the mount options I provided were ignored?
- How to troubleshoot this kind of mount
behavior?
Victor Yarema
(148 rep)
Jul 20, 2022, 12:27 PM
• Last activity: Jul 20, 2022, 12:33 PM
0
votes
1
answers
108
views
Using allow_utime with exfat
Considering the fact that exfat does not store ownership information of files, is it possible to mount an exfat partition in Linux with an allow_utime option that is also available for vfat? If not, is there a way to allow any process to use utime on any file in the filesystem? I found an answer to...
Considering the fact that exfat does not store ownership information of files, is it possible to mount an exfat partition in Linux with an allow_utime option that is also available for vfat? If not, is there a way to allow any process to use utime on any file in the filesystem?
I found an answer to this here , but this only applies to vfat. For the same reasons (no ownership information) it should theoretically also work with exfat, but I couldn't find any more information about it, and it didn't seem to work.
For Context: I have an ARM based laptop (Pinebook Pro) that has 64GB of internal memory and expandable storage via SD card. I would like to use Dropbox with it, but because this is an ARM laptop, I have to use alternative clients like Maestral . The internal storage is too small, so I opted to have it work with my 128GB SD card. I would also like to make the SD card portable and work with >4GB files, so I formatted it with exfat which should now have first class support in the kernel and avoids permission issues. Maestral needs to be able to use the utime() command to modify the access times of each file as it syncs with Dropbox, but it throws errors when I do it in the exfat filesystem, because it does not have permission. So this question is really trying to find a solution to that.
9a3eedi
(183 rep)
Apr 6, 2022, 03:09 PM
• Last activity: Apr 8, 2022, 08:04 PM
1
votes
1
answers
429
views
rsync from external vfat disk to local ext4 yields VASTLY different sizes
I found an older external hd I want to reuse for something else. I was doing an rsync of it to a NAS I run over the network but it was taking ages. So I decided to rsync to my local drive first (SSD) and do the final backup to NAS later. I ran `rsync -avvz --progress /media/ubuntu/9AB4-7DB9/ubuntu/...
I found an older external hd I want to reuse for something else. I was doing an rsync of it to a NAS I run over the network but it was taking ages.
So I decided to rsync to my local drive first (SSD) and do the final backup to NAS later.
I ran
rsync -avvz --progress /media/ubuntu/9AB4-7DB9/ubuntu/ bak
.
This seems to have terminated fine.
But when I compare the two dirs for their sizes, they are VASTLY different.
du -kh bak
29G bak
du -kh /media/ubuntu/9AB4-7DB9/ubuntu/
56G /media/ubuntu/9AB4-7DB9/ubuntu/
How is this possible?
I first assumed that the vfat
file system might be to blame - but to this extent? I can't believe it to be nearly doubling the size
I also thought it could be the -z
compress option of rsync
, but that should only compress during transfer as I understand:
-z, --compress compress file data during the transfer
Any ideas?
I am baffled, and just want to make sure my backup was complete. Thanks,
unsafe_where_true
(333 rep)
Mar 10, 2022, 05:35 AM
• Last activity: Mar 10, 2022, 05:49 AM
2
votes
1
answers
24112
views
/boot/efi failed to mount due to unknown file system "vfat" : CentOS 7.5
I have a centOS 7.5 server that does not boot up. Only boots up to rescue mode. This happened after a forced reboot of the server. I got the following error on CentOS 7.5 after checking the journalctl -p err [![enter image description here][1]][1] grub2 was installed after getting the correct x86_64...
I have a centOS 7.5 server that does not boot up. Only boots up to rescue mode. This happened after a forced reboot of the server. I got the following error on CentOS 7.5 after checking the journalctl -p err
grub2 was installed after getting the correct x86_64 file into the system,
tried to mount the boot/efi, but got the error : Unknown file type "vfat"
Then I tried to run dosfsck and correct if there are any dirty bits. There was a dirty bit, and it was corrected.
Tried to mount again, and the same error occurred. Unknown file type "vfat".
[![enter image description here]]
vfat modules are available and they are of the same version as the kernel. I did not update the kernel in this server. so we can rule out the kernel version mismatch problem.
Also tried re-installing the kernel and all the packages related to kernel.
Still the /dev/sda1 cannot be mounted to /boot/efi. I'm basically ran out of solutions now. Could you help me with this, please. Also I do not have internet to this server. I can download any file from another computer and transfer to this. Please consider this when writing your suggestion.
My fstab is as follows,








E4406B
(23 rep)
Mar 7, 2021, 03:40 PM
• Last activity: Mar 8, 2021, 08:15 AM
44
votes
3
answers
19923
views
systemd keeps unmounting a removable drive
I have following line in /etc/fstab: UUID=E0FD-F7F5 /mnt/zeno vfat noauto,utf8,user,rw,uid=1000,gid=1000,fmask=0113,dmask=0002 0 0 The partition is freshly created by `gnome-disks` under the respective user, and spans the whole card. Now: Running `mount /mnt/zeno` as user (1000) succeeds, but right...
I have following line in /etc/fstab:
UUID=E0FD-F7F5 /mnt/zeno vfat noauto,utf8,user,rw,uid=1000,gid=1000,fmask=0113,dmask=0002 0 0
The partition is freshly created by
gnome-disks
under the respective user, and spans the whole card.
Now: Running mount /mnt/zeno
as user (1000) succeeds, but right after that I find out that it's actually *not* mounted: following umount /mnt/zeno
fails with umount: /mnt/zeno: not mounted
. When watching journalctl -f
, I can see following messages appear when mounting:
[...] kernel: SELinux: initialized (dev mmcblk0p1, type vfat), uses genfs_contexts
[...] systemd: Unit mnt-zeno.mount is bound to inactive service. Stopping, too.
[...] systemd: Unmounting /mnt/zeno...
[...] systemd: Unmounted /mnt/zeno.
So it seems that systemd indeed keeps unmounting the drive, but I can't find out why. I don't remember creating any custom ".mount" files. I tried to find something in /etc/systemd and in my home folder but did not find anything.
So what is this "mnt-zeno.mount" file and how can I review it? And most importantly, how can I mount the drive?
Alois Mahdal
(4598 rep)
Nov 25, 2014, 07:01 PM
• Last activity: Feb 16, 2021, 12:41 AM
4
votes
2
answers
5148
views
How to increase the size of a vfat file system to exactly the size of the containing partition?
This is a further question after [this one][1]. I google for it, but most of the search results are about how to grow the partition and the file system at the same time. I think this question is simpler than that, because I the partition is already larger than the file system, but I want to grow the...
This is a further question after this one .
I google for it, but most of the search results are about how to grow the partition and the file system at the same time.
I think this question is simpler than that, because I the partition is already larger than the file system, but I want to grow the file system to fill the partition.
The reason why my file system is smaller than the partition is that I didn't format the partition by doing
mkfs
on it, but rather cat
ing a file system image into it. And the image is smaller than the target partition.
The reason why I have to grow the file system to fully fill the partition is that my embedded SoC won't boot when there's a gap, explained at the end of this wiki .
user3528438
(421 rep)
Sep 3, 2015, 11:03 PM
• Last activity: Nov 30, 2020, 02:44 PM
0
votes
0
answers
77
views
vFAT flash drives insist on only being writable by root
All the usual advice on editing `/etc/fstab` doesn't work. My current fstab looks something like the following: `/dev/disk/by-uuid/2D06-9C4C /media/pi/TWILIGHT vfat user,auto,uid=pi,gid=pi,umask=000 0 0` However, it still demands root permissions after I mount it. Most telling is when I `ls -la` on...
All the usual advice on editing
/etc/fstab
doesn't work. My current fstab looks something like the following:
/dev/disk/by-uuid/2D06-9C4C /media/pi/TWILIGHT vfat user,auto,uid=pi,gid=pi,umask=000 0 0
However, it still demands root permissions after I mount it.
Most telling is when I ls -la
on /media/pi/
: when the drive is unmounted, the folder permissions are pi/adm. After I mount the drive, it is for root/root.
* Unmounted: drwxrwxr-x 2 pi adm 4096 Nov 22 16:31 TWILIGHT/
* Mounted: drwxr-xr-x 5 root root 32768 Dec 31 1969 TWILIGHT/
The two other changes are that the mount point loses a w
in the permissions when mounted and that the modification date moves to 31-DEC-1969. That specific date makes me think something is going very wrong.
### How things should work
The flash drive is writable by user pi
and it auto-mounts regardless of whether it is plugged in during boot or after.
cjm
(225 rep)
Nov 22, 2020, 11:27 PM
0
votes
1
answers
340
views
How to make apache in debian access the resource on the window's vfat filesystem?
In the post [access resource on window'sntfs][1],we solve the problem ,succeded in making apache in debian access the resource on the window's ntfs filesystem,now i want to make apache in debian access the resource on the window's vfat filesystem. The disk partition `sda2` is `vfat` format. sudo blk...
In the post access resource on window'sntfs ,we solve the problem ,succeded in making apache in debian access the resource on the window's ntfs filesystem,now i want to make apache in debian access the resource on the window's vfat filesystem.
The disk partition
sda2
is vfat
format.
sudo blkid |grep 995A
/dev/sdb2: LABEL="SHARED" UUID="5E9C-995A" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="efdeb9ab-e920-40e6-9d24-df672b8806e9"
I write a config in /etc/fstab
to mount it automatically.
UUID=5E9C-995A /media/debian/SHARED vfat auto ,sync,umask=000 ,rw 0 0
Now the /dev/sda2
can be mounted automatically.
My apache setting on debian
:
cat /etc/apache2/sites-enabled/000-default.conf
ServerName localhost
DocumentRoot /media/debian/SHARED/project
Alias /project "/media/debian/SHARED/project/build/html"
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Set permission for /media/debian/SHARED/project
.
sudo chmod -R 644 /media/debian/SHARED/project
Restart my apache:
sudo systemctl restart apache2
To input 127.0.0.
and 127.0.0.1/project
in firefox.
Forbidden
You don't have permission to access this resource.
Apache/2.4.25 (Debian) Server at 127.0.0.1 Port 80
To check the log :
sudo cat /var/log/apache2/error.log
[Wed Aug 12 17:11:58.727479 2020] [core:error] [pid 3149] (13)Permission denied: [client 127.0.0.1:56434] AH00035: access to / denied (filesystem path '/media/debian/SHARED') >because search permissions are missing on a component of the path
[Wed Aug 12 16:53:37.958950 2020] [core:error] [pid 3061] (13)Permission denied: [client 127.0.0.1:56158] AH00035: access to /project/ denied (filesystem path '/media/debian/SHARED') because search permissions are missing on a component of the path
Display the ownership on /media/debian/SHARED/project
ls -al /media/debian/SHARED/project
total 304
drwxr-xr-x 14 root root 16384 Aug 12 14:19 .
drwxr-xr-x 4 root root 16384 Jan 1 1970 ..
drwxr-xr-x 4 root root 16384 Aug 12 14:18 build
/media/debian/SHARED
located on vfat
disk partition,it can't be change ownership with chown
.
sudo chown -R www-data.www-data /media/debian/SHARED/project
chown: changing ownership of '/media/debian/SHARED/project': Operation not permitted
How to make apache access the resource on vfat partition ,step by step solution is apreciated.
showkey
(499 rep)
Aug 15, 2020, 03:01 AM
• Last activity: Aug 15, 2020, 03:51 PM
1
votes
1
answers
1011
views
Sharing a Partition Between Windows and Linux Throws Permission Errors
I created a new partition in Windows 10 formatted as Fat32, so that I could work with files located in one place despite being logged into my MX Linux installation or Windows 10. While logged into Windows 10, I can move files in and out of the partition no problem. While logged into MX Linux, the dr...
I created a new partition in Windows 10 formatted as Fat32, so that I could work with files located in one place despite being logged into my MX Linux installation or Windows 10.
While logged into Windows 10, I can move files in and out of the partition no problem.
While logged into MX Linux, the drive wasn't mounted, so I modified /etc/fstab by adding this line:
UUID=3F02-4BFD /mnt/sda4 vfat defaults 0 2
Then I rebooted, only to find I couldn't mkdir inside /mnt/sda4. So I looked up the permissions and found that every owner and group was root.
So I logged into root and attempted to run:
chown foo:users sda4/
and got the error:
chown: changing ownership of 'sda4/': Operation not permitted
Note that I got with this sudo and while actually logged in as the root user.
I did some research and apparently there might be some immutability properties so I ran:
lsattr sda4/
And got this on all of the directories:
lsattr: Inappropriate ioctl for device While reading flags on sda4/foo
Currently stuck at this point.
so1120
(115 rep)
Jul 16, 2020, 01:39 PM
• Last activity: Jul 16, 2020, 05:41 PM
Showing page 1 of 20 total questions