www cyberciti biz tips understanding unixlinux filesystem su

9
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API Understanding UNIX / Linux filesystem Superblock by NIXCRAFT on NOVEMBER 8, 2005 · 14 COMMENTS · LAST UPDATED SEPTEMBER 25, 2007 This is second part of "Understanding UNIX/Linux file system", part I is here. Let us take an example of 20 GB hard disk. The entire disk space subdivided into multiple file system blocks. And blocks used for what? Unix / Linux filesystem blocks The blocks used for two different purpose: 1. Most blocks stores user data aka files (user data). 2. Some blocks in every file system store the file system's metadata. So what the hell is a metadata? In simple words Metadata describes the structure of the file system. Most common metadata structure are superblock, inode and directories. Following paragraphs describes each of them. GET FREE TIPS & NEWS Make the most of Linux Sysadmin work! Enter your email Join Youtube | Twitter | Google + ABOUT FORUM HOWTOS & FAQS LOW GRAPHICS SHELL SCRIPTS RSS/FEED

Upload: thisisghostactual

Post on 25-Oct-2015

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Understanding UNIX / Linux filesystem Superblockby NIXCRAFT on NOVEM BER 8 , 2 0 0 5 · 1 4 COM M ENT S · L AST UPDAT ED SEPT EM BER 2 5 , 2 0 0 7

This is second part of "Understanding UNIX/Linux file system", part I ishere. Let us take an example of 20 GB hard disk. The entire disk spacesubdivided into multiple file system blocks. And blocks used for what?

Unix / Linux filesystem blocksThe blocks used for two different purpose:

1. Most blocks stores user data aka files (user data).2. Some blocks in every file system store the file system's metadata. So what the hell is a

metadata?

In simple words Metadata describes the structure of the file system. Most common metadatastructure are superblock, inode and directories. Following paragraphs describes each of them.

GET FREE TIPS & NEWS

Make the most of Linux Sysadmin work!

Enter your email Join

Youtube | Twitter | Google +

A B O U T F O R U M H O W T O S & F A Q S L O W G R A P H I C S S H E L L S C R I P T S R S S / F E E D

Page 2: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

SuperblockEach file system is different and they have type like ext2, ext3 etc. Further each file system hassize like 5 GB, 10 GB and status such as mount status. In short each file system has asuperblock, which contains information about file system such as:

File system typeSizeStatusInformation about other metadata structures

If this information lost, you are in trouble (data loss) so Linux maintains multiple redundantcopies of the superblock in every file system. This is very important in many emergencysituation, for example you can use backup copies to restore damaged primary super block.Following command displays primary and backup superblock location on /dev/sda3:

# dumpe2fs /dev/hda3 | grep -i superblock

Output:

Primary superblock at 0, Group descriptors at 1-1Backup superblock at 32768, Group descriptors at 32769-32769Backup superblock at 98304, Group descriptors at 98305-98305Backup superblock at 163840, Group descriptors at 163841-163841Backup superblock at 229376, Group descriptors at 229377-229377Backup superblock at 294912, Group descriptors at 294913-294913

Continue reading rest of the Understanding Linux file system series (this is part II):

Part I - Understanding Linux superblockPart II - Understanding Linux superblockPart III - An example of Surviving a Linux Filesystem Failures

Network Management ToolOpManager.ManageEngine.comFor LAN, WAN & Datacenters.Agentless, deploys quick. Free try!

Nexus 7 from Googleplay.google.comThin, light, and more portable withmobile data. Shop now from $199.

Dropbox™ for TeamsDropbox.comEasy Secure Business File Sharing.Start With 5 Licenses. Free Trial.

Page 3: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Tweet 11 1 Like 5 Submit

1

Part III - An example of Surviving a Linux Filesystem FailuresPart IV - Understanding filesystem InodesPart V - Understanding filesystem directoriesPart VI - Understanding UNIX/Linux symbolic (soft) and hard linksPart VII - Why isn't it possible to create hard links across file system boundaries?

You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:30 Handy Bash Shell Aliases For Linux / Unix / Mac OS XTop 30 Nmap Command Examples For Sys/Network Admins25 PHP Security Best Practices For Sys Admins20 Linux System Monitoring Tools Every SysAdmin Should Know20 Linux Server Hardening Security TipsLinux: 20 Iptables Examples For New SysAdminsTop 20 OpenSSH Server Best Security PracticesTop 20 Nginx WebServer Best Security Practices20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors15 Greatest Open Source Terminal Applications Of 2012 My 10 UNIX Command Line MistakesTop 10 Open Source Web-Based Project Management SoftwareTop 5 Email Client For Linux, Mac OS X, and Windows UsersThe Novice Guide To Buying A Linux Laptop

