• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

how to determine where a file is on a umount partitions of the same disk?

In linux, how can I search for a file on umount partitions of the same disk?

For exmple, I'm trying to search for a file name 2530script on the following umounted partitions

/dev/sdc1  
/dev/sdc2  
/dev/sdc3  
/dev/sdc5  
0
areyouready344
Asked:
areyouready344
1 Solution
 
omarfaridCommented:
i think you need to mount then search using find command
0
 
Deepak KosarajuDevOps EngineerCommented:
Omarfarid: Is Correct, there is no method of searching for a file on unmounted filesystems. Its not at all possible even on Windows.
0
 
Maciej SsysadminCommented:
Actually, it can be possible, but I wouldn't trust it in 100%.

If all partitions you wrote above are unmounted, you can try this:
strings /dev/sdc1 | grep 2530script
strings /dev/sdc2 | grep 2530script
strings /dev/sdc3 | grep 2530script
strings /dev/sdc5 | grep 2530script
0
Will You Be GDPR Compliant by 5/28/2018?

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

 
Maciej SsysadminCommented:
You can also use this when your partitions are mounted - it won't hurt you - but in such situation I would rather use "find" utility :)
0
 
ai_ja_naiCommented:
oklit had a good idea... but printing on standard output all the filesystem can take a looooooooooooot of time (even if grep cleans away the garbage)
0
 
omarfaridCommented:
areyouready344:

can you clarify why you want it for unmounted partitions? are these raw partitions?
0
 
areyouready344Author Commented:
The reason why I wanted to search a file on unmounted was because I wasn't sure if linux keep the same mapping of a device file (for example, /dev/sda) to the same scsi hard disk when removing other scsi hard dsik and needed this same device file (/dev/sda) for logging information.

For example, if I remove device file /dev/sdb to a particular scsi disk, will linux change the device file of /dev/sdc to device /dev/sdb now that it has been remove previously. This issue has been resolve because now I use a USB thumb device as the logging location for log files and just create a mount point to it.
0

Featured Post

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now