Linux文件系统的反删除方法

12 06 2008

作为一个多用户、多任务的操作系统,Linux下的文件一旦被删除,是难以恢复的。尽管删除命令只是在文件节点中作删除标记,并不真正清除文件内容,但是其他用户和一些有写盘动作的进程会很快覆盖这些数据。不过,对于家庭单机使用的Linux,或者误删文件后及时补救,还是可以恢复的。

1.Ext2文件系统结构的简单介绍
在Linux所用的Ext2文件系统中,文件是以块为单位存储的,默认情况下每个块的大小是1K,不同的块以块号区分。每个文件还有一个节点,节点中包含有文件所有者,读写权限,文件类型等信息。对于一个小于12个块的文件,在节点中直接存储文件数据块的块号。如果文件大于12个块,那么节点在12个块号之后存储一个间接块的块号,在这个间接块号所对应的块中,存储有256个文件数据块的块号(Ext2fs中每个块号占用4字节,这样一个块中所能存储的块号就是1024/4=256)。如果有更大的文件,那么还会在节点中出现二级间接块和三级间接块。

2。恢复被误删文件的方法
大多数Linux发行版都提供一个debugfs工具,可以用来对Ext2文件系统进行编辑操作。不过在使用这个工具之前,还有一些工作要做。
首先以只读方式重新挂载被误删的文件所在分区。使用如下命令:(假设文件在/usr分区)
mount –r –n –o remount /usr
-r表示只读方式挂载;-n表示不写入/etc/mtab,如果是恢复/etc上的文件,就加上这个参数。如果系统说xxx partion busy,可以用fuser命令查看一下是哪些进程使用这个分区上的文件:
fuser –v –m /usr
如果没有什么重要的进程,用以下命令停掉它们:
fuser -k –v –m /usr
然后就可以重新挂载这些文件系统了。
如果是把所有的文件统一安装在一个大的/分区当中,可以在boot提示符下用linux single进入单用户模式,尽量减少系统进程向硬盘写入数据的机会,要不干脆把硬盘挂在别的机器上。另外,恢复出来的数据不要写到/上面,避免破坏那些有用的数据。如果机器上有dos/windows,可以写到这些分区上面:
mount –r –n /dev/hda1 /mnt/had
然后就可以执行debugfs:(假设Linux在 /dev/hda5)
#debugfs /dev/hda5
就会出现debugfs提示符debugfs:
使用lsdel命令可以列出很多被删除的文件的信息:
debugfs:lsdel
debugfs: 2692 deleted inodes found.
Inode Owner Mode Size Blocks Time deleted
164821 0 100600 8192 1/ 1 Sun May 13 19:22:46 2001
…………………………………………………………………………………
36137 0 100644 4 1/ 1 Tue Apr 24 10:11:15 2001
196829 0 100644 149500 38/ 38 Mon May 27 13:52:04 2001

debugfs:
列出的文件有很多(这里找到2692个),第一字段是文件节点号,第二字段是文件所有者,第三字段是读写权限,接下来是文件大小,占用块数,删除时间。然后就可以根据文件大小和删除日期判断那些是我们需要的。比如我们要恢复节点是196829的文件:
可以先看看文件数据状态:
debugfs:stat
Inode: 196829 Type: regular Mode: 0644 Flags: 0×0 Version: 1
User: 0 Group: 0 Size: 149500
File ACL: 0 Directory ACL: 0
Links: 0 Blockcount: 38
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0×31a9a574 — Mon May 27 13:52:04 2001
atime: 0×31a21dd1 — Tue May 21 20:47:29 2001
mtime: 0×313bf4d7 — Tue Mar 5 08:01:27 2001
dtime: 0×31a9a574 — Mon May 27 13:52:04 2001
BLOCKS:
594810 594811 594814 594815 594816 594817 ………………………………….
TOTAL: 38
然后就可以用dump指令恢复文件:
debugfs:dump /mnt/hda/01.sav
这样就把文件恢复出来了。退出debugfs:
debugfs:quit
另一种方法是手工编辑inode:
debugfs:mi
Mode [0100644]
User ID [0]
Group ID [0]
Size [149500]
Creation time [0x31a9a574]
Modification time [0x31a9a574]
Access time [0x31a21dd1]
Deletion time [0x31a9a574] 0
Link count [0] 1
Block count [38]
File flags [0x0]
Reserved1 [0]
File acl [0]
Directory acl [0]
Fragment address [0]
Fragment number [0]
Fragment size [0]
Direct Block #0 [594810]
…………………………….
Triple Indirect Block [0]
使用mi指令后每次显示一行信息以供编辑,其它行可以直接按回车表示确认,把deletion time改成0(未删除),Link count改成1。改好后退出debugfs:
debugfs:quit
然后用fsck检查/dev/hda5
fsck /dev/hda5
程序会说找到丢失的数据块,放在lost+found里面。这个目录里的文件就是我们要的东东。
Related Topics:




Oracle数据库安全性管理基本措施简介

24 05 2008

数据安全性是指保护数据以防止非法的使用,避免造成数据有意或无意的丢失、泄露或破坏。由于数据库系统中集中存放有大量的数据,这些数据又为众多用户所共享,所以安全约束是一个极为突出的问题。

Oracle数据库系统在实现数据库安全性管理方面采取的基本措施有:

◆通过验证用户名称和口令,防止非Oracle用户注册到Oracle数据库,对数据库进行非法存取操作。

◆授予用户一定的权限,例如connect,resource等,限制用户操纵数据库的权力。

◆授予用户对数据库实体(如表、表空间、过程等)的存取执行权限,阻止用户访问非授权数据。

◆提供数据库实体存取审计机制,使数据库管理员可以监视数据库中数据的存取情况和系统资源的使用情况。

◆采用视图机制,限制存取基表的行和列集合。

在实际应用中,许多系统往往采用假用户(即非数据库用户)身份来管理,而真实用户的身份和登录口令就隐藏在应用系统中,或经过各种压缩加密等处理的配置文件中。但这样往往留下隐患,只要从分析应用程序入手,最终会分析出系统使用的数据库用户和口令,那么其安全性也就消失了。另一方面,系统代码是程序员写出来的,如果程序员有破坏意图,这种模式没有一丝的安全,因为他通过自己掌握的代码不经分析就轻而易举的获得登录用的数据恢复库用户和口令。

而采用真实数据库用户,存在着权限分配上的难度,特别是用户数和应用表数都很多时,这时必然要使用角色来管理应用权限的分配。当然不能直接将权限或角色直接分配给用户,否则用户可以不同过应用系统,而采用SQL*PLUS等前端工具进入系统,进行一些没有经过应用系统检查的操作,产生的结果可能不符合应用逻辑。

我们在实践中发现,可以采用另一种方式利用角色功能,来防止上面出现的安全“漏洞”。在这种方式下,用户采用自己的标识和口令注册,但在未得到授权的角色前,是没有操纵数据库的任何权限。而授权用户使用的角色是埋在应用程序中的,只有应用程序才知道角色的名称和口令,从而激活角色,使用户拥有相应的权限。在应用系统之外,用户可以连接到Oracle,但没有激活相应的角色,他是不能做任何事情的,而开发人员不知道用户的标识和口令,他没有办法登录到Oracle,即使他能够推算出角色的标识和口令。
累啊,打了半天字,手都麻了。 好累,歇歇再说。。。。。 好累,歇歇再说。。。。。 欲知后事如何,且听下回分解。 休息再来接着说。 歇会儿再来继续说… 刚才有事离开了,接着讲。 以下继续。
下面根据一个例子给出具体的实现过程:

我们假设用户xiayan在工作中能够对工资表account.paytable(account是表paytable的拥有者)有查询和更新的权限,而这些权限我们不直接授予xiayan,而是构造一个角色(比如考勤员checkerrole),这个角色恰好适合于xiayan,再将角色授予xiayan,但角色在激活时需要口令,该口令不对xiayan公开。每个用户需要一个缺省的角色,是用户连接到Oracle时的缺省角色。这个角色只有connect权限,我们假为defaultrole。

下面给出具体的操作SQL。

(1)设定各种角色及其权限

CREATE ROLE checkerrole IDENTIFIEDBYxm361001; CREATE ROLE defaultrole IDENTIFIEDBYdefaultrole; GRANTSELECT,UPDATEONaccount.paytableTOcheckerrole; GRANTCONNECTTOdefaultrole;

(2)创建用户

CREATEUSERxiayanIDENTIFIEDBYxiayan;

(3)授权

GRANTcheckerroleTOxiayan; GRANTdefaultroleTOxiayan;

(4)设定用户缺省的角色

ALTERUSERxiayanDEFAULTROLEdefaultrole;

(5)注册过程

CONNECTxiayan/xiayan@Oracle

此时用户只有其缺省角色的权限。

(6)激活角色

SETROLEcheckerroleIDENTIFIEDBYxm361001;

操作成功后,xiayan拥有checkerrole的权限。

这里的角色和口令是固定的,在数据恢复应用系统中可以由应用管理人员自行设置则更为方便安全。

Related Topics:




Database Connectivity with ASP and ADO

10 05 2008

ASP uses a technology called ActiveX Data Objects (ADO) to work with databases. ADO is ActiveX technology which is built into the Internet Information Server (IIS). It is comprised of a number of objects which you can use. I will begin by explaining the “major players” briefly. There are 3 major objects which you should be aware of in ADO: the Command Object, the Connection Object, and the Recordset object. Most of the time, you will only have to work with the RecordSet object (arguably), but in certain cases, you may want to set properties in (or use) one or both of the other 2 objects. Whenever you perform a database operation, these 3 objects are present, but it isn’t necessary often to explicitly create all 3, as when one is used, the other 2 are implicitly created, even though you may not assign a variable to access them. The syntax for creating a variable to access these objects is (in VBScript) “[variable name] = Server.CreateObject(”ADODB.[object name]“)” The RecordSet Object The RecordSet object is basically a cursor (a temporary table which exists in memory) with some built-in functions and properties for working with the records contained in it. You can create a RecordSet object explicitly, or by executing a command through the Command Object. Some of the properties which you may use frequently are: BOF - Beginning of file EOF - End of file MaxRecords - Maximum number of records returned in a query RecordCount - The number of records in the RecordSet CursorType - Forward-only, static,dynamic, and keyset Some of the methods (functions) of the RecordSet object which you may be most likely to use are: Open - Open the Recordset Close - Close the RecordSet Move - Move to a specific record MoveFirst - Move to the first record MoveNext - Move forward one record Move Previous - Move backwards one record MoveLast - Move to the last record AddNew - Add a new record to the RecordSet Update - Update the current record The Command Object The Command Object is the workhorse of ADO. It is the object which commands the database, whether it’s issuing an SQL statement, or executing a stored procedure contained in the database itself. using the Command Object, you can create parameterized queries, which can be altered on the fly. You can change the query being issued, and change the properties of the Command Object itself. There are far less properties of a Command Object than a Recordset object. In fact, you’re only likely to use the following , if any: CommandText - The actual text of the command, such as a SQL statement ActiveConnection - The associated Connection Object. There are only 2 methods for a Command Object. They are: CreateParameter - Create a parameter for a query in the Parameters Collection Execute - Execute the Command The Command Object also has a collection called the Parameters Collection. This is where parameters are organized for parameterized queries. Parameters have properties as well, and can be accessed either by their position in the Parameters Collection (index), or by name. You can use parameters in your SQL statements by inserting question marks for each parameter used. The parameters must first be defined, and their values will be substituted in the query in the order they appear in the collection. If you wish to use parameterized queries, you might want to read up some more on this subject, but I don’t want to take all day. The Connection Object The Connection Object is the object which actually does the “talking” with the database. It defines the connection type, and properties too numerous to mention. It may contain a System DSN name which is used to identify the ODBC driver and path to the database. I may contain the physical path to the database. It can also store user name and password information which is used to gain access to a secure database. And it can fine-tune the connection in other ways as well. The Command Object and RecordSet object actually access the database through the Connection Object. However, it isn’t often necessary to use this object, as it can be implicitly created by the RecordSet Object (my favorite method), and the default values for the many properties are usually fine to work with. The single most important and most-often used property of the Connection Object is the ConnectionString property. If you have used IDC (Internet Database Connector) before, you’re familiar with identifying the System DSN. This is handled in the ConnectionString Property, as well as some other properties as well. The ConnectionString property is defined by a string of property definitions (name/value pairs) separated by semicolons. Here is an example: “DSN=jobs;DBQ=C:\AOL30A\download\San Diego Jobs\jobs.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5;” You’ll notice that the System DSN is the first item identified, followed by the “DBQ” (the physical location of the database). Other properties are defined as well. This Connection String was “borrowed” from a global.asa file created automatically by Microsoft Visual InterDev. However, you’ll find that in the vast majority of cases, it isn’t necessary to define all of these (and/or more) properties of the Connection object. In fact, I’m going to show you a simple way to use ADO to do most of your routine database stuff, and you can forget most of what you’ve read here (unless you need to do something fancy). The following is a demonstration of some simple VBScript to execute a SELECT statement. You can even copy and paste this into your own ASP pages if you wish. We’ll begin with the assumption that the user has filled out a form containing a single field called “lastname.” They are looking up personnel records in a table called “personnel,” and want to find all records with a “lastname” field containing the name they’ve typed in in the form. A System DSN has been set up using the 32-Bit ODBC Driver Administrator, by the name of “mydsn.” If you’ve read my earlier articles about ASP, you remember that to obtain the value of a form field, you use the ASP Request.Form Object, and name the field. So, without any further ado, let us proceed with the code: A Simple ASP ADO SQL Query Set rs = Server.CreateObject(”ADODB.RecordSet”) param = Request.Form(”lastname”) q = “SELECT * FROM personnel WHERE lastname LIKE ‘” & param & “‘” rs.Open q, “DSN=mydsn;” if NOT rs.EOF then while NOT rs.EOF Response.Write rs(”firstname”) & ” ” & rs(”lastname”) & “
” rs.MoveNext wend end if A Simple Explanation of A Simple ASP ADO SQL Query Line 1. Create Recordset object Line 2. Place form field value in a variable named “param” Line 3. Define query by concatenating strings and variable value Line 4. Open RecordSet Object. Note that the first parameter is the Command Text. The second parameter is the Connection String. The Command Object and Connection Object are created implicitly. Line 5. Make sure the RecordSet isn’t empty Line 6. Begin executing a loop which goes through all records in the RecordSet. Line 7. Write each record’s “firstname” and “lastname” fields to the page on a separate line. Line 8. Move to Next Record. 好累,歇歇再说。。。。。 刚才有事离开了,接着讲。
Related Topics:




SQL2000数据库导出和导入教程

10 05 2008

一、导出导入SQL Server里某个数据库
  1.在SQL Server企业管理器里选中要转移的数据库,按鼠标右键,选所有任务->备份数据库。
  2.备份 选数据库-完全,
  目的 备份到 按添加按钮
  文件名 在SQL Server服务器硬盘下输入一个自定义的备份数据库文件名(后缀一般是bak)
  重写 选重写现有媒体
  最后按确定按钮。
  如果生成的备份数据库文件大于1M,要用压缩工具压缩后再到Internet上传输。
  3.通过FTP或者remote desktop或者pcanywhere等方法
  把第二步生成的备份数据库文件或者其压缩后的文件传到目的SQL Server数据库,如果有压缩要解压。
  4.目的SQL Server数据库如果还没有此数据库,先创建一个新的数据库;
  然后选中这个新创建的数据库,按鼠标右键,选所有任务->还原数据库
  还原->从设备->选择设备->磁盘->添加(找到要导入的备份数据库文件名)->确定
  还原备份集->数据库-完全
  最后按确定按钮。完全的数据库导入成功了。
  (如果在已经存在的SQL Server数据库上还原数据库可能遇到有还有其它人正在使用它而恢复操做失败,
  可以去看 ->管理->当前活动->锁/对象->找到数据库下锁的进程号->到查询分析器里用kill 进程号杀掉这些锁,然后再做还原)
  注意:如果在原有的目的SQL Server数据库上从备份文件(*.bak)还原数据库会把已经存在的表、存储过程等数据库对象全部替换成最近这次导入的备份数据库里的内容。
  如果一定要还原备份文件(*.bak)里部分数据,需要另外建一个新数据库,其逻辑名称和数量同备份文件(*.bak)里数据库的逻辑名称和数量一致;
  新数据库的物理文件名称取得一定要和备份文件(*.bak)里数据库的物理文件不一样才行。
  二、导出导入SQL Server里某个表
  1.没有防火墙,同一个局域网里或不在同一个局域网里,但通过Internet可以互相访问
在SQL Server企业管理器里选中目的数据库 ,按鼠标右键,选所有任务->导入数据-> 弹出数据转换服务导入/导出向导窗口->下一步->选数据源-> 数据源(用于SQL Server的Microfost OLE DB提供程序)->服务器(可选择局域网内能访问到的所有SQL Server服务器,或者直接输入IP地址)->选择使用windows身份验证还是使用SQL Serve身份验证(输入数据库的用户名和密码)->数据库(可选择上面选中SQL Server服务器上所有权限范围内的数据恢复数据库)->下一步->选择目的->目的(用于SQL Server的Microfost OLE DB提供程序)->服务器(默认为上一步里选中的导出服务器,也可以选其它局域网内能访问到的所有SQL Server服务器,或者直接输入IP地址)->目的数据库(可选择上面选中SQL Server服务器上所有权限范围内的数据库)->下一步->制定表复制或查询->选从源数据库复制表和视图(也可以选择用一条查询指定要传输的数据)->下一步->选择源表和视图->在要导入的表和视图前面选中源->目的出现同样的表名(可以手工修改成别的表名)->转换->列映射和转换里面可以修改源表和目的表之间字段的对应关系,修改目的表字段的类型和长度等,并可以选择创建目的表,在目的表中增加行,除去并重新创建目的表,启用标志插入等选项->确定->下一步->保存、调度和复制包->时间->立即运行(如果要实现隔一段时间自动导出导入数据,选调度DTS包以便以后执行)->保存(可以不选)->[ 保存DTS包(如果以后还要转移这批相同的数据,可以把本次导出导入的内容和步骤保存起来,存到SQL Server即可,保存的时候要输入DTS的包名及详细描述)->下一步-> ]->完成
  正在执行包->图形界面显示创建表及插入记录的步骤和状态->完成
刚才有事离开了,接着讲。 好累,歇歇再说。。。。。
  2.经过防火墙,不在同一个局域网里
  ①、导出表里的数据到文本文件:
  在SQL Server企业管理器里选中目的数据库,按鼠标右键,选所有任务-> 导入数据->弹出数据转换服务导入/导出向导窗口->下一步->选数据源-> 数据源(用于SQL Server的Microfost OLE DB提供程序)->服务器(可选择局域网内能访问到的所有SQL Server服务器)->选择使用windows身份验证还是使用SQL Serve身份验证(输入数据库的用户名和密码)->数据库(可选择上面选中SQL Server服务器上所有权限范围内的数据库)->下一步->选择目的->目的(文本文件)-> 文件名(在自己的电脑硬盘中生成一个自定义的文本文件) ->下一步->制定表复制或查询->选从源数据库复制表和视图(也可以选择用一条查询指定要传输的数据)->下一步->选择目的文件格式->源(选择要导出的表)->用默认的带分隔符->选第一行包含有列名称选项->下一步->保存、调度和复制包->时间->立即运行(如果要实现隔一段时间自动导出到文本文件,选调度DTS包以便以后执行)->保存(可以不选)-> [保存DTS包(保存的时候要输入DTS的包名及详细描述)->下一步->]->完成
  正在执行包->图形界面显示表到文本文件的步骤和状态->完成
  如果生成的文本文件大于1M,要用压缩工具压缩后再到Internet上传输。
  ②、通过FTP或者remote desktop或者pcanywhere等方法把
  第①步生成的文本文件或者其压缩后的文件传到目的SQL Server数据库,如果有压缩要解压。
  ③、把文本文件导入目的SQL Server数据库
  直接把文本文件导入目的SQL Server数据库里跟文本文件同名的新表名时,默认的会把所有字段类型都变成字符串。
所以我们要这样做:
在源SQL Server数据库上先生成创建表的sql语句
在SQL Server查询分析器里->选中源数据库里表名->按右键->在新窗口中编写对象脚本->创建->复制下新窗口内创建表名的sql语句到目标SQL Server数据库上查询分析器里执行创建表名的sql语句,生成空表结构。(如果已经存在这样的表名,修改建表的sql语句,在表名后面加上导入时间的年月信息,例如table_0113)
  调用导入/导出工具->弹出数据转换服务导入/导出向导窗口->下一步->选数据源-> 数据源(文本文件)->文件名(已传到目的SQL Server数据库下要导入的文本文件,后缀可以不是*.txt,但是常规文本编辑器能打开的文件,文件类型选全部)->下一步->选择文件格式->用默认的带分隔符->选第一行包含有列名称选项->下一步->制定列分割符->逗号->下一步->选择目的->目的(用于SQL Server的Microfost OLE DB提供程序)->服务器(可选择目标局域网内能访问到的所有SQL Server服务器)-> 选择使用windows身份验证还是使用SQL Serve身份验证(输入数据库的用户名和密码)->数据库(可选择上面选中SQL Server服务器上所有权限范围内的数据库)->下一步->选择源表和视图->修改目的表名为刚才创建的表名->转换(在目的表中追加行) ->下一步->保存、调度和复制包->时间->立即运行(如果要实现隔一段时间自动把文本文件导入,选调度DTS包以便以后执行)->保存(可以不选)-> [保存DTS包(保存的时候要输入DTS的包名及详细描述)->下一步->]->完成
  正在执行包->图形界面显示文本文件到表的步骤和状态->完成
如果要更改导入时间的年月信息的表名,例如table_0113到原来的表名,在企业管理器里把原来的表名改成table_old_0113,table_0113改名成table。这会对应用程序里频繁访问的表照成一定的中断。
  注意:源表上的建的索引和主键约束不能用上面介绍的1和2方法转移过来,还需要手工来建索引和主键。
  标志种子和not null的约束可以继承过来。
  导入视图时会把源视图里所有的真实数据导入成一个新表,而不是视图。
  三、SQL Server存储过程或用户定义的函数导出导入
  1、导出存储过程或用户定义的函数成*.sql文件
  在SQL Server企业管理器里选中源数据库,存储过程->单选或者多选中要转移的存储过程->用户定义的函数->单选或者多选中要转移的函数->按鼠标右键,选所有任务->生成SQL脚本->确定->在自己的电脑硬盘中生成一个自定义的*.sql文件->保存->正在生成SQL脚本->成功
  2、如果目的数据库经过防火墙,不在同一个局域网里,要通过FTP或者remote desktop或者pcanywhere等方法把第1步生成的*.sql文件传到目的SQL Server数据库服务器上。
  3、用查询分析器进入SQL Server目的数据库,从菜单里选文件->打开->打开查询文件->选中第1步生成的*.sql文件->点执行查询的绿色倒三角型快捷键->查询窗口里会出现执行后的消息(有时候可能因为存储过程和用户定义的函数之间有一定的依赖关系,会报一些错。
  最好先执行用户定义的函数的*.sql文件,再执行存储过程的*.sql文件)
  四、ORACLE数据库里表导入SQL Server数据库
  1、在目的SQL Server数据库服务器上安装ORACLE Client软件或者ORACLE ODBC Driver. 在$ORACLE_HOME\network\admin\tnsnames.ora里配置ORACLE数据库的别名(service name)。
  具体配置方法可以参考本站文章:客户端连服务器的注意事项
  2、在WIN2000或者win2003服务器->管理工具->数据源(ODBC)->系统DSN(本机器上NT域用户都可以用)->添加->ORACLE ODBC Driver->完成->data source name 可以自定义,我一般填ORACLE数据库的sid标志,description里可以填ORACLE数据库详细描述,也可以不填->data source service name 填第1步定义的ORACLE数据库别名->OK。
  (用户DSN和文件DSN也可以类似配置,但使用的时候有一些限制)
  3、SQL Server的导入和导出数据工具里->选数据源-> 数据源(其它(ODBC数据源))->选第2步在ODBC里定义的系统DSN source name,用户名密码处填写ORACLE系统的用户名和密码->下一步->选择目的,选SQL Server数据库(跟上面第二点讲的数据恢复一致,就不重复了)。
  注意:在ORACLE表和SQL Server表之间’转换’那步很重要,可以改变默认的字段数据类型,如image->text,decimal->int
  五、SQL Server数据库里表导入ORACLE数据库
  方法一.导出目的选通过ODBC数据源里定义的ORACLE数据库, 注意ORACLE里表名都是大写的.我一般在ORACLE这边先生成好表结构,再选择SQL SERVER源表往ORACLE目的表里追加数据.数据传输速度比方法二慢.
  方法二.从SQL Server数据库导入数据到ORACLE数据库可以选择用Windows下ORACLE9i企业或者个人版数据库做中转。

歇会儿再来继续说… 以下继续。

Related Topics:




CIH硬盘数据恢复方法与实例

8 05 2008

一、基础知识

  1、DOS(DOS兼容系统硬盘数据)的构成
  
  主分区和扩展分区结构基本相似,以下以主分区为例。
  
  主引导记录(MBR):MBR占一个扇区,在CYL 0、SIDE 0 、SEC 1,由代码区和分区表构成。其中代码区可以由FDISK/MBR重建。
  
  系统扇区:CYL 0、SIDE 0 、SEC 1-CYL 0、SIDE 0 、SEC 63,共62个扇区。
  
  引导区(BOOT):CYL 0、SIDE 1 、SEC 1 这是我们过去称的DOS引导区。也占一个扇区。
  
  隐藏扇区:CYL 0、SIDE 0 、SEC 1,如果是FAT16那么占一个扇区,如果是FAT32则由此占32个扇区。
  
  文件分配表:一般有两个FAT表,FAT12、FAT16的第一FAT表一般均在0-1-2,FAT32的第一FAT表在0-1-33。FAT表是记录文件占用扇区连接的地方,如果两个FAT表都坏了,后果不堪设想。由于FAT表的长度与当前分区的大小有关所以FAT2 的地址是需要计算的。
  
  根目录区:(ROOT)这里记录了根目录里的目录文件项等,ROOT区跟在FAT2后面。
  
  数据区:跟在ROOT区后面,这才是数据内容。
  
  2、主引导记录简单说明
  
  主引导记录是硬盘引导的起点,关于代码区不多说了,其分区表,比较重要的是2个标志,在偏移1BE,处的80 的标记表示系统可引导,且整个分区表只能有一个80标记。 另一个就是结尾的55 AA标记。用来表示主引导记录是一个有效的记录。
  
  其实,无论MBR还是隐含扇区还是BOOT区,都不重要,这些重建都比较容易。对数据恢复来说,能否成功的找回数据文件是重要的。另外,由于FAT表记录了文件在硬盘上占用扇区的链表,如果2个FAT表都完全损坏了。那么恢复文件,特别是占用多个不连续扇区文件就相当困难了。
基本思路是:
  
  1、FAT2没有损坏的情况,用FAT2覆盖FAT1。
  
  2、FAT2也已经损坏的情况,我一般是只期待找回其中某些关键的文件了。我们最期待的是这些文件是连续的。如果不连续的话,也并非没有可能,但这往往还要知道文件的一些细节,包括对一些文件本身的连接结构有了解。如果FAT2没有完全破坏,是有一定用处的,另外,一般来说,FAT16的硬盘因为FAT表靠前破坏的比较严重,一般两个FAT表都坏了,小硬盘也很难做数据恢复了。
  
  二、一个基本恢复被CIH破坏硬盘数据的例子
  
  一直有朋友问手工恢复的技巧,近来恢复了多块被CIH破坏的硬盘,之所以选取这一次,是因为尽管恢复成功,但其中犯了一些错误,值得注意。
  
  委托恢复用户:某银行系统
  
  硬盘情况:CIH发作有该单位电脑人员曾用KV300 F10进行修复,但没有成功,又恢复了保存的MBR。
  
  准备好软盘3张:

  DISK1 :WIN98启动盘(带DEBUG)
  
  DISK2:DISKEDIT等工具(此盘不要写保护)
  
  DISK3:DOS下杀CIH的工具
  
  把我的硬盘摘下,挂上待恢复的的硬盘,开机,进入SETUP,检测硬盘,把参数记下。
  
  CLY 620 HEAD 128 PRECOMP 0 LANDZ 4959 SECTOR 63 MODE LBA。
  
  用准备好的软盘启动:
  
  A:>C:
  
  显示Invalid drive specification
  FDISK/MBR重建主引导记录(这是个习惯),重新软盘引导(可能没有必要):此时已经看的见C:硬盘。启动DISKEDIT,启动过程中显示Invalid media type reading DRIVER C,哎呀,算了,还是先用DEBUG 清空分区表, 并置80和55aa标志。重新启动,再运行DISKEDIT,显示设定为READ ONLY, 没关系,把CONFIGURATION中的只读选项去掉,存盘,好了,可以编辑了。
  
  由于当时接的硬盘有多块,我把这块当成了是一块只有C分区(这是等待修复的另一块硬盘),所以没看别的东西,我们期待FAT2没有损坏,以用FAT2覆盖FAT1,在这个时候DISKEDIT要比DEBUG容易的多,在FIND OBJECT中选择 FAT,查一下起始扇区,好的,在CYL 0 SIDE68 SEC 14,0000H,F8 FF FF 0F (FAT32的),好的,FAT2没坏。其实如果不用DISKEDIT的可以用DEBUG查,偏移0000的F8 FF FF。
  
  由于以为只有C分区,所以,上来就在FIND中查找IOSYS(IO 和SYS中要有空格)以查找ROOT区。找到后观察,是否有C:\ 下常见文件。好的,ROOT区没被破坏。记下了该扇区:CYL 0 、SIDE 68 、SEC 14,备用。
  
  FAT1一般前面已经被破坏了,但后面应该还在,这可以作为检查。因为是32位的,FAT1 一般在CYL 0 SIDE1 SEC 33。 因为有了ROOT 区然后应该计算FAT表的长度了,因为FAT2到ROOT前一扇区为止,所以非常简单。然后可以用FAT2覆盖FAT1,这里用DEBUG还是DISKEDIT都可以,如果用DEBUG一般是用INT 25读绝对扇区,再用INT 26写入,不过一般要分几次。记得保留断点呀:-)用DISKEDIT可以MARK FAT2的内容COPY下来,在WRITE到FAT1。
  
  然后可以恢复主引导记录、隐含扇区和BOOT区,可以先用NDD修复分区表,然后可以考虑用标准覆盖法,如果你希望下一步由NORTON Utilities ,来接手这些都可以不做。我从另一台FAT32上取来了,相应的部分,写了进去。我这是发现好象有一个D盘。先看一下在说吧。好了,关机串上我的硬盘,用NORTON Utilities扫描C盘,文件基本数据恢复,对C盘杀毒,WHY,没有发现病毒,换了2种杀毒软件还是没有病毒,更糟糕的是,显示C盘是948M,有一个D盘,但是95下无法浏览,DOS 下乱码。于是打电话核实当时的情况,原来是26日那天,放进一张光盘,光驱灯亮了一会,就硬盘狂响,蓝屏死机了。应该证实我的推断一样,是光盘的AUTORUN程序有CIH病毒。所以说没有实时防御能力的软件是没有意义的。另外,他们的硬盘确实分两个区,而且重要文件在D区。(气死我了!)
  
  然后在修复D盘吧,再回到DOS,用DEBUG查找结束标志为55AA 的扇区,由结构判定是否为扩展分区。此时可算出大小来返主分区表。当然,许多工具也可以很好的完成这一工作。如果你没有把握,就用他们完成好了。
  经验总结
  
  1、你不要听信或者凭记忆想一块硬盘该是怎么样的,一定要自己去看,我就是犯了这个错误。
  
  2、KV300 F10确实如一些网友所讲,有一定隐患,如果银行的电脑人员在用KV300 F10处理之前没有备份,可能要给我找些麻烦。
  
  3、恢复数据要本着几项原则:

   a、先备份,这也是而后我写HD-MIRROR的原因;

   b、优先抢救最关键的数据;

   c、在稳妥的情况下先把最稳定的鸡蛋捞出来(理应先修复扩展分区,再修复C),最好修复一部分备份一部分;

   d、要先作好准备,不要忙中出错,由于我的机器没有装过NORTON,先解压,习惯的敲了一个D:\TEMP,这才想起来文件险些解在没有完全修好的C盘上。
  
  其实看来,如果FAT2没有损坏的情况下,恢复C盘数据是非常容易的,可以编程实现。如果FAT2损坏了,最容易恢复的当然是只占用一个扇区的文件和连续的文件。
Related Topics:




trying to repair recover xfs filesystem after system crash

5 05 2008

A couple weeks ago my system powered down suddenly.  One XFS filesystem was
affected somehow and I have not been able to repair it with xfs_repair. 
xfs_repair immediately freezes when I run it and gives no output.  The same is
true for xfs_check.  xfs_info gives the following:

think# xfs_info -t /etc/fstab /usr/local
meta-data=/usr/local             isize=256    agcount=8, agsize=103950 blks
         =                       sectsz=512  
data     =                       bsize=4096   blocks=831600, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=0
naming   =version 2              bsize=4096  
log      =internal               bsize=4096   blocks=1200, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0

I have just upgraded to Linux kernel 2.4.21 patched with the latest xfs
1.3pre5 patch and xfsprogs 2.5.4

Below is the kernel output at boot time:

Aug  7 21:38:03 think kernel: XFS mounting filesystem ide0(3,4)
Aug  7 21:38:03 think kernel: Starting XFS recovery on filesystem: ide0(3,4)
(dev: 3/4)
Aug  7 21:38:03 think kernel:  printing eip:
Aug  7 21:38:03 think kernel: c01a58df
Aug  7 21:38:03 think kernel: Oops: 0000
Aug  7 21:38:03 think kernel: CPU:    0
Aug  7 21:38:03 think kernel: EIP:   
0010:[xlog_recover_do_reg_buffer+207/400] 
   Not tainted
Aug  7 21:38:03 think kernel: EFLAGS: 00010202
Aug  7 21:38:03 think kernel: eax: 00000100   ebx: 0000006a   ecx: 00000040 
 edx: d7ee2c60
Aug  7 21:38:03 think kernel: esi: 00000000   edi: d79ec500   ebp: 00000002 
 esp: d75dbb2c
Aug  7 21:38:03 think kernel: ds: 0018   es: 0018   ss: 0018
Aug  7 21:38:03 think kernel: Process mount (pid: 84, stackpage=d75db000)
Aug  7 21:38:03 think kernel: Stack: d7ee2d94 0000000a 0000006a 00002205
00001000 0000000a d7ee2d94 00000003 
Aug  7 21:38:03 think kernel:        d7ee2d80 d7a62540 00000000 00000000
c01a5fe
a d746ec00 d7ee2c60 d7a62540 
Aug  7 21:38:03 think kernel:        d7ee2d80 00002205 d7a78560 00000000
d746ec0
0 d7ee2c60 00000000 d7c89580 
Aug  7 21:38:03 think kernel: Call Trace:   
[xlog_recover_do_buffer_trans+602/8
16] [xlog_recover_do_trans+372/384] 
[xlog_recover_commit_trans+63/80] [xlog_recover_process_data+237/544]
[xlog_do_r
ecovery_pass+656/2784]
Aug  7 21:38:03 think kernel:   [fbcon_vbl_handler+160/176]
[xlog_do_log_recover
y+147/192] [xlog_do_recover+59/352] 
[xlog_recover+227/256] [xfs_log_mount+145/256] [xfs_mountfs+1664/3680]
Aug  7 21:38:03 think kernel:   [__down_failed+8/12]
[pagebuf_iostart+108/176] [
xfs_readsb+464/560] [xfs_setsize_buf
targ+61/128] [xfs_ioinit+30/64] [xfs_mount+718/1024]
Aug  7 21:38:03 think kernel:   [vfs_mount+67/80]
[linvfs_read_super+141/448] [a
lloc_super+58/352] [check_disk_chang
e+72/144] [get_sb_bdev+395/592] [get_fs_type+44/128]
Aug  7 21:38:03 think kernel:   [do_kern_mount+289/320]
[do_add_mount+147/400] [
do_mount+352/432] [copy_mount_option
s+121/208] [sys_mount+177/224] [system_call+51/56]
Aug  7 21:38:03 think kernel: 
Aug  7 21:38:03 think kernel: Code: f3 a5 a8 02 74 02 66 a5 a8 01 74 01 a4
ff 44
 24 1c 01 eb e9 

– 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
————————————————–
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post

Related Articles:




医疗集团容灾备份解决方案

4 05 2008

医疗集团容灾备份解决方案
自2003年以来,短短的两年间,杰斐逊城市医疗集团(Jefferson City Medical Group,简称JCMG)将堆积如山的杂乱无章的书面病历清理出来,存入其新创建的电子医疗记录数据库内。这虽然是一项宏大的工程,进展一直非常顺利,直到去年秋天,以“卡特里娜”为首的系列飓风陆续登陆佛罗里达州,让JCMG心有余悸。毕竟,其总部所在的密苏里州也是重灾区之一。飓风过后,JCMG的相关负责人充分意识到容灾恢复(DR)解决方案的重要性。因此,在搭建新的存储系统时,JCMG决定调整现有的DR机制。 “之前,我们使用的备份介质一直是以磁带为主,”该机构的信息服务部主管Phil Hartman介绍说,“但是在飓风肆虐期间,我们开始学会思考一些以前从来没有想过的问题,比如说,如果整座办公大楼都沦为废墟,我们该怎么办?在这种情况下,我们该如何”抢救“整个系统,而不是仅仅找回损耗的数据。”JCMG在密苏里州圣路易斯市设立的附属医院现拥有65位医生和护士。
JCMG的EMR数据库供应商——A4 Health Systems在美国南卡罗来纳州哥伦比亚市设立了一个远程备份站点,灾难期间,用户仍可以通过互联网访问和调用该站点的数据。
“如果我们根本上不了网,那该怎么办?”Hartman反问道,“比如说,整幢办公大楼都被夷为平地,我们不得不被暂时安置在学校体育馆内避难。没错,即使在这种时候,我们仍然有办法弄到电脑,但是,是否能够及时地搞到符合我们的配置要求的计算机设备,那可就成问题了。如果我们无法为医疗记录数据建档,就无法为病人治疗,这样一来,麻烦可就大条了,尤其是在灾难肆虐的敏感时期。”
于是乎,一切又回到了原点,JCMG决定就近寻找一家代理商,将几台硬件设备托付给它管理,一旦发生紧急情况,也方便工作人员前往取用。一家来自密苏里州哥伦比亚市的存储增值转售商——Integrated Solutions Group进入了JCMG的视野,该公司同意为JCMG总容量为500GB的HP ProLiant DL580 Windows服务器系统数据恢复制作一个副本,存放在自己的容灾备份站点内。
“这实际上是为我们的存档数据加多了一道保护屏障,”Hartman介绍说。
Integrated Solutions Group将NSI Software公司的DoubleTake复制软件推荐给JCMG,该工具可遵从HIPAA法规的相关要求传输数据和配置设定。另外,T1连接的一端接入了思科公司的PIX Firewall安全专用设备,为传输的数据提供防火墙保护,并进行加密处理。
“没有十全十美的解决方案”
拓展在线EMR应用,意味着JCMG将不得更换现有的HP SAN系统,并随着日常存储需求的增长不断添置新的设备。
同时,这也意味着DoubleTake软件今后将面临更大的工作负荷。据Hartman透露,实际上他们每天使用DoubleTake软件复制数据所需的时间,都会较前一天多上10~15分钟。
“好在我们的系统不必像那些大医院一样,必须保证1周7天/1天24小时的连续运转。晚上,医院停止营业后,我们就可以关起门来专心致志地备份数据啦,”Hartman表示。
不过,Hartman也承认,这种数据备份方式并不适合那些规模较大型的医疗机构,尤其是在灾难期间,远程访问备份服务器时极有可能会遇上流量“瓶颈”。
“我们通过一个带宽为1GB的局域网,访问连接着服务器的T1接口,而事实上,这台服务器的容量只有我们原来的服务器的一半,”Hartman表示,“不过,速度慢归慢,总比没有强吧——市面上暂时还找不到完全符合我们要求的解决方案。”
另外,Hartman还表示,JCMG目前不得不依赖Symantec的LiveState软件来备份他们的HP服务器所发生的一切变更。
“事实上,我们并没有必要这么干,”Hartman介绍说,“但为了保险起见,我们愿意将它(注:数据恢复和服务器配置)封装在一个包里。”
NSI努力提升DoubleTake的性能
有消息称,NSI推出的最新版本的DoubleTake软件,添加了备份虚拟机的复制功能。而且,不久之后,该公司还将面向大型企业用户推出一个新的模块——DoubleTake Application Manager.
之前安装了完整版DoubleTake软件的企业用户,可免费下载Application Manager.该工具可以让程序管理员们提前体验到对应Exchange应用或SQL server的标准版本。前者现已投放市场,而后者将于今年的晚些时间推出。
“我们认为该工具将有助于舒缓应用管理的混乱状况,”NSI的解决方案工程部负责人Bob Radebush表示,“即使是不熟悉DoubleTake软件的使用方法的用户,也可以独立搞定备份操作的各项设定。”


Related Articles:




Recovering Lost Data From Novell

4 05 2008

Recovering Deleted/Lost/Missing Data From Novell Servers
This paper discusses data loss from Novell server disks along with methods to recover and restore the lost data.
Effective recovery of lost data requires an understanding of data management techniques used by NetWare …quot; this includes understanding NetWare file systems and NetWare volume types. Basic awareness about various data loss scenarios along with NetWare’s built-in defense mechanisms against data loss is also required.
In instances of data loss, it is recommended that the affected server disk not be used further and be immediately disconnected…quot; the correct way to recover data from failed disks is to connect these disks to healthy working disks and initiate the recovery process from the healthy disks. Thorough knowledge on the connection of such disks is a must during a recovery process.
Finally, robust data recovery software is needed to ensure complete and effective recovery.
This document is a discussion on all of the above. A generic description about the working of data recovery software is also outlined, followed by a short case study (using Stellar Phoenix Novell) to help users better understand the recovery process. This document assumes that the reader has little or no knowledge of data recovery and only very basic knowledge of Operating Systems, hard disks and NetWare.
Table of Contents
Data Management in Novell NetWare
1.1 NetWare server disks and file systems
1.2 NetWare Volume types
1.3 How data gets lost
1.4 Data recovery methods provided by NetWare & its limitations
Setting up the hardware (for a recovery process)
2.1 Basic Do’s and Don’ts
2.2 Connecting IDE disks
2.3 Connecting SCSI disks
2.4 Finishing up
Using data recovery software (Stellar Phoenix Novell)
3.1 How data recovery software work
3.2 Case Study …quot; Using Stellar Phoenix Novell to recover data
3.2.1. How to recover deleted files
3.2.2. How to recover missing/lost NetWare partitions
3.2.3. How to recover compressed volumes
Conclusion

1. Data Management in Novell NetWare
1.1 NetWare server disks and File Systems
A NetWare server disk consists of 2 basic partitions. The first is a small MS-DOS partition used to boot the computer and then load the NetWare OS. The second partition contains the NetWare OS files.

