« 达梦数据库与独立知识产权的自主创新 | Blog首页 | 国内数据库启蒙导师 人大萨师煊老师仙逝 »
Oracle数据恢复:格式化会损坏多少数据?
作者:eygle | 【转载请注出处】|【云和恩墨 领先的zData数据库一体机 | zCloud PaaS云管平台 | SQM SQL审核平台 | ZDBM 数据库备份一体机】
链接:https://www.eygle.com/archives/2010/07/format_lost_inodes.html
经常有用户误操作格式化硬盘,导致数据丢失,以Oracle数据库为例,格式化会损失多少数据呢?链接:https://www.eygle.com/archives/2010/07/format_lost_inodes.html
以下是我格式化一块硬盘,创建一个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这里的Inode Size 是128 Bytes,16384 * 128 / 1024 /1024 结果就是2M,7630个Block Group,就是14G左右的空间。
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
参考文章:
http://it.dianping.com/inode-related-conceptions-in-linux-file-system.htm
历史上的今天...
>> 2020-07-12文章:
>> 2018-07-12文章:
>> 2017-07-12文章:
>> 2011-07-12文章:
>> 2008-07-12文章:
>> 2007-07-12文章:
>> 2006-07-12文章:
By eygle on 2010-07-12 09:13 | Comments (4) | System | 2568 |
14G里面得包含多少数据啊,这些数据丢了之后很难再录入到系统里吧?
我觉得比较难的是不能确切知道是哪些数据损失掉了。并且一些有外键约束的表们可能会不一致。
了解应用的话,能够判断出数据损失,通常这样也是无奈之最后之举。
我觉得不应该这样算吧,每次格式化都要消耗空间的,并不一定格式化后占用的是数据的空间呀。
这计算的是最大数据损失,运气好的话,当然会损失得少一点。