- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to use loopback device to access a file that contains a file system. I wrote a test and below are the steps that i tried manually from the test to debug the problem
Scenario : I was trying nfs mount on my mic0 machine and while doing global umount i get an error. Steps below :
1) created a mount directory and mount nfs
mkdir /mnt/1
mount nfs on /mnt/1
2) Created two temporary(local) mount points and use them to mount the file. (say)
mkdir /tmp/p1
mkdir /tmp/p2
3) copied a file that contains a file system from client to mounted directory
cp /a/b/c/file.txt /mnt/1/file_ext2.txt
4) mounted both the files on the above two local mount points :
mount -o ro,loop -t ext2 /mnt/1/file_ext2.txt /tmp/p1
mount -o ro,loop -t ext2 "/a/b/c/file.txt" /tmp/p2
4) checking the diff to be sure that the data is same in both files :
diff -r /tmp/p2 /tmp/p1
5) as there is no difference, so il umount the devices and will remove the directories :
umount /tmp/p2
umount /tmp/p1
rmdir /tmp/p2
rmdir /tmp/p1
6) Now i try to umount the global mount :
umount /mnt/1
I get the following error :
[root@abc ~]# umount /mnt/1/
umount: can't umount /mnt/1: Device or resource busy
------------------------------------------------------------------
I tried to debug the above scenario and found that the ,device /dev/loop0 and /dev/loop1 are still holding the two devices using "losetup" command.
[root@abc]# losetup
/dev/loop0: 0 /mnt/1/file-ext2.txt
/dev/loop1: 0 /a/b/c/file.txt
And i had to explicitly remove them, using losetup -d.
[root@abc]# losetup -d /dev/loop0
[root@abc]# losetup -d /dev/loop1
Then only i was able to do global mount successfully.
--------------------------------------------------------------------------------------
Ques :
1) Why does MPSS differ in behaviour w.r.t umount ? There is nothing mentined in the MPSS guide pdf regarding this.
2) Do i have to use "losetup" command everytime i try to execute my loopback setup.
Note : This scenario i encountered while working for loopback device only.
Thanks !
Sunny
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't know you could mount a text file as a file system image. I can't picture what a directory would look like, much less an executable inside a text file system image. Could you post a simple example? And have you tried copying the file to a directory on the coprocessor instead of to an nfs mounted directory? Did the same thing happen? When I have your answers, I will try and reproduce the issue and ask the developers if they can say what is going on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the below steps will answer all your question :
These steps are executed on my server :
dd if=/dev/zero of=/usr0/sarora2/sun bs=4MB count=250 : created a file using dd which will be ext2-formatted
mkfs.ext2 /usr0/sarora2/sun : making the file ext2-formatted
sudo vim /etc/exports : adding the /usr0/sarora2/ in /etc/exports
sudo exportfs -a
These steps are executed on the client (mic0) :
mkdir /mnt/sarora2
mount -t nfs 10.21.1.91:/usr0/sarora2/ /mnt/sarora2/ : To make the file visible on The client
mkdir /mnt/sarora
mount -t nfs 10.21.1.91:/usr0/sarora /mnt/sarora/
mkdir /tmp-pid-1
mkdir /tmp-pid-2
cp /usr0/sarora2/sun /mnt/sarora/sun-ext2.tmp
mount -o ro,loop -t ext2 /mnt/sarora/sun-ext2.tmp /tmp-pid-1
mount -o ro,loop -t ext2 /usr0/sarora2/sun /tmp-pid-2
diff -r /tmp-pid-1 /tmp-pid-2 : To make sure the data on both files is same
umount /tmp-pid-2
umount /tmp-pid-1
rmdir /tmp-pid-1
rmdir /tmp-pid-2
umount /mnt/sarora/
umount: can't umount /mnt/sarora: Device or resource busy
As it written, it is not able to umount the /mnt/sarora .
In case any thing else you need please let me know. Happy to answer your queries.
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunn A. wrote:
1) Why does MPSS differ in behaviour w.r.t umount ? There is nothing mentined in the MPSS guide pdf regarding this.
This is another example of a behavioral difference between the Busybox implementation of tools (in this case, mount and umount) and their traditional Linux implementation (for mount and umount, a package called "util-linux"). The MPSS Users Guide for MPSS 3.4.2 warns about such differences in section 8.10 and includes a different example, involving the netcat utility. I've run across several others personally.
While the existence of these differences is widely known, what exactly they all are isn't; the Busybox project doesn't attempt to enumerate each and every one of them in its documentation. That's understandable since the behavior of the traditional implementation is frequently a moving target.
The differences are often minor or within less common use cases; where they are particularly irksome, MPSS sometimes chooses to use the traditional implementation of a tool rather than the Busybox one. For example, it uses GNU bash for /bin/sh, not Busybox's Almquist shell derivative.
In the default configuration, all of MPSS's filesystem content consumes RAM on the Xeon Phi that the user might otherwise have available to run their applications—there's a tradeoff to be made; using the traditional implementation all the time would prevent surprises but consume a much larger fraction of RAM.
Sunn A. wrote:
2) Do i have to use "losetup" command everytime i try to execute my loopback setup.
If you are willing to make the aforementioned tradeoff, you may have another option—switch to using the util-linux implementations of mount and unmount, which MPSS includes. Within mpss-3.4.2-k1om.tar, you will find, among others you may need to install as well, these two RPM packages:
- util-linux-mount-2.21-r5.k1om.rpm
- util-linux-umount-2.21-r5.k1om.rpm
See section 11.3 of the MPSS Users Guide. Be aware that Intel does not specifically test this configuration; you may run into bugs or inconveniences inherited from the package metadata of Yocto Project version 1.2, which MPSS 3.4.2 leverages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The above rpm's worked well enough to solve the umount issue.
Also i haven't came across any other issues after installing the rpm's :
- util-linux-mount-2.21-r5.k1om.rpm
- util-linux-umount-2.21-r5.k1om.rpm
Thanks .

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page