190 likes | 198 Views
Learn about mounting partitions on local or remote systems, using the mount command, creating new disk drives, checking file systems, installing software, and applying OS patches.
E N D
Unix - Advanced Concepts System Administration 15
Mount • Is used to mount (connect) a partition on a local hard drive to your unix file system (local). • Can be used to connect a servers partition to your local client for access (client/server networking). • A “mapping” process
Mount Commands • mount • see what is currently mounted • mount -t type /dev/hda1 /mnt where "type" is either nfs (over network, client/server) or ext3 (for local hard drive partition linux native) "/dev/hda1" is the physical partition on the given hard drive /mnt is the empty directory (mount point) where the partition is mount to • Note- ext3/ext2 is a type of UFS (unix file system) used by linux
For Example: mount -t ext2 /dev/hda4 /home mount the home directory on /dev/hda4 to the location /home (local mounting)
Over a Network: Server: • Share directory to be accessed by clients (“share” command) Client: • mkdir /usr/local • create empty directory, a mount point • mount -t nfs server1:/usr/local /usr/local • mount, over the network (nfs) from the server called "server1",mount its /usr/local partition onto the client at the same location. • umount /home • un mount a partition • Note - all file systems normally mount up, at boot time, via the /etc/fstab (/etc/vfstab) file
Adding a New Disk Drive • Partition and format the new drive • sun - format • linux - disk druid or fdisk • Create file system on new partition • sun - newfs • linux - mkfs • Mount partitions via mount command or at bootup via • sun - /etc/vfstab • linux - /etc/fstab
fsck - file system check • Tool to check and fix a file system • Automatically attempts to fix things, if file system is corrupted. • You can fun this manually...and it also runs automatically at boot time if the system was not cleanly shutdown.
Compressed Files • 2-1 ratio • file --> file.gz • Use zip/gzip to compress, and unzip/gunzip to uncompress
Tar • Archive format • Gathers many directories/files into one single tape or onto one single file (called a tar file or tarball). • Also saves group/ownership/permission info and date info for each file/directory.
Examples of Tar • tar -tvf file.tar • This takes a tar file (file.tar) and shows the table of contents of the file (-t option) in a verbose (-v option) way. • tar -xvf file.tar • This will extract all file/directories from the above tar file, into the current directory. (-x extract -v verbose). • Permissions ownership/group will be set correctly. • (untar) • tar -cvf file.tar directory-name • The entire contents of the given directory, and everything in it, will be copied into the tar file (file.tar) including permissions/ownership/group. (-c create -v verbose)
Thus when you install software, it often comes in a compressed tarball. Something like "file.tar.gz". Thus you need to first uncompress the file and then untar it. • gunzip file.tar.gz • Creates the file file.tar) • tar -xvf file.tar • This extracts all the software) • Note- make sure to do the above in the correct location on the system.
Other Methods to Install Software • sun - pkgadd/pkgrm • install/remove scripts • linux - rpm • red hat package manager • Note- when done installing software, always check ownership/group/permissions and also test to make sure it works correctly (not just as root).
Source Code • When the software you get is just source code, and not binaries, you will have to compile it first to get the binaries created and installed. Typical set of steps: • read README file and other docs • Often have a Makefile that may need adjustment (edit) • May have a command called "./configure" to create a Makefile for you. • ./make • run the Makefile, this will compile, link and create the binaries from the source code • ./make install • copies all binaries to final location on the system
Linux • "patch" program, to add patches to linux source code • Then build a new kernel (compile linux source code) • Install new kernel into /boot/vmlinuz-2.0.xxx
Solaris • patchadd 106751.tar.gz • patchrm • Easy scripts to add/remove patches. • Patches for solaris come in a compressed/zipped and tar format. • No need to build (compile source code ) a new kernel.