暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle数据恢复:格式化会损坏多少数据?

原创 eygle 2010-06-29
701
经常有用户误操作格式化硬盘,导致数据丢失,以Oracle数据库为例,格式化会损失多少数据呢?

以下是我格式化一块硬盘,创建一个1T的磁盘分区,mkfs的输出:

Disk /dev/sdb: 2089.0 GB, 2089072092672 bytes
255 heads, 63 sectors/track, 253981 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-253981, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-253981, default 253981): +1024000M

Command (m for help): p

Disk /dev/sdb: 2089.0 GB, 2089072092672 bytes
255 heads, 63 sectors/track, 253981 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      124495  1000006056   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@sms-db-b /]# mkfs /dev/sdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125009920 inodes, 250001514 blocks
12500075 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
7630 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848


Writing inode tables: .done                           
Writing superblocks and filesystem accounting information: 
done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

这期间,mkfs的输出提示最为关键,mkfs创建了7630个块组,每个Group 32768个数据块,每个Group 16384个inodes。那么这里的inodes分配的空间就应该是覆盖了原始数据的部分。

那么每个inode要分配多少空间呢?
[root@db eygle]# dumpe2fs -h /dev/sdb1|grep node
dumpe2fs 1.35 (28-Feb-2004)
Filesystem features:      resize_inode filetype sparse_super large_file
Inode count:              125009920
Free inodes:              125009909
Inodes per group:         16384
Inode blocks per group:   512
First inode:              11
Inode size:               128
这里的Inode Size 是128 Bytes,16384 * 128 / 1024 /1024 结果就是2M,7630个Block Group,就是14G左右的空间。

参考文章:
http://it.dianping.com/inode-related-conceptions-in-linux-file-system.htm


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论