Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - General > Member Success Stories
User Name
Password Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.


  Search this Thread
Old 11-21-2011, 02:26 AM   #1
LQ Newbie
Registered: Aug 2009
Posts: 7

Rep: Reputation: 0
Getting the file associated with a loop device

I use a lot of loop filesystems (/dev/loopN) with embedded devices, and something that's always bothered me is this: once a loop file has been mounted with a loop device, how do I get the name of the original file?

I tried this:
losetup -a
... but on my system, it outputs a truncated path:
/dev/loop0: [0802]:19358161 (/home/lex/Projects/Backup/media/card/*)
I don't know what the '*' is doing there.

I found the answer when looking in /sys:
cat /sys/devices/virtual/block/loop0/loop/backing_file


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to loop over text file lines within bash script for loop? johnpaulodonnell Linux - Newbie 9 07-28-2015 04:49 PM
for loop or while loop to read the fields of a file.. visitnag Linux - Newbie 10 09-02-2010 09:47 PM
Gentoo. Problems with the loop device when mounting an iso file Snerkel Linux - Software 4 11-26-2004 04:34 PM
loop: can't open device /dev/loop0: No such device or address miaviator278 Linux - Security 3 06-09-2004 10:24 PM > Forums > Linux Forums > Linux - General > Member Success Stories

All times are GMT -5. The time now is 03:08 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration