Why proc fiesystem is empty if mounted over NFS - linux

I was curious to see if I could display contents of /proc virtual filesystem which was mounted over network. So I exported "/" and mounted it in another system over NFS. Then I did cd in to proc directory and did ls. It displayed nothing. Someone please explain why it is empty.

Please read man 5 exports:
nohide This option is based on the option of the same name provided in
IRIX NFS. Normally, if a server exports two filesystems one of
which is mounted on the other, then the client will have to
mount both filesystems explicitly to get access to them. If it
just mounts the parent, it will see an empty directory at the
place where the other filesystem is mounted. That filesystem is
"hidden".
By default the client doesn't see nested mounts.

Related

NFS mount point as a disk device linux

A remote NAS server provides an NFS share (/myShare) to a linux client machine
From the linux client , I mounted the NFS share ( Eg./mnt/myShare )
My question is , Is it possible to convert this /mnt/myShare as a disk device (eg./dev/mydevice)
I would like to use this disk as a physical disk itself to a container to store its data.
Can device mapper be of help here.. Any leads would be of help here
--kk
Is it possible to convert this /mnt/myShare as a disk device (eg./dev/mydevice)
The answer is yes and no. Yes, because you can mount everything anywhere, i.e. you can:
mount -t nfs nas:/myShare /dev/mydevice
(provided that the directory /dev/mydevice exists).
NO, because a disk is a file under /dev, which basically exposes a set of sectors (or clusters) - other OS components use that to present a file system, which then is mounted somewhere else.
You, instead, have already a file which represents a file system. You can mount that file system wherever you want. 99% of your OS, and your programs, will not care about.
But your share is not a disk, because it is something (a directory part of a file system) exported by another machine. And this difference cannot be circumvented. I think you can live with this without problems but, if your question is literally correct, then no: an exported share is not a disk.
If you want to use the raw hard drive, then you don't need a filesystem. Perhaps your NAS server can be configured to export its storage as an iSCSI target.
NFS itself doesn't implement storage as block device.
But what you can do is the following:
Mount /myShare onto /mnt/myShare.
Create a file the size of all of myShare. For example, if myShare is 3TB in size, do truncate -s 3T /mnt/myShare/loop.img. (at this point, if you wanted a filesystem, you could have done mkfs -t ext4 /mnt/myShare/loop.img).
Set up the file as a loop device: sudo losetup /dev/loop7 /mnt/myShare/loop.img
You now have a 3TB block device on /dev/loop7, which you can see in the output of grep loop7 /proc/partitions.

How to access hidden mounts in linux

In my linux box, i can able to access one mount path, which is not present in /etc/fstab or /etc/mtab.
I want to disable that mount point. Please help me with the command to show the hidden mount.
Below is the hidden mount in some xxx machine.
/net/bnrdev/bld-views/build
Above path present in bnrdev machine:
/bld-views/build
These are not "hidden" per se, but NFS mounts found by your system.
You can get rid of this functionality by disabling NFS client services, or just the automount daemon.
WARNING - this will likely break automounted home directories, which could cause issues for other system users.
Please! for the LUV of all things cute & cuddly, make a copy of the files you modify. Justin Case could have an issue with your changes, right as you're falling asleep.

How can I show root directory as well as external mounted drives like USB, CD-Rom with Qtreeview on Linux OS?

I just want to show root directory and external mounted drivers (USB, CD) if available on Linux as multiple QTreeViews. As following
/
USB
CD
But, for now I can only show external mounted drivers under root directory.
You will have to build your own QAbstractItemModel (and not use QFileSystemModel) as QFileSystemModel will show you the tree files as they are.
If you are a beginner I strongly advise you to think differently your user interface as making tree model is not an easy task.
Or you can use several QFileSystemModel that would be initialized with different paths with QFileSystemModel::setRootPath :
one the VFS root
one for /media (you can even extract all mount point here /proc/mounts or use the /sys interface)
and so on.
External drives can not be viewed on Linux with QFileSystemModel
from Qt Manual:
QDir::Drives List disk drives (ignored under Unix).

Asterisk AGI/Outgoing Directory Permissions on Mount

I have a little issue with setting up an external call automatically from asterisk an box.
What I am Trying to Achieve:
I have 2 linux box's and I want to sshfs mount one directory on say 10.100.100.1 to 10.100.100.208/var/spool/asterisk/outgoing (as the mount point)
the reason is the 10.100.100.1 address is a device called Webbrick Gateway a home automation device which can send AGI commands if necessary. but what I want to be able to do is get this to move the .call file to the outgoing directory on the Asterisk Server (var/spool/asterisk/outgoing) or on 10.100.100.1 (Webbrick Gateway) /mnt/call/.
What I've tried:
I have tried to sshfs mount to /var/spool/asterisk/outgoing. This seems fine but it actually takes the privileges off user asterisk and then asterisk will not look at this folder for outgoing call files. The Owner and Group are changed to root, as I assume are the same with all mount points.
Solutions I can think of:
1.: Tell asterisk to look somewhere else for call files.
2.: Tell asterisk to not get worried about permissions,
3.: mount keeping permissions intact
I do understand that the Webbrick Gateway is not a commonly known item but maybe someone with a better understanding of Asterisk might be able to help.
Asterisk can't "not worry about permission", becuase linux core just not allow asterisk do file operation.
You need
mount folder with correct permission(as user asterisk) for example using this articles
Start asterisk AFTER mount of partition. If asterisk started before mount, it will not see mounted folder.

How to disable the filesystem cache on the root device?

I've got an ARM virtual machine running on top of KVM/QEMU, with a file mounted as the root filesystem. The VM doesn't have networking, so NFS mounting the root is out of the question. I am testing a particular transport mechanism for IO, so I'm kind of stuck with what I've got.
I want to send files into the guest, so I'd like to mount the file on the host, write things to it, and then unmount it to force a flush. The contents of the filesystem are trivial, and I have a backup, so I have no problem with corruption. Likewise, performance is not an issue.
The problem is, when I do this mount-write-unmount thing, the guest never sees the file. I'm guessing this is a result of the kernel's filesystem cache, and that when I do ls, the file isn't there. I'm guessing the metadata concerning the filesystem are cached in memory, and the updates to the filesystem never appear.
I'm guessing if I disable filesystem caching, then all reads will be forced to disk, causing the filesystem to be hit, and my file to appear. Any tips?
I can think of this:
sync
echo 3 > /proc/sys/vm/drop_caches
And this:
qemu -drive cache=none,file=file.img

Resources