LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2007, 11:37 AM   #1
g_johnsonsamuel
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
Find if file system is already created on the RAW device


Hi

I use mkfs to create ext3 filesystem on the raw device. It a automated process using script, i dont want to create the filesystem (override) when running the script again.

I tried "fsck -n /dev/<device>" and can see the difference b/w the raw device and raw device with filesystem but dnot know how to code in the shell script.

Any suggestion is much appreciated.

thanks,
 
Old 07-16-2007, 12:23 PM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
I didn't check if there is a useful return code, but look for different return status on both scenarios.
Code:
# fsck -n /dev/device; echo "fsck returned $?"
 
Old 07-16-2007, 01:48 PM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
Better than using fsck to figure out what is the filesystem on a device, use the command file instead:
Code:
[root@agente86 nagios]# file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext3 filesystem data (needs journal recovery)
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find hex patterns in raw hdd block device dtimms Linux - Software 6 01-04-2006 05:52 AM
Where can i find the device driver code on my systeM dr_zayus69 Linux - Hardware 1 10-02-2005 04:59 AM
How to access raw sectors on HDD with no file system? prasanthpooyath Programming 4 01-08-2005 10:53 AM
Converting Raw file system...???? avols143 General 4 07-02-2004 10:14 PM
When a process locks up the system - what is the created image file called? thatgentleman Linux - General 3 03-22-2002 09:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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