Fig: Structure of NetWare server disk
The NetWare partition (shown in blue in the figure above) consists of 2 basic divisions: a Hot Fix Redirection Area and a Data Area.
The Hot Fix Redirection Area contains sectors which act as substitutes for bad sectors on the hard disk. Before writing data to the disk, NetWare verifies whether the target sectors are in good condition …quot; if they are not, the data is redirected to the sectors in the Hot Fix Area. The Hot Fix Area typically comprises 0.2 - 2% (user-specified) of the disk space. This area consists of two parts: one being a table which maps bad sectors in the data area to corresponding sectors in the Hot Fix Area, and the other comprising the actual sectors which act as substitutes for bad sectors.

Fig: Structure of a NetWare Partition and its Hot Fix Redirection Area
The Data Area consists of a Volume Table (which contains detailed information of the volumes such as name, size, block size, segmentation, and other details) and one or more logical Volumes. The first volume in any NetWare partition is the SYS Volume. Shown below is the Volume distribution in a typical server disk:

Fig: Distribution of Volumes on a server disk
The methods and data structures used to organize files on a Volume are known as its File System. NetWare file systems have evolved over time with NetWare 2.x using NWFS 286, NetWare 3.x and 4.x using NWFS 386, while NetWare 5.x and later uses the NSS (Novell Storage Services) file system.
NWFS
NWFS can be thought of as a modified FAT (MS-DOS/Windows) file system. It used to come in both 16-bit (NWFS 286) and 32-bit (NWFS 386) versions, and has now been superseded by the 64-bit NSS (Novell Storage Services) file system.
NetWare 4.x and earlier had volumes formatted to the NWFS file system which is similar to Microsoft’s FAT 32 file system. Distributed across a NetWare Volume are certain blocks which contain 2 important data structures that manage files and directories …quot; these are DET (Directory Entry Table) and FAT (File Allocation Table). This is similar to the Directory Table and File Allocation Table used in Microsoft’s FAT file system.
The DET contains a list of all files and directories in the volume including details such as name, size, attributes, and so on. The FAT is a table that contains information about where on the Volume various files are stored, which blocks they occupy, and so on …quot; all files can be located using the FAT. 2 copies each of the DET and FAT are maintained (for the sake of redundancy). The DET and FAT blocks are distributed throughout the Volume.

Fig: Structure of a NetWare Volume
In NWFS, the Directory entries are recorded in a Table, and the File Allocation entries are maintained using Linked Lists.
NSS
Unlike NWFS (which manages data using the DET and FAT), NSS is a Journaling file system. This means that any change made to a file, instead of being directly updated to the DET and FAT as in NWFS, is first logged in a journal before the actual change is made. Only the files metadata (data about the file such as name, size, location, and so on) is logged and not the actual file data. Therefore, if the disk crashes while some write processes are running, the OS knows which processes to redo on rebooting.
All structured data on a Volume formatted to NSS is organized using the B-Tree (Balanced Tree) algorithm. The B-Tree is a tree data structure and is very efficient for use in file systems and databases. Two of the B-Trees found in NSS are the Name Tree B-Tree which manages a Volume’s directory structure (analogous to the DET in NWFS) and the Beast B-Tree which manages all file’s metadata (analogous to the FAT in NWFS).
A B-Tree is very efficient with insertions and deletions which is why it is used in file systems and data bases
NSS v/s NWFS with respect to Data Safety and Protection
NSS is far superior to NWFS when it comes to data safety and protection
NSS NWFS
Error Correction Presence of journal simplifies error correction/recovery Entire volume must be scanned (VREPAIR) to determine errors
File Snapshot Backup of open files No such support available
Pool Snapshot Backup of block in current state No such support available
RAID Support Supports RAID 0,1,5,10,15 Supports RAID 0,1,10
Data Shredding
(Data Erasure) Permanent data removal
(overwriting over 7 passes) No such support available
1.2 NetWare Volume Types
Data storage in Novell servers can be optimized using configurations such as Compressed Volumes, Sub-allocated Volumes, and Segmented Volumes. Data recovery software usually recovers data in its raw form, as they appear on the disk, disregarding any of the above configurations they may be in. Thus, the recovery of such data back to its original form presents a problem. Before we look at how such configurations can be retained even after recovery, let us first understand how data is arranged in such volumes.
Compressed Volumes
Data Compression refers to the process of storing data in a format that requires less space than usual. Compressing data is the same as packing data …quot; reducing the amount of electronic ’space’ data takes up, and compressed data usually consumes 2 to 4 times fewer bits. Typically, it is infrequently used data which is automatically compressed to save space.
Methods of compressing data include replacing multiple blank spaces with a character count, or replacing redundant data with shorter stand-in ‘codes’.
Volumes can be compressed in NSS using the console command:
nss /Compression=(Volume Name) OR nss /Compression=all
Volume compression statistics can be viewed using the command:
CompScreen
Note: Volume compression is an irreversible process.
A listing of all Novell compression capabilities is available at: http://www.novell.com/documentation/nw65/index.html page=/documentation/nw65/nss_enu/data/bpwtq9o.html
Sub-allocated Volumes
Sub-allocated volumes are a new feature and have been implemented in NetWare 4.x to overcome the problem of wasted disk space. These volumes are different from regular Novell volumes because they are more of a ‘virtual’ volume …quot; one that is not ‘visible’, but exists nevertheless.
Sub-allocation refers to multiple file-endings sharing disk blocks. The data in a file is stored in the hard disk in multiple blocks, each block being a collection of sectors of standard size. There are, almost always, some unutilized sectors at the end of a file. These ‘under-allocated’ sectors of different files are combined together to form a separate ‘virtual’ volume.
For Example: Say, a volume stores data in blocks of 4 sectors, each sector having size = 512 bytes. Now, if there is a file containing 520 bytes of data, the first sector is entirely occupied and the remaining 8 bytes go into the second sector. This leaves 2 entire sectors unused. These unutilized sectors of different files are combined together to form a separate sub-allocated volume, thus saving space and optimizing data storage.

Fig: Space optimization using Sub-allocated volumes
The sub-allocated volume is virtual - it does not show up as a separate logical volume. It is internally used by the Operating System (NetWare 4.x) to optimize disk space utilization.
Sub-allocation was a useful feature in NWFS which uses 64K blocks. NSS, which uses 4K blocks, do not have much use for sub-allocation.
Segmented Volumes
Segmented volumes refer to volumes which have had their size increased by taking disk space from another area. This space is usually taken from another disk, resulting in the Volume existing in ’segments’ across different disks, and hence the name segmented volumes. Segmented volumes add flexibility and are particularly useful in cases of important volumes needing additional disk space. A volume may be spanned across as many as 32 hard disks.

Fig: Volume X is a segmented volume spanned across 3 hard disks
For Example: Say, a disk consists of 2 volumes, one of which is almost full up and needs additional space. NetWare uses a feature using which disk space, usually from a separate disk, can be added to an existing volume.
While Segmented Volumes do make for increased volume size, the downside is that the volume gets fragmented.
1.3 How data gets lost
Data loss can be just a click away and usually occurs when least expected. Some of the leading causes of data loss:

(Source: www.protect-data.com/information/statistics.html)
The biggest factor leading to data loss is hardware malfunction. Hard disks are mechanical devices and therefore fall victim to wear and tear …quot; estimates put the average life of a hard disk at 3 years and it’s easy to see why - picture a series of disk platters rotating at 10,000 times per minute (over a 150 times a second!) with disk heads moving over them, separated at submicron distances. The margin for error, for mechanical movements inside the disk, is minimal. Even slight vibrations can unsettle alignments, and dropping a disk to the floor can be thought of as a minor catastrophe …quot; in fact, Head/Media collisions account for a large percentage of hardware malfunctions. Add to this other factors such as settling of dust particles on magnetic surfaces, sudden temperature variations, electronic (circuit board) failures, Controller failures, power surges, etc and one can understand the relatively short life span of hard disks …quot; a hardware malfunction can occur at any time and is sometimes beyond the control of the user.
Human error (accidental deletion/format, incorrect usage of software, etc) and software malfunction (corruption by virulent software, configuration complexity, improper backups, etc) are other major factors leading to data loss. While virus attacks are an issue with other Operating Systems (most notably Windows), this is not much of an issue in NetWare.
1.4 Data safety methods provided by NetWare & its limitations
Although NWFS has limited data safety/protection methods, NSS comes with useful features some of which are:
Journaling -> This significantly reduces the number of errors that happen when an operation is interrupted unexpectedly (resulting from occurrences such as a power failure or system failure).

File Snapshot -> This feature allows transient copies of open files to be made. Taking advantage of this, backups of even open files are possible. This feature can be activated using the console command:
nss /FileCopyOnWrite=(Volume Name) OR nss /FileCopyOnWrite=all
For a complete description of this feature, visit:
http://www.novell.com/documentation/nw65/index.html page=/documentation/nw65/nss_enu/data/ajhv67e.html

Pool Snapshot -> This feature allows you to take a snapshot of a data pool as it exists, including open files. This can be helpful for backup, maintenance, and restoration of lost data.
A snapshot can be taken using the console command:
mm snap create (snappool)(datapool)(snapname)
A previously taken snapshot can be activated using the console command:
mm snap activate (snapname)
A more extensive list of Pool Snapshot capabilities is given at:
http://www.novell.com/documentation/nw65/index.html page=/documentation/nw65/nss_enu/data/br18vpz.html
Even though these features offer data safety up to a certain level, the one big limitation for these features above is that all backups are metadata-based only. This means that a data disaster on a big scale, with a files actual core data getting lost/deleted, cannot be resolved using these features. What is needed in such a scenario is a complete scan of the disk surface to look for deleted/missing entries. This can only be done by advanced data recovery software and is a must-use when the above methods fail.
2. Setting up the hardware (for a recovery process)
2.1 Basic Do’s and Don’ts
When data is seemingly ‘deleted’ from a disk, the actual data is not removed. Only the reference information of the file is modified so that the space that a file occupies on the disk is marked as ‘free-space’ and is made available for writing on. But until that space is actually overwritten by other data, the original data remains intact and is therefore recoverable.
Since ‘lost’ data being overwritten is a major concern, it is imperative that the volume containing lost data is not used at all. Even leaving the server on, without any activity, causes many tiny files to be written/updated every few seconds. This increases the chance of lost data being overwritten and reduces the possibility of total data recovery. Therefore, after any instance of data loss …quot; be it a single deleted file or a total disk failure …quot; it is preferable to disconnect the affected server disk.
Following episodes of data loss:
Do’s
Turn off the machine immediately
Disconnect the server disk
Don’ts
Never restart the machine in the hope that this will solve the problem …quot; a restart involves many files being generated which may result in overwriting of lost data which will in turn reduce the possibility of total data recovery
If you hear clicking/grinding noises coming from the storage media, then it is a hardware failure …quot; do not continue using the disk. It is preferable to disconnect the server disk immediately. In such cases, even data recovery software may not fully be able to recover lost data …quot; it needs to be turned over to data recovery specialists
If there is intense physical damage to the disk (such as a power surge resulting in smoke or sparks), do not experiment with the media …quot; this needs examination by experts
Do not, under any circumstances, open up the disk since exposing the platters may damage the disk beyond repair. The disk is to be opened up only as a last resort and that too by professionals working in a clean-room
If the data recovery software allows installation on NetWare, do not install the software on the Volume which is affected. While it is possible to install the software on a Volume other than the one which is affected, it is always preferable to connect the affected disk to a working disk and then install the recovery software to the working disk
The ideal method to recover lost data is to connect the affected disk to a healthy disk. Data recovery software is then installed on to the healthy disk after which the software detects and does a scan of the affected disk.
The following section describes the connection of the disks.
2.2 Connecting IDE disks
It is best not to involve the server disk for recovery software installation during a system recovery. It is recommended to install the software on a Windows OS ‘host’ disk, and then connect the affected server disk to it (to understand why, read section 3 labeled ‘Using Data Recovery Software’).
This section discusses the connection of IDE (also known as ATA) disks.
Disks with IDE interfaces can be connected as:
‘Slave’ on the Primary channel OR
Either ‘Master’ or ‘Slave’ on a secondary channel
This implies that the disk with lost data can be connected in any way to a working disk, as long as the system does not boot from the affected disk.
Configuring a disk to be either ‘Master’ or ‘Slave’ involves setting the jumper pins at the back of the hard disks.
This is what the back of a disk looks like:
IDE Cable Connector
One end of this connector goes into the back of the disk, and the other into the motherboard.
Jumper Pins
Out of the given sets of jumper pins, one of the sets needs to be ‘jumpered’ thus giving the disk its configuration. The diagram for the jumper pin configuration should be given in a sticker on the disk. If the failed disk is being connected on the primary channel, it needs to be connected in the ’slave’ configuration. Use tweezers to change the switch position. There is a notch that prevents incorrect insertion.
Power Cable Connector
The power cable goes in here.

This is what an IDE cable looks like:
Connecting disks to the cable
An IDE cable has one end connected to the motherboard, and the other end usually goes into the disk configured as ‘Master’. The working disk which has recovery software installed in it should be the ‘Master’. The plug in the middle usually has the disk configured as ‘Slave’. If connected in the primary channel, the damaged disk needs to be ‘jumpered’ to be a ‘Slave’ and then connected to this middle plug.

