LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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: 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:
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



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 03:49 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration