Unit 8 – Solaris File Systems - Virginia Alliance for Secure

advertisement
Unit 8 – Solaris File
Systems
Randy Marchany
VA Tech Computing
Center
va-scan
Copyright 2002, Marchany
File System Types
 UFS – Unix File System. The default file system
type for Solaris
 HSFS – High Sierra File System – CDROM file
system format based on the ISO 9660 standard
 PCFS – Personal Computer File System – DOS
formatted floppies
 UDF – Universal Disk Format – mainly for
reading DVD. New to Solaris 8
 Remember, a file system is a hierarchical
collection of directories and files.
va-scan
Copyright 2002, Marchany
File Systems
 New Solaris 8 feature is UFS logging. This
allows you to rebuild a FS quicker.
 NFS allows you to mount remote file
systems from other servers in the network.
Solaris 8 is now capable of recording all
file operations performed on its exported
file systems. This is called NFS Server
Logging.
va-scan
Copyright 2002, Marchany
Creating New File Systems
 Disk partitions are like virtual disks. It is a
way to subdivide a single disk into several
virtual disks.
 Naming convention:
– CxTyD0Sz
•
•
•
•
va-scan
Cx – Controller X, X=0-7
Ty – SCSI ID Y, Y=0-15
D0 – always set this way
Sz – Slice(Partition) Z, Z=0-7
Copyright 2002, Marchany
Creating New File Systems
 Identify the disk partition you want to use.
 Use the ‘newfs’ command to create the file
system structure on that partition.
– newfs /dev/dsk/c0t0d0s1
 3% of the actual available space is reserved
for system maintenance.
 A lost+found directory is created for file
system checks and repair
va-scan
Copyright 2002, Marchany
fsck
 fsck is the Unix file system repair
command.
 It’s very useful for checking and repairing
problems with the disk, file system,
superblocks and inodes. These problems
are usually caused by a hardware failure or
power loss.
va-scan
Copyright 2002, Marchany
du, df
 The du command displays the size of a directory
in a file system.
– du –s directory
• Displays the total size of the directory
– du directory
• Displays the sizes of the files inside the directory
 The df command displays all of the mounted file
systems, their sizes and capacity.
va-scan
Copyright 2002, Marchany
quot
 The quot command will display how much
disk space is being used by a particular
user.
 2 flags
– -a – report on all mounted file systems
– -f – report the number of files owned by the
user.
va-scan
Copyright 2002, Marchany
mount, umount
 File systems must be mounted before they can be
accessed by users.
 The mount point is the anchor point for the
directory tree structure. A mount point is
basically an empty directory until you mount a
file system on it.
 The umount command detaches the file system
from the mount point and makes the FS
unavailable to the users.
va-scan
Copyright 2002, Marchany
/etc/mnttab, /etc/vfstab
 2 files that control and list the mounted
files systems.
 /etc/mnttab is a system generated file
listing the currently mounted file systems.
This is not a text file anymore…Solaris 8
changed that.
 /etc/vfstab is the file that tells the system
which file systems to mount at boot time.
va-scan
Copyright 2002, Marchany
/etc/vfstab
 /, /usr, /var, /opt, /proc, /tmp, /home or
/export/home are automatically mounted at
boot.
 /etc/vfstab contains the information needed
to mount these file systems.
 Add your file systems to this file if you
want them mounted at boot.
va-scan
Copyright 2002, Marchany
/etc/vfstab







7 fields
Device path to the file system
Raw device path to the disk partition to fsck
The mount point directory
The file system type (ufs, pcfs, hsfs, uds)
The order for fsck to run
Mount at boot?
va-scan
Copyright 2002, Marchany
What’s in the file systems and
System Directories
 / - top of the Unix directory tree. All directories
are components of this tree.
 /etc – system configuration files, password files
and databases
 /opt – default location of optional software. The
default location for most Sun software.
 /proc – special system FS that contains a list of
active processes on the system.
 /tmp – scratch work area. Solaris uses this as
swap space.
va-scan
Copyright 2002, Marchany
What’s in the file systems and
System Directories
 /usr – contains system binaries and
libraries. Also used to contain freeware.
 /var – used to store the system logs
 /home, /export/home – default location of
the user home directories
 /var/run – repository for temp system files
that aren’t needed across system reboots.
va-scan
Copyright 2002, Marchany
Reading from the CDROM
 Solaris Volume Management is enabled by
default so it’s easy to load a cd.
 Once you load it in the drive, Solaris
automatically mounts it to /cdrom
 To look at the content of the CD:
– ls –l /cdrom/cdrom0
 Use the cp command to copy files from the CD to
disk.
 To unload the CD
– cd out of the cdrom directory
va-scan
Copyright 2002, Marchany
– Enter: eject cdrom
tar
 The tar command is used to put all of the
contents of a directory tree in a single file.
 This file can be moved to other locations or
systems and then expanded back to the original
directory structure
 5 main modes
–
–
–
–
va-scan–
C – create a tar file from a directory
X – extract a directory from a tar file
T – list the contents of a tar without extracting it
R – append files to the end of the tar file
U – update files Copyright
if they’ve
been modified since the last
2002, Marchany
tar
compress, uncompress, zcat
 Compress command tries to make a file smaller
in size by using Lempel-Zic encoding. If
successful, the file name has a .Z appended to it.
 Uncompress returns the file to its original size.
 Zcat does the same as uncompress but it leaves
the original file alone. It uncompresses the file in
memory and writes it out to standard output.
Saves some space.
va-scan
Copyright 2002, Marchany
pack, unpack, pcat, zip
 The pack command is a functional
equivalent to the compress command.
 Unpack is the functional equivalent of the
uncompress command.
 Pcat is like zcat.
 Zip implements the common PKZIP format
found in Windows. Unzip does the reverse.
va-scan
Copyright 2002, Marchany
Download