After the jumper pins have been set and IDE cable connected at the correct points, the disks need to be installed into its case …quot; simply screw in the disk to secure it to its case. The next step is to make sure that the computer accepts the disks.
2.3 Connecting SCSI Disks
While disks with IDE interfaces have gained popularity with home PC users because of their low cost, SCSI interface disks are common with servers and high performance workstations and/or peripherals. The most visible difference between IDE and SCSI disks is that a single SCSI adapter can handle as many as 7 or 15 devices at a time …quot; because of this, setting the Jumper Pins at the back of a SCSI disk are a little more complicated than behind an IDE disk.
In connecting SCSI disks appropriate jumper pins have to be set to assign SCSI ID’s, configure termination, etc. For data recovery purposes the only thing to remember while connecting the disks is to connect the SCSI disk with lost data as:
‘Slave’ on the Primary channel OR
Either ‘Master’ or ‘Slave’ on a secondary channel
This implies that the disk with lost data can be connected in any way to a working disk, as long as the system does not boot from the affected disk.
This is similar to disks with IDE interfaces (see above …quot; Connecting IDE disks - for connection details). The jumper pin setting information should be detailed in the sticker on the disk itself. After connecting the SCSI disk in the appropriate configuration, the next step is to make sure that the computer accepts the disks.
2.4 Finishing Up
The BIOS usually automatically detects new hardware - this is so because the disk detection feature is set to ‘AUTO’ by default. However, it is still better to enter the BIOS and confirm whether the appropriate disk channel(s) are set to ‘AUTO’.
There are different methods of entering the BIOS for different motherboards. It is usually done by pressing the ‘F2′ key or the ‘Delete’ key just after starting the computer (To find out the exact keystroke(s) to enter the BIOS, visit: http://www.numonics.com/support/bios.htm).
In the BIOS, navigate through the main menu and go the Hard Disk AutoDetect feature

In the Hard Disk setup window, make sure the channel that the disk is connected to, is set to ‘AUTO’. For Example: If the disk with lost data is a ’slave’ on the primary channel, make sure that this option is set to ‘AUTO’.

After making the necessary changes, remember to save changes before exiting BIOS.
3. Using Data Recovery Software (Stellar Phoenix Novell)
3.1 How data recovery software work
When a file is seemingly ‘deleted’ from a disk, the actual data is not removed. The only thing that is done is modification of the file’s entry in the directory table/tree such that the space on the disk that the file occupied is now labeled as free space. Thus, the file still exists on the disk - but the file system is blind to it. This is much like a house without an address - it exists, but there is simply no way to go to it. Permanent deletion occurs only after the file’s actual data is overwritten by other data.
Data recovery software, such as Stellar Phoenix Novell, take advantage of this fact and use it to recover lost data.
When a file is ‘deleted’, only the first few bytes of that files entry in the Directory Table/Tree are modified to make the file system recognize that file as deleted. Data Recovery software scan the Directory Table/Tree looking for modified entries which have been labeled as ‘deleted’. When it finds one, it verifies whether the clusters occupied by this file have been left untouched or whether the clusters have already been overwritten by a new file. If the clusters are still ‘free’ and have not been reallocated, then this file is recoverable. 数据恢复
This is the reason why an affected disk should be disconnected and not left running as tiny files keep getting generated/updated every few seconds, thus increasing the likelihood of crucial data getting overwritten …quot; it is easy to understand then, why even something as simple as a system restart could turn out to be catastrophic.
Sometimes, however, even the Directory Table/Tree may be corrupt or may have been overwritten. In such cases, data recovery software go into advanced mode and scan the disk cluster by cluster. When the software finds a file, it verifies whether that file’s entry exists in the Directory Table/Tree …quot; if it does, then the file is obviously ‘visible’ to users. However, if an existing file on the disk does not have an associated entry in the Directory Table/Tree, then it is considered to be a lost/missing entry and the software will display this as a ‘found’ file.
Thus, data can be recovered either by analyzing the Directory table/tree of a file system (to look for deleted files), or by doing a cluster by cluster search of the physical disk (to look for lost/missing files). These two options are given different names (like ‘Standard Search’ and ‘Advanced Search’) by different data recovery software.
The next section discusses the recovery process of deleted files and missing/lost NetWare partitions using Stellar Phoenix Novell.
Problems faced in recovering data from compressed/sub-allocated/segmented volumes:
Data recovered from volumes which are compressed, sub-allocated, or segmented presents a few problems.
Compressed Volumes
Data recovery software recover lost data exactly as it was stored in the disk, and the recovered data may be compressed. Data must be decompressed before it can be used. This gives rise to the problem of recovered data being unusable (because it is in a compressed format).
Sub-allocated Volumes
Sub-allocated Volumes are virtual and not ‘visible’. Since data recovery software do a physical scan on the hard disk, recovery of lost data from sub-allocated sections of a volume is a problem.
Segmented Volumes
Regular data recovery software can usually scan only one disk at a time, but segmented volumes may be spanned across multiple disks, which is what creates the difficulty in the recovery of segmented volumes.
Effective data recovery software for NetWare requires advanced modules to fully recover data from such volumes while at the same time maintaining the original configuration …quot; ensure that the data recovery software you purchase can recover data from all these volume types
3.2 Case Study …quot; Using Stellar Phoenix Novell to recover data
All data recovery software have a trial version available which lets users get a good approximation of how effective the software can be. The trial version scans the disk using both Standard and Advanced modes and displays a list of all recoverable data. However, the full version will be needed to actually restore/save that data.
If you have lost data to be recovered, try downloading Stellar Phoenix Novell from www.stellarinfo.com/netware-data-recovery.htm and then install the software to a healthy working hard disk with the Windows Operating System in it. Stellar Phoenix Novell is a win32 executable and needs to be installed to a Windows based disk.
Run setup.exe from among the downloaded files …quot; the software is installed, by default, to a Stellar folder in Program Files. Additionally, usual entries to the Programs group (Start -> Programs) and the Add/Remove Programs list (in Control Panel) are also made.
Note: Make sure you are logged in as administrator before initializing setup - the software installation requires local administrative rights in Windows NT/2000/XP. 数据恢复
The affected server disk should be connected to this ‘Windows’ disk as a secondary (for details, read Section 2: Setting up the hardware).
Running the software will display the user interface containing a Toolbar which contains all necessary buttons to operate the software, from initiating the recovery process to saving the lost data.
Limitation of Stellar Phoenix Novell: NetWare 6.5 and later has an optional Encrypted Volume Support (EVS) feature using which it is possible to encrypt data stored on any newly created volume (the SYS volume is the only volume that cannot have the EVS feature in it). This is done mostly for protection of data against theft. Although data in EVS volumes are in an encrypted format, they work seamlessly with all applications. To learn how to create an encrypted volume, visit: http://www.novell.com/documentation/nw65/index.html page=/documentation/nw65/nss_enu/data/bq2y6nb.htm.
Stellar Phoenix Novell cannot recover data from such encrypted volumes.
For further information on the workings of this software, read the product’s Knowledge Base articles at: http://stellarinfo.com/esupport/users/kb.php category_id=13
3.2.1. How to recover deleted files
NWFS
Click the Select Physical Disk button ( ) on the Toolbar to begin the recovery process. The software displays a list of all the hard disks it can detect, including the affected server disk. Select the server disk and then click OK to continue.

Select the NetWare partition

Select the Volume

The software looks for deleted entries in the selected volume and displays the result in a simple tree structure.

If the standard search fails to turn up the desired results, the software can be made to search in an advanced mode (read Section 3.1: How data recovery software work) by changing the Linking Mode to Contiguous (Tools->Change Linking Mode->Contiguous Mode).

Select any number of files to be recovered and then click the Recover Selected button to restore the data. Alternatively, clicking the Recover All button will recover all displayed files. (The Recover Selected/All feature is only activated in the full version …quot; it is not available in the trial version).
NSS
The steps are similar to the ones shown above. They are:
Select the physical disk

Select the NSS Pool

Select the Volume

The software looks for deleted entries in the selected volume and displays the result in a simple tree structure after which any number of files can be recovered.
3.2.2.How to recover missing/lost NetWare partitions
The process of recovering of missing/lost NetWare partitions is similar to the steps shown above in 3.1 How to recover deleted files. The one difference is that instead of specifying the Pool and/or Volume to recover, you need to choose the hard disk to recover from …quot; this is because the software will scan the entire disk to look for missing/lost NetWare partitions.
NWFS
Use the ‘Search NetWare Partition’ option and then select the physical disk which contains the lost/missing partition.

The software searches the selected disk for all partitions. Since the search is intensive, it may take some time to complete. After the search is over, the software will display a list of all found partitions

Select the partition which contains the missing/lost volume

Select the Volume from which data needs to be recovered

The software then analyses the volume’s data structures and file system attributes and displays the result in a simple tree structure after which any number of files may be recovered
NSS
The method of recovering missing/lost NSS Volumes is similar to the steps given above. Moreover, Stellar Phoenix Novell also has an additional feature in which NSS Pools can be searched for, and recovered.
Use the ‘Advanced Search for NSS Volumes’ or ‘Advanced Search for NSS Pools’ option and select the physical disk which contains the lost/missing Volume or Pool

The software does an intensive search and lists all the pools/volumes it can find

Select the Pool/Volume from which data needs to be recovered

The software analyses the relevant data structures and file system attributes and displays the result in a simple tree structure after which any number of files may be recovered
The steps laid out in the 2 sections above work for most Volume types, such as Segmented Volumes, Sub-allocated Volumes, etc and for most data loss events, such as Formatted Volumes, Re-partitioned Volumes, etc. However, recovery of compressed volumes is a slightly more complicated issue and is discussed in the next section.
3.2.3. How to recover compressed Volumes
(For NetWare 4.x and above)
If a Volume is given compression capability, then some data in the Volume will most likely be compressed. When such data is recovered, it is still in a compressed format and thus unusable. Thus, effective data recovery software need to have a decompression module in them to ensure full usability of the recovered data …quot; ensure that the recovery software you use has such a capability.
The use of recovery software’s decompression utility is illustrated by the following steps, as followed in Stellar Phoenix Novell:
Recover the compressed data using the steps followed in sections 3.1 or 3.2 …quot; you now have recovered compressed data on a hard disk different from the affected server disk

Connect the disk with the compressed data to a Novell client machine …quot; this machine now has the compressed data in it

Log on as an Administrator to the Novell client and upload the compressed data to a Novell server disk …quot; the server disk now has the compressed data.
Note: The compressed data should be uploaded to an NWFS Volume on the server

Shut the server down, disconnect the server disk and connect it as a secondary to the disk with Stellar Phoenix Novell installed in it

Run the software, select the volume with the compressed data and then run the software’s decompression utility on the compressed data (Tools -> Mark Compressed Files). The server disk’s compressed data is now decompressed

Reconnect the server disk back into the server machine and boot this machine up

The decompressed data can now be transferred from the server to any client machine
This process does require some patience but is safest and yields best results if done systematically.
Data recovery software, as with most other software, come with their own unique additional features to ease the recovery process. Stellar Phoenix Novell comes with utilities such as File Filter, File Mask, Save Scan, Event Log, Find, and so on to streamline and facilitate the recovery process.
4. Conclusion
The data recovery process for Novell server disks can be summarized briefly as:
Disconnect the server disk

Install the data recovery software to a healthy working disk and connect the affected server disk to this working disk

Run the software to detect the server disk and display all its partitions/volumes

Select the disk/volume from which to recover data from and begin the disk/volume analysis

After all recoverable files are displayed, select the file(s) to be recovered and then restore them
In conclusion, if the server disk is immediately disconnected after an episode of data loss then the chances of total data recovery is very high. Data is never truly lost unless it is overwritten, and it is users that control writing to the disk …quot; hence, salvaging data, even in the event of a total disk failure, is not difficult at all. All that needs to be followed is a systematic approach.
The best practice in protecting data is regularly taking backups. While most Operating Systems today do have built in backup tools, these are not truly extensive. It is always better to go in for genuine 3rd party software (there are many good applications available today), whose development is dedicated to the task of protecting data. Most backup software today are fully automated and keep taking regular backups on their own without any user intervention …quot; even if the disk completely crashes, the machine can be booted using the software’s disc (which contains the necessary boot files) after which the software accesses the backup and restores the system.
Other effective data protection practices are hardware configurations such as RAID, periodic usage of good system checker software, reduction of dust around the work area, monitoring hard disk’s for hardware faults (see Section 1.3: How data gets lost), effective cooling systems, updated anti-virus software, etc.
However, even backups (be it in the form of backup software or hardware configurations such as RAID) are not 100% foolproof and mishaps can occur in any situation. The only way to ensure complete data protection is a thorough knowledge of data storage and recovery processes …quot; this will provide users with small but extremely vital bits of information such as immediate disconnection of affected disks, connection of failed disks to healthy ones, recovery of data to safe locations, etc. Thus, in a nutshell, while data disasters may occur at any time, 100% data recovery is definitely possible.
Related Material:
To understand recovery of data even after it has been overwritten, read Gutmann’s paper at: www.cs.auckland.ac.nz/~pgut001/pubs/secure_del.html

Related Articles: