I know mount and df lists all mounts. But I would like to list the mounts which failed to establish on boot, too. How do I get them?
There is no such command, since there is no list of "attempted mounts". You can compare the current mount list (/etc/mtab) to the list of shares registered to be mounted though (/etc/fstab).
Alternatively you could try to grep through the system log files to find failed mount attempts.
You can use mount -a to mount all the mount points defined in the fstab.
If there is some kind of error mounting, you will get some warning. If the mount point is already mounted successfully, the command will do nothing with that mountpoint.
Mount errors should appear in dmesg.
Related
I've been using this line in /etc/fstab for mounting a storage device to my host:
//url.to-my-storage.com/mystorage /mnt/backup cifs
iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=1000,gid=1000,file_mode=0660,dir_mode=0770
0 0
I was mounting it to another host, and I ran this to protect the files from change through the new host:
chmod -R 444 /mnt/backup
(I tried to protect the storage from writing from this host, which turned out to change the mode of all the storage files)
I assume the missing executable permissions what causing me this:
$ sudo mount -a
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
I tried unmounting and mounting again, that didn't help, got the same permission error when using the mount command.
ls the dir shows this:
$ ls -la /mnt/backup
?????????? ? ? ? ? ? backup
HELP !
Dismounting a "Locked Out" Network Drive
To dismount a "locked out" network drive, you can try to force the unmount:
umount -f -t cifs /mnt/backup
If you are having trouble dismounting a drive, make sure that you don't have a console open somewhere where the current working directory (CWD) on the drive which you are trying to dismount, or have a file open in an editor or player somewhere or such.
Properly Mounting a Network Drive
You should add your permissions in your mount options rather than trying to apply them afterwards. You would want to replace these mount options:
rw,file_mode=0660,dir_mode=0770
with
ro
Currently you are mounting your CIFS drive as read-write (rw), giving files read-write permission (file_mode=0660) and directories read-write-execute (dir_mode=0770). Simply mounting the drive as read-only (ro) should suffice. (If you do need to fine tune the file and dir modes, rather use umask.)
I would also advise you to double check whether you are using uid and gid correctly: if the user ID or group ID used gets deleted, that could also lead to problems.
References
https://linux.die.net/man/8/mount
https://en.wikipedia.org/wiki/File_system_permissions
https://oracletechdba.blogspot.com/2017/06/umount-lsof-warning-cant-stat-cifs-file.html
https://stackoverflow.com/a/40527234/171993
I've updated my openwrt firmware using the web interface. Now the web interface is unreachable.
I lost my root password so i started my router (wr1043nd) in failsafe mode, but the mount_root command is not working:
$mount_root
""/bin/ash: mount_root: not found""
Any clue? I can't find any solution in the docs/ online
You can mount jffs2 partition manually. This partition contains your configuration, so when you mount it, you will be able to edit root password.
Use this command: mount -t jffs2 /dev/mtdblock3 /mnt/. Please note that mtd number may vary in different routers. If there is nothing in /mnt dir after issuing this command, try another mtdblock number.
Then go to /mnt dir and remove /etc/shadow and /etc/passwd files from there to reset root password.
I accidently formatted my ntfs windows partition with "mkfs.ext4".
I was able to recover it with testdisk but it seems that the windows partition was hibernated,
so whenever i tried to open windows it starts repairing disk errors which was taking too long,
so i manually chkdsk ,to which after some time it started telling -"unreadable sector........
which also took very long so i shut it down.
In kali linux whenever i tried to mount it with "mount /dev/sda3 /mnt -t ntfs -r"
it mounts but many of the folders are empty including windows,program files,Users.
I am new to linux,can you tell me steps to recover my files if possible windows...
Thanks in Advance.
Use sudo ntfsfix /dev/sdXY where XY is the partition name. ex:sda4. use gparted to find partition name. Then mount. It may help.
First check to see it the partition is mounted, it maybe mounted as Read-only. Then issue the mount command with the options.
sudo mount -t ntfs-3g -o remove_hiberfile /dev/yourWindowsPartition /media/yourUser/WindowsPartitionName
I made an image of a single partition from a disk containing multiple partitions using the following:
#ddrescue -d -r3 /dev/sdb3 sdb3.img sdb3.logfile
However, when I try to mount the image using the following:
mount -o loop,ro sdb3.img /media/mymount
I get the following error message:
Failed to read last sector (81919999): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
or it was not setup correctly (e.g. by not using mdadm --build ...),
or a wrong device is tried to be mounted,
or the partition table is corrupt (partition is smaller than NTFS),
or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/loop0': Invalid argument
The device '/dev/loop0' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
Any help to resolve the issue would be appreciated.
Regards
To mount a partition from an image file you can use kpartx.
To list the mappings the tool detects in the image file:
kpartx -l sdb3.img
Then to add the mappings:
kpartx -a sdb3.img
The partitions will then appear as devices under /dev/mapper, they can then be mounted normally.
See man kpartx and this blog.
I am having a linux mount on my jenkins build server. After a job in jenkins succeeds, a script is being called which copies the files from workspace to different directories in the mount. Each time I mount the copy operation succeeds but after few hours it fails with I/O error: cannot copy. I have to remount the share again to get this thing going.
Any ideas on the fix? I am struggling for 2 weeks now. I do not want to remount again and again.
Command I used: mount -t cifs -o rw,noperm,username=xyz,password=* //remoteserver/path /local/path.
Thanks
Not sure if this will help you. But, this something that I do for my scripts.
You said that you have a script that copies the files from workspace to the mount. Why don't you add a condition to a script, to check if the mount exists if not remount or something like that.