# dd If=/dev/zero of=/var/swap/file.swp bs=1024 count=65536//create 64M size filesAdd # dd IF=/DEV/SDA of=/dev/sdb//SDA Copy to SDB
# Find/-name ABC > Abc.find 2>/dev/null//Find ABC file results input into the Abc.find file, the error is not read
# du-h/VAR/SWAP/FILE.SWP
3. # MKSWAP/VAR/SWAP/FILE.SWP//Use the file you just created as a swap space
4. # Vi/etc/fstab
/VAR/SWAP/FILE.SWP swap swap defaults 0 0//edit on Start swap
5. Free//# FREE-M
6. SWAPON/VAR/SWAP/FILE.SWP//enable this space to close the command Swapoff
7. Free
Disk quotas1. Enable Partition quota function
Edit the/etc/fstab file to add a flag on the Mount attribute
Usrquota user quotas or Grpquota user group quotas
/dev/sda3/home ext3 Defaults,usrquota 1 2
Mount-o Remount/home
Temporary settings: Mount-o remount,usrquota/home
2. Set up quota database (enter single user mode)
Quotacheck-cvuga
Generates Aquota.user, aquota.group two files
3. Start Quota function
Quotaon Partition name Quotaon/home
Quotaoff Closing Quotas Quotaon/home
4. Edit User Quotas
Edquota User Name
Edquota-g User Group Name
Edquota-t Setting the grace period
Copy user Quotas
Edquota-p template User Replication User 1 replication User 2
Quota command to view user quota usage
Administrator View quota information: repquota-a
Options for creating quotas
? Soft limits (Soft limit): Defines the amount of magnetism that a user can occupy
Number of disk spaces. When a user exceeds the limit, a warning is received that exceeds the quota.
? Hard limit: When a user tries to store a file
A file system error is reported when it has exceeded the limit value directory.
? Grace period: Defines the period in which users can use their file systems under soft limits.
Potential threats to the system? System hardware Failure
? Software failure
? Power failure
? User's error operation
? Human destruction
? Content in the cache is not written to disk in a timely manner
? Natural disasters
Selection of Backup media
? Backup media
? Hard disk
? Disc
? Tape
Removable Storage devices
? Typically, when selecting backup media, trade-offs from reliability, speed, and media prices
Backup policy
? Full backup
Make a full backup of the system at every time,
This allows the system to fail during the backup interval
When data is lost, the last number of backups can be used
Back to the last backup.
? Incremental backup
Make a full backup first, and then each short
Time, but just back up each short
Changes in the time period.
Classification of backups
? System backup
? Implementing backups of operating systems and applications
? Try to restore the system's operation quickly and easily after the system crashes
? Main backup/etc,/boot,/var/log,/usr/local, etc.
? Generally only occurs when the system content changes
? User Backup
? Implementing a backup of the user's files/home
? Frequent changes in user data
? The incremental backup strategy is often used
Record changes to establish a backup log
? Recording system changes
? Record a detailed description of what changes were made to the system and why it was modified
? Create a BACKUP Log
? Use the BACKUP Log table
? Proper safekeeping
Example of a BACKUP log table
? Machine name, IP address, storage location
? Backup time
? Backup media and its number
? Backed-up file system
? Backed-up directories and files
? Backup commands to use
? Backup personnel and other
Example of CP command backup
Backup directory:
CP-RPU Backup Directory Destination Directory
-P Keep backup directory and file attributes
-U Incremental Backup
Remote Backup available SCP
Added: # cp-p/etc/inittab/backup/inittab_20110325.bak
Example of using the TAR command
# Tar-zcf/backup/sys_20110303.tar.gz/etc/boot
Backup/etc directory, can package multiple directories at the same time
# TAR-ZCF BACKUP_USER_20110303.TAR.GZ/ETC/PASSWD
/etc/shadow/etc/group/etc/gshadow
Backup of specified files in/etc directory
# TAR-ZTF Backup_user_20110303.tar.gz
To view a file in a backup package (no package)
# tar-zxf/backup/etc_20110303.tar.gz
Restore/etc directory, default restore to the packaged file source directory,
-C To specify the restore directory
# TAR-ZXF backup_user_20110303.tar.gz Etc/group
Restore only the specified files in the backup
# TAR-RF Backup_user_20110303.tar
/etc/default/useradd/etc/login.defs
Append the contents of/etc/default/useradd,/etc/login.defs to Backup_user_20110303.tar
# Tar-uf BACKUP_USER_20110303.TAR/ETC/PASSWD
Append the modified content in the/ETC/PASSWD directory to the backup file
*-R and-u options can only be used for tar packages
Example of a tar command backup
Add time to the backup file name (Month day)
# tar-zcf/backup/etc_$ (Date +%f). tar.gz/etc
Add Month day hour minute
# tar-zcf/backup/etc_$ (Date +%y.%m.%d-%h%m). tar.gz/etc
Summary of Knowledge points
? Linux File System composition
? File System Administration Commands
? Sticky bit permissions
? How to add a new hard disk
? /etc/fstab configuration File Settings
? Swapfile function settings
? Disk quota Settings
? Backup concept and CP, tar command backup application
Practice
? Adhesive position Test
? ACL permission settings
? To add a new hard drive partition
? Increase swap space with swapfile function
? Set User disk quotas
? Backup system data combined with scheduled Tasks application
? File System Operations Command