Two Mount methods affect the script for mounting external devices:/etc/fstab boot script: inittab contains some running command user script: login. defs limits the user's password modification time and idgid expiration time .. Automatic mounting: attach an image disc to a VM --- VM -...
Two Mount methods
Script that affects mounting external devices:/etc/fstab
Boot script: the inittab contains some running commands.
User script: login. defs limits the user's password modification time and id gid expiration time ..
Automatic mounting
Attach an image disk
Virtual machine --- VM --- settings --- CD/DVD --- specify the path of the scene file (the first disc )---
Device status: the first Device status is recommended.
Connected: as long as an external device is mounted, the system will identify
Connectedpower on: identify once upon startup;
Open: Vi/etc/fstab
Syntax format:
Each row is a record.
6 fields
External device name |
Mount point |
File system type |
Restrictions |
Power-on self-check |
Backup or not (priority) |
/Dev/cdrom |
/Mnt/ |
Ext3 |
Hardware device (default: ULTS) |
0, 1 |
0, 1 |
Mount your external device by writing a new line of data in this format.
Command mount:
# Mount-t type external device mount point
Note: Mount point settings
It is not recommended to map directly to/mnt
Prevent/mnt from being mounted to other devices (one by one directory (create a directory under/mnt ))
Try to create a new directory for mounting
Detach a USB flash drive from an external device
Umount mobile device or mount point
Umount/dev/spd (/mnt/)
Schedule tasks
1. schedule tasks (repetitive) cron
1) Note: One-time task at (which can be viewed on the fifth day of week 16th)
Cron is a task scheduling tool installed in the same rpm package.
Check whether the software has been installed
# Rpm-qa | grepcron
2) enable the corresponding service
The system checks the corresponding script file every minute.
# Service crond start
# Vi/etc/crontab
Vi open the directory as follows:
[Root @ localhost cdrom] # cat/etc/crontab
SHELL =/bin/bash
PATH =/sbin:/bin:/usr/sbin:/usr/bin
MAILTO = root
HOME =/
Name = value definition variable
# Run-parts
01 *** root run-parts/etc/cron. hourly
02 4 *** root run-parts/etc/cron. daily
22 4 ** 0 root run-parts/etc/cron. weekly
42 4 1 ** root run-parts/etc/cron. monthly
42 4 1 ** rootrun-parts/etc/cron. hourly
Minute Hour date month week user script
0-59 0-23 1-31 1-12 0-6
The first way to schedule tasks: compile files in a fixed Directory
Replace "*" with the meaning of "every day" (every month .....)
For example, schedule the system to replicate every hour.
# Cd/etc/cron. hourly
# Touch filename
# Vi filename
Write the command you want to execute
42 4 1 ** command
Method 2: directly use crontab to edit the script
# Crontab-e the following task format is saved to/var/spool/cron by default.
-E edit
-L list
-R remove
-U zhy specifies a user to execute the task. by default, root is not written.
Root schedule task crontab-e
Root specifies the lisi execution task crontab-u lisi-e
Schedule tasks:
Back up/etc to external devices at half past four P.M., January 1, December 25 every year
30 16 25 12 * cp-r/etc/mnt/cdrom
Back up/etc to external devices from four o'clock P.M. to half past six on January 1, December 25
30 4-6 25 12 * cp-r/etc/mnt/cdrom
Note:
Separate time points with spaces or tabs
The value range is 16-18.
Independent time (16, 18)
* Indicates any time point
Based on the above two ways of adding tasks, they have the same syntax for adding tasks.
Back up/etc to external devices from four o'clock P.M. to half past six on January 1, December 25
30 4-6 25 12 * cp-r/etc/mnt/cdrom
However, for the first type, the data is usually used less, and the second type has more data.
Add hard disk --
Step 1:
Steps for adding a hard disk
Disable the system: otherwise, only SCSI hard disks can be installed.
In the VM --- settings ---- HARD --- add --- next-IDE
Restart a VM
Open Terminal
# Fdisk-l
External hardware devices recognized by the detection system
There are two hard disk connection methods
IDE type
Hard disk
/Etc/hda indicates the first hard disk
/Etc/hda0 --- the first primary partition on the first hard disk
/Etc/hda0 --- the first primary partition on the first hard disk
/Etc/hdb indicates the second hard disk
/Etc/hdb0 --- the first primary partition on the second hard disk
/Etc/hdb0 --- the first primary partition on the second hard disk
USB flash drive sda sdb
Scsi type
Hard disk
/Etc/sda indicates the first hard disk
/Etc/sda0 --- the first primary partition on the first hard disk
/Etc/sda0 --- the first primary partition on the first hard disk
/Etc/sdb indicates the second hard disk
/Etc/sdb0 --- the first primary partition on the second hard disk
/Etc/sdb0 --- the first primary partition on the second hard disk
USB flash drive: sda sdb
From the column wjc19911118