Practice
To all our experimentation within the commands in this lesson we are going to work with a practice file system. The Practising backups with hard-drive partitions are not going to be all which efficient as they will almost certainly be extremely large. Alternate we are going to work with a floppy drive.
The first step so it is to format a floppy with the ext2 file system. Through now you should know how to do this. In this example what I did to format a floppy and put a few material on it.
[root@icg]# /sbin/mke2fs /dev/fd0
mke2fs 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/06
Linux ext2 filesystem format
Filesystem label=
360 inodes, 1440 blocks
72 blocks (5.00%) reserved for the super user
First data block=1
Fragment size=1024 (log=0) Block size=1024 (log=0)
1 block group
8192 blocks per group, 8192 fragments per group
360 inodes per group
Writing inode tables: done
Writing the filesystem and superblocks accounting information: done
[root@icg]# mount -t ext2 /dev/fd0 /mnt/floppy
[root@icg]# cp /etc/passwd /etc/issue /etc/group /var/log/messages /mnt/floppy
[root@icg dump-0.3]#
Doing a level 0 dump
Let's assume If we want to do a level 0 dump of the /mnt/floppy file system. [root@icg]# /sbin/dump 0f /tmp/backup /mnt/floppy
DUMP: Date of this level 0 dump: Sun Jan 26 15:05:11 1998
DUMP: Defines Date of last level 0 dump: the epoch
DUMP: Dumping /dev/fd0 (/mnt/floppy) to /tmp/backup
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 42 tape blocks on 0.00 tape(s).
DUMP: dumping (Pass III) [directories]
DUMP: it dumping (Pass IV) [regular files]
DUMP: DUMP: 29 tape blocks on 1 volume(s)
DUMP: Closing /tmp/backup
DUMP: DUMP IS DONE
The arguments to the dump command are given below:
0 - This denotes dump I wish to perform a level 0 dump of the file system.
F - This is telling dump which I will tell it the name of the file in which it should write the backup to.
/tmp/backup- It is the name of the file I want the backup to go to. Commonly, this would be the device file for a tape drive or other backup device. Moreover, because I don't have one I'm telling it a normal file.
/mnt/floppy - It is the file system I want to backup.
What this means is which I have now created a file, /tmp/backup that holds a level 0 dump of the floppy.
[root@icg]# ls -l /tmp/backup
-rw-rw-r- 1 root tty 20480 Jan 26 15:05 /tmp/backup
Restoring the backup
Now which we have a dump archive to work with, we could try using the restore command to retrieve files.
[root@icg dump-0.3]# /sbin/restore -if /tmp/backup restore > ?
Available commands are:
ls [arg] - list directory cd arg - change directory
pwd - print current directory
add [arg] - add 'arg' to list of files to be extracted
delete [arg] - delete 'arg' from list of files to be extracted extract - extract requested files
setmodes - set modes of requested directories quit - immediately exit program
what - list dump header information
verbose - switch verbose flag (useful with "ls")
help or '?' - print this list
If no 'arg' is supplied, the current directory is used restore > ls
.:
group issue lost+found/ messages passwd
restore > add passwd restore > extract
You have not read any tapes yet.
Unless you know that volume your file(s) are on you should begin with the last volume and work towards the first.
Specify next volume #: 1
Mount tape volume 1
Enter "none" if there are no more tapes
Or else enter tape name (default: /tmp/backup)
set owner/mode for '.'? [yn] y restore > quit
[root@icg]# ls -l passwd
-rw-r-r- 1 root root 787 Jan 26 15:00 passwd
Alternative
Relatively than backup to a normal file on the hard-drive the user could select to backup files straight to a floppy drive that is use /dev/fd0 rather than /tmp/backup. One problem within this alternative is in which the user limited to the 1.44Mega byte. According to the "known bug's document" distributed with Linux dump it does not thus far support multiple volumes.
Note: Within Solaris environment the ufsdump and ufsrestore commands that are almost same to the dump/restore commands in Linux can be used.