{ 14 comments… read them below or add one }

Anonymous May 31, 2006 at 5:13 pm

nixCraft

Like

29,187 people like nixCraft.

Facebook soc ial plugin

R E L A T E D P O S T S

Understanding UNIX / Linux filesystemdirectories

Why isn’t it possible to create hardlinks across file system boundaries?

Understanding UNIX / Linux filesystemInodes

How to: Linux / UNIX Delete or RemoveFiles With Inode Number

Understanding UNIX / Linux FileSystem

Page 4: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

2

3

4

Anonymous

# dumpe2fs /dev/hda3grep -i superblockabove command is not running here |(pipe) is missing, anyway

I am getting different output as you mentioned[root@sachan /root]# dumpe2fs /dev/hda1 | grep -i superblockdumpe2fs 1.19, 13-Jul-2000 for EXT2 FS 0.5b, 95/08/09[root@sachan /root]#

REPLY

nixcraft May 31, 2006 at 9:59 pm

Opps pipe was missing, thanks for heads up.

Hmm it should give the output.

REPLY

Kristian May 5, 2007 at 4:33 pm

It should be mentioned that dumpe2fs only is for the ext2/ext3 file systems.

REPLY

bipul August 1, 2007 at 8:14 am

Hello Unix Teamhow are you

REPLY

Understanding UNIX / Linux symbolic(soft) and hard links

How To Measure Linux Filesystem I/OPerformance With iozone

Surviving a Linux Filesystem Failures

The importance of Linux partitions

Mount a Linux filesystem on a SANfrom multiple nodes at the same time

Page 5: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

5

6

Swapnil August 31, 2007 at 6:05 am

Hi Vivek,

I have a doubt as how many redundant backups of superblock are created in the file system? Is it made on every block group or only on initial few block groups ?In the filesystem that I created of size 128 MB with 16 block groups, when I run the dumpe2fscommand on it, it gives the info on superblocks (These are not the exact wordings of theoutput ) :primary superblock is present on block group 0,back up superblock is present on block group 1, 3, 5, 7, 9.

Similarly for a file system with 256 MB size and 31 block groups, primary superblock ispresent on block group 0 and backups are present on block groups 1,3,5,7, and 9.

So my doubt is how does the file system how many backups of the superblock to be created?And the same doubt for block group descriptors as well. Block group descriptors are notpresent in each block group but only in the block groups where superblock is present.

Hoping for an earliest response.

Thanks,Swapnil

REPLY

Sunil April 18, 2008 at 6:40 am

Hey this command id not working on my system…

Page 6: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

7

8

9

[sunilv@lnx202-28 ~]$ dump2fs /u/sunilv | grep -i superblockdump2fs: Command not found.

REPLY

rakesh September 13, 2011 at 7:52 am

dude.. commands is dump2efs

u used dump2fs

REPLY

vivek April 18, 2008 at 10:46 am

Use full path /sbin/dumpe2fs, you are logged in as regular user and /sbin and /usr/sbin not inPATH settings.

REPLY

c November 24, 2008 at 6:10 am

To Swapnil,

You have sparse_super mode so super block and backups are saved in groups0,1,3 n̂,5 n̂,7 n̂ (e.g. 0,1,3,5,7,9,25,27,…). If you take a look at mke2fs code, you’ll see theseplaces where super blocks are saved.

p.s. this is a very late comment but just wanted to comment..

REPLY

Page 7: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

10

11

12

13

14

Govindasamy C January 28, 2009 at 5:25 am

Its working fine for mesunil i think you did not give space after the command dumpe2fs

REPLY

sox May 24, 2011 at 1:37 am

what is meant by offset information in a filesystem?

REPLY

saikumar July 14, 2011 at 3:59 am

is it possible to install linux in personal lappies? core2duo processor( dell laptop)…is it possible even vmware workstation is installed in laptops….

REPLY

lanh May 17, 2012 at 8:06 am

Good content; I like how you explain this topic very simply, as linux is typically hard to grasp.

REPLY

Aravind October 3, 2012 at 7:00 am

Page 8: Www Cyberciti Biz Tips Understanding Unixlinux Filesystem Su

pdfcrowd.comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

Very fine . . . . . . .u

REPLY

Leave a Comment

Name *

E-mail *

Website

You can use these H T M L tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre><a href ="" title="">

Security Question:What is 14 + 6 ?

Solve the simple math so w e know that you are a human and not a bot.

Submit