Sharing and Migrating File Systems Exercise -------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------| Host A (Tape Drive) | -------------------------------------------------------------------------------------| Migrating a file system ------------------------------------- 1) # umount /export/home 2) # fsck /export/home #! These steps ensure the existing /export/home FS is clean. 3) # mount /export/home 4) # ufsdump 0uvf /dev/rmt/0 /export/home 5) # ufsrestore t #! Step 5 checks the integrity of the tape. 6) # newfs /dev/rdsk/c0t1d0s1 7) # fsck /dev/rdsk/c0t1d0s1 8) # umount /export/home 8) # mount /dev/dsk/c0t1d0s1 /export/home 9) # cd /export/home 10) # ufsrestore rvf /dev/rmt/0 11) # ls -l #! The FS should be restored 12) # umount /export/home 13) # fsck /dev/rdsk/c0t1d0s1 14) # vi /etc/vfstab ~ /dev/dsk/c0t1d0s1 /dev/rdsk/c0t1d0s1 /export/home ufs 2 yes - ~ #! This entry should replace the old /export/home entry. Remember that all files are tab delimited. #! DO NOTinclude extra tabs in the file. They will cause fsck errors at mount. 15) # mountall -l 16) # df -k #! Be sure that /export/home is mounted on c0t1d0s1 Sharing a file system ------------------------------------- #! From / directory. 1) # mkdir /export/home/backup 2) # tar cvf /export/home/backup/expt.tar ./export/home 3) # vi /etc/dfs/dfstab share -F nfs -o ro /export/home/backup 4) # cd /etc/init.d 5) # ./rpc stop 6) # ./rpc start 7) # ./nfs.server start #! Steps 4-7 are only nessecary if this is the first time Host A will be an NFS server. 8) # dfshares hosta #! Host A should be sharing out the directory /export/home/backup. ------------------------------------------------------------------------------------| Host B | ------------------------------------------------------------------------------------| Migrating a File System -------------------------------------------- 1) # newfs /dev/rdsk/c0t1d0s1 2) # fsck /dev/rdsk/c0t1d0s1 #! Prepare the new partition 3) # umount /export/home 4) # fsck /export/home #! These steps ensure the existing /export/home FS is clean. 5) # mount /export/home 6) # ufsdump 0uvf /dev/rmt/0 /export/home 7) # ufsrestore tf /dev/rmt/0 8) # mount /dev/dsk/c0t1d0s1 /export/home 8) # cd /export/home 9) # ufsrestore rvf /dev/rmt/0 10) # ls -l #! The FS should be restored 11) # umount /export/home 12) # fsck /dev/rdsk/c0t1d0s1 13) # vi /etc/vfstab ~ /dev/dsk/c0t1d0s1 /dev/rdsk/c0t1d0s1 /export/home ufs 2 yes - ~ #! This entry should replace the old /export/home entry. Remember that all files are tab delimited. #! DO NOT include extra tabs in the file. They will cause fsck errors at mount. 14) # mountall -l 15) # df -k #! Be sure that /export/home is mounted on c0t1d0s1 Mounting a remote file system -------------------------------------------------------------------------- 1) # dfshares hosta #! If you receive an rpc error, have Host A stop and start the rpc and nfs.server processes in the #! /etc/init.d directory 2) # mkdir -p /backups/filesys 3) # vi /etc/vfstab hosta:/export/home/backup - /backups/filesys nfs - yes soft,bg #! Host B does not need to specify a device to fsck or fsck pass. This should all be #! handled on the server. Host B has to put a "-" to denote skipped fields. Be sure #! not to include any extra tabs. This will causefsck errors at mount. The "soft,bg" #! for options allow Host B to retry the remote mount in the background and continue #! with the process. The default will cause Host B to wait 12,000 seconds for #! the resource to become available. 4) # umountall 5) # mountall 6) # mount -v #! Host B should now report Host A's file system being mounted locally on /backups/filesys. 7) # cd /backups/filesys 8) # ls -l #! Host B should now see the contents of Host A's /export/home/backup.