LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org 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.

Notices

Reply
 
Search this Thread
Old 11-21-2011, 01:26 AM   #1
telexl
LQ Newbie
 
Registered: Aug 2009
Posts: 6

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:
Code:
losetup -a
... but on my system, it outputs a truncated path:
Code:
/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:
Code:
cat /sys/devices/virtual/block/loop0/loop/backing_file
/home/lex/Projects/Backup/media/card/loop-images/home.ext2
Sorted!
 
  


Reply


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 Off
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 8 04-05-2011 09:18 AM
for loop or while loop to read the fields of a file.. visitnag Linux - Newbie 10 09-02-2010 08:47 PM
Gentoo. Problems with the loop device when mounting an iso file Snerkel Linux - Software 4 11-26-2004 03:34 PM
loop: can't open device /dev/loop0: No such device or address miaviator278 Linux - Security 3 06-09-2004 09:24 PM


All times are GMT -5. The time now is 09:28 PM.

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