UBIFS mount in busybox via fstab does not recognize relatime option - linux

I am getting this error when I try to mount my UBIFS filesytem:
mount -o remount,rw /config
UBIFS error (pid 1265): ubifs_parse_options: unrecognized mount option "relatime" or
missing value
The content of my fstab is :
root#drgos:~# cat /etc/fstab
# WARNING: this is an auto generated file, please use uci to set static filesystems
/dev/ubi0_0 /config ubifs ro 0 0
And when I type mount the result is :
root#drgos:~# mount
rootfs on / type rootfs (rw)
none on /proc type proc (rw,relatime)
none on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=512k)
none on /dev/pts type devpts (rw,relatime,mode=600)
/dev/ubi0_0 on /config type ubifs (ro,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
I do not understand why I have the option relatime since that one is not present in my fstab!
I am using BusyBox v1.11.2 (2014-01-13 09:35:41 CET) multi-call binary.

These options are dependent on the Linux kernel version. relatime is a general mount options. relatime is the default for newer Linux kernels. Other filesystems may quietly ignore unknown options, whereas ubifs is failing. You can try mount -o remount,rw,noatime,norelatime /config. Your mount command shows the /config directory is mounted with relatime; this is information that busybox mount applet collected.
This information is collected with the getmntent_r() function. If busybox is dynamically linked, then the 'C' library may be giving this information as part of the *mnt_opts* string.
The idea with mount -o remount,rw,noatime,norelatime /config is to try and over-ride this information so that UbiFs will be happy with its mount options. The other way is to simply umount and then mount again manually.
umount /config
mount -t ubifs /dev/ubi0_0 /config
This way previous mount information will not be retrieved.

Related

Programmatically obtaining USB file system format

I need to mount a USB drive to an embedded system, running Linux. The USB could be in FAT, NTFS or ExFAT format.
How can i handle this in code so that I pass proper type in mount command such as
mount -t vfat /dev/sda1 /mnt
So I have tried mount with:
mount -t vfat,ntfs /dev/sda1 /mnt
This command gives invalid argument, but it successfully mounts the USB if USB is in NTFS or VFAT format. However if i try to give
mount -t vfat,ntfs,exfat /dev/sda1 /mnt
The command fails.
Any pointers will be really helpful.
From the mount manual page:
If no -t option is given, or if the auto type is specified,
mount will try to guess the desired type. Mount uses the blkid
library for guessing the filesystem type...
Is libblkid available for your embedded system?
Try:
mount -t auto /dev/sda1 /mnt
or
mount /dev/sda1 /mnt
And as mentioned in the comments, make sure the kernel on your embedded system supports exfat.

Mount Squashfs as Root in initramfs Raspbian

I'm currently trying to make my raspbian boot from a squashFS image through initramfs.
The squashfs image is on file system /dev/mmcblk0p1, so I mount this prior to mounting the Image.
Unfortunately I'm stuck at mounting the SquashFS Image file.
I tried mounting through
mount -o loop
but I always get
mounting /dev/loop0 on /mnt/root failed: No such device
So I tried to mount it through loop manually. The problem is, that mounting the /dev/loop0 fails with the same Error as above.
This is my init so far:
#!/bin/busybox sh
# Mount the /proc and /sys filesystems.
mount -t proc none /proc
mount -t sysfs none /sys
#create loop devices
mknod /dev/loop0 b 7 0
mkdir /mnt/root
# Mount the boot partition
mount -o ro /dev/mmcblk0p1 /mnt/boot
sleep 5
# Mount the root FS with losetup
echo "Mounting with losetup"
losetup /dev/loop0 /mnt/boot/SYSTEM
mount /dev/loop0 /mnt/root -t squashfs
echo "Done"
#mount -o ro,loop -t squashfs /mnt/boot/SYSTEM /mnt/root
# Use Fallback mounting failed
if [ ! -e /mnt/root/home ]
then
echo "MOUNTING SDA1"
mount /dev/sda1 /mnt/root -t ext4
fi
# Clean up.
umount /proc
umount /sys
umount /mnt/boot
# Boot the real thing.
exec switch_root /mnt/root /sbin/init
Checking
losetup /dev/loop0
tells me, that the squashfs Image has been attached to loop0.
Does somebody know where to start?
I came across your question because I ran into the same thing today while building my own initramfs. I did some more digging and found this:
http://www.silas.net.br/doc.notes/unix/linux/busybox-troubleshooting.html
Then it dawned on me that I hadn't built squashfs into the kernel or loaded the module. After I did that, everything worked!
In case you haven't, make sure your kernel supports squashfs.

How to determine the type of file system on an SD Card

How to determine the type of file system on an SD Card (this card is not yet mounted. I need to determine the file system type so that i can mount the SDCard through a program according to the file system type)
Or from the terminal. For example "mount -t ext3 /dev/sdc1 /mnt"
You might do a file -s /dev/sdc1 and it could recognize the filesystem data.
And you might do mount -t auto /dev/sdc1 /mnt to have mount recognize it.

mount point /dev/sdb1/mnt is not a directory

I'm partway through an installation of Arch Linux and, following the online instructions, I'm mounting /dev/sdb1/mnt.
When I input
mount /dev/sdb1/mnt
it returns
mount: you must specify the filesystem type
Using both auto and ext4 (my filesystem type, I'm fairly certain)
mount auto /dev/sdb1/mnt
I get
mount: mount point /dev/sdb1/mnt is not a directory
What is going on here?
You are missing a space:
# right here---v
mount /dev/sdb1 /mnt
The mount command wants a device and a directory. /dev/sdb1 is the device, and /mnt is the directory.

mounting devices not allow binaries

what command will mount device /device/sdal to the mount point /mnt/usb with a filesystem type of ext 3 and not allow binaries executed from the device
mount -t ext3 -o noexec /dev/sda1 /mnt/usb
That should do it:
mount -t ext3 /dev/sda1 /mnt/usb -o noexec
The noexec option should do this. If you're using the user option, noexec is implied.
http://linux.die.net/man/8/mount

Resources