Improve company productivity with a Business Account.Sign Up

x
  • 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
Building an Effective Phishing Protection Program

Join Director of Product Management Todd OBoyle on April 26th as he covers the key elements of a phishing protection program. Whether you’re an old hat at phishing education or considering starting a program -- we'll discuss critical components that should be in any program.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

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