![]() |
![]() |
![]() |
![]() |
16 Recovering Lost Data
This chapter covers the following topics:
- Introduction
- Backing up your data
- Recovering files
- Recovering disks
- The file maintenance utilities
- What if my system won't boot?
Introduction
[Author's Comments: user's comment: add something on the impact of package manager on doing backups and restores. Also resource managers should be slayed as well unless they are mounted in non-backup areas e.g. /dev, /fs, etc.]
Backing up your data
[Author's Comments: (@@How do I backup files? How do I make a recovery floppy? When should I do archive/filesystem backups? What format does the backup system use? What media should I use for backup? How do I backup onto different media e.g. floppy (compressed floppy, unix compatible floppy), tape, cartridge, optical, removable disk, fixed disk? What is compression? ]
Recovering files
[Author's Comments: How do I use the recovery floppy?]
Recovering disks
[Author's Comments: (@@How can I recover disks? What are the disk recovery procedures?)]
Overview of QNX 6 disk structure
[Author's Comments: (@@What does the Nto disk structure look like?)] What are directories, links, and extent blocks?
Partitioning
[Author's Comments: (@@How is the disk partitioned?)]
The file maintenance utilities
You can use the following utilities to maintain your RTP filesystem. For more information on these utilities, see Utilities Reference.
Initializing disks
dinit
Initialize a formatted diskette or hard disk as a QNX filesystem using the dinit utility; afterwards, always use the -m option of dcheck to remove any bad blocks from the disk allocation bitmap.
When dinit initializes a disk, it writes a loader in the first block. If the disk is a floppy diskette, the loader is the bootstrap loader, otherwise it's the secondary (or partition) loader.
fdformat
Format a floppy disk using fdformat.
[Author's Comments: May not be available in current release]
Verifying and checking disks
dcheck
The dcheck utility verifies that a disk has been correctly formatted by attempting to read every block on the drive. You can use dcheck to check any formatted disk, including disks that contain files: the files aren't damaged. If the number of blocks to verify isn't specified, dcheck obtains this information from the filesystem and checks all the blocks on the specified drive.
If a disk has been initialized for QNX, you should use the -m option to remove any bad blocks. Run dcheck several times using the -l or -L options, to catch and remove marginal blocks. The utility has a number of other options to provide additional checking of a disk.
chkfsys
The chkfsys utility tells you if any QNX 4 filesystem files are using bad blocks. The utility doesn't operate on disk partitions containing non-QNX filesystems (e.g. DOS partitions, QNX 2 partitions). In addition, chkfsys must have access to the block special file that the filesystem is contained in. For this reason, chkfsys can't be used on NFS-mounted QNX filesystems.
The chkfsys utility may also be run after a system crash or power failure, which may have left some files busy. The utility frees these files and checks to ensure that no damage to the filesystem has occurred.
spatch
The spatch utility provides full screen editing of files or disk blocks. If you specify a directory in the file argument, the disk is edited, but spatch moves only through the blocks that make up the directory; if you wish to make changes, the disk must be opened for exclusive use as would any block special file.
To run spatch on a directory or a block special file, you must either be root or have write permission for the disk's block special file.
df
The df utility displays the amount of free disk space for the given devices, directories, and files.
du
The du utility prints to the standard output, the amount of file space allocated to the specified files. If you name a directory, all files in that directory are reported; subdirectories are traversed recursively. If a file has multiple links, the space allocated to that file is counted only once. If you specify non directories, they aren't listed unless you specify the -a option.
Errors may result in diagnostic messages to the standard error.
zap
Remove a damaged QNX 4 file using zap if the file is known to contain bad disk blocks or if chkfsys tells you to. The zap utility releases a file by clearing the directory entry for that file. The disk blocks used by the file aren't reclaimed. Therefore, if you use zap repeatedly, you'll reduce the total number of disk blocks available on the disk. You can reclaim these, however, by running chkfsys when the system is idle.
Normally, you should use the rm or rmdir commands to release files or directories.
Recover zapped files by using the -u option. The utility will prompt for each file that was zapped in the specified directory.
Archiving disks
cpio
The cpio utility produces and reads files in the format specified by the POSIX cpio Archive/Interchange File Format. It operates in three modes.
If an error is detected, the cause is reported and the cpio utility will continue to copy other files. The utility will skip over any unrecognized files encountered in the archive.
tar
The tar utility reads and writes archive files that conform to the Archive/Interchange File Format specified in POSIX Std/1003.1-1988.
pax
The pax utility reads and writes archive files that conform to the archive/interchange file format specified in POSIX Std 1003.1-1988. The utility can also read, but not write, a number of other file formats. The pax utility is capable of reading and writing archives that span multiple physical volumes.
Compressing disks
freeze
The freeze utility compresses the specified files or the standard input. If a file becomes smaller, it's replaced by a file with the extension .F. If no files are specified, the compression is applied to the standard input and is written to the standard output.
If you don't specify the -f option, and you run freeze in the foreground, you're prompted as to whether the file should be overwritten.
The amount of compression you obtain depends on the size and type of the input file; typically, text files are reduced by about 70% and executable files by 50%.
gzip
The gzip utility reduces the size of the named files, using the Lempel-Ziv coding (LZ77) also used in zip and PKZIP. Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times. If no files are specified, the standard input is compressed to the standard output. If the new file name is too long, gzip truncates it and keeps the original file name in the compressed file. The gzip utility attempts to compress only regular files. In particular, it ignores symbolic links.
The amount of compression obtained depends on the size of the input and the distribution of common substrings; typically, text such as source code or English is reduced by 60-70%. Compression is always performed, even if the compressed file is slightly larger than the original. Multiple compressed files can be concatenated.
Compressed files can be restored to their original form using gzip -d, gunzip, or zcat.
gunzip
The gunzip utility decompresses files that have been compressed with gzip. It's equivalent to gzip -d..
zcat
The zcat utility is identical to gunzip -c. The zcat utility decompresses either a list of files on the command line or its standard input, and writes the decompressed data on standard output. It decompresses files that have the correct magic number whether they have a .gz suffix or not.
What if my system won't boot?
[Author's Comments: (@@if the disk is recoverable, if the filesystem is intact)]
QNX Software Systems Ltd. http://www.qnx.com Voice: +1 613 591 0931 Fax: +1 613 591 3579 info@qnx.com |
![]() |
![]() |
![]() |
![]() |