===========Data recovery =============
----extundelete (only ext3 and ext4 file systems are supported)
1. Find the directory id
ls where the deleted file is located -id /xxx/xxx/
2. View the deleted upper-level directory inode
# extundelete is the partition name--inode ID number
extundelete /dev/sdb1 --inode 130619
3. Restore data, restore all deleted data in the specified directory
# extundelete The name of the partition where the data is located --restore-directory The directory where the data is restored
extundelete /dev/sdb1 --restore-directory /xxx/xxx/xxx/
----xfsdump /xfsrestore (requires backup in advance) ------
Format: #Backup the
entire partition
xfsdump -f Backup storage location to backup file system #Free
interactive backup
xfsdump -f backup storage location file system to be backed up -L backup session label -M device label
#directory in the backup partition
xfsdump -f backup storage location -s relative path of the file to be backed up file system -L backup session label -M device Tags
#View backup messages
xfsdump -I #Backup
message storage location
var/lib/xfsdump/inventory #Delete
backup
rm -rf Backup storage location
incremental backup: #First
perform a full backup
xfsdump -f /opt/test-full /sdb1- L test-full -M media0 #The
first incremental backup
xfsdump -l 1 -f /opt/test-back1 /sdb1 -L test-full -M media0
-l level Backup level
#Re-incremental backup is level 2
xfsdump -l 2 -f /opt/test-back2 /sdb1 -L test-full -M media0
Data recovery: #full
backup partition recovery
xfsrestore -f backup storage location data address after recovery #Full
backup directory recovery
xfsrestore -f backup storage location [-s relative path of the recovery file] Data address after recovery #incremental
backup recovery
#先 recovery full backup
#Restore the last incremental backup
xfsrestore -f /opt/test-full /sdb1/xfsrestore -f /opt/test-back1 /sdb1/xfsrestore -f /opt/test-back2 /sdb1/
===========Network related ===========
--------curl command------------
-X,- -request <command>
-i,
--include HTTP-header -H, --header <header>
-d, --data <data>
-u user:pass #Specify username and password
https:
curl -v https:/ /172.17.1.1 --cacert ca.crt --cert ./client.crt --key client.key
post Specify the header as json:
curl -H "Content-Type: application/json" -d'{"username": "zhangsan","type":0}' http://10.0.0.66:8000/queries.json
----wget------
Recursive download:
-r, --recursive specify recursive download.
-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).
-m, --mirror shortcut for -N -r -l inf --no-remove- Listing.
HTTPS (SSL / TLS) Options:
--no-the Check-Certificate do not the validate at The Server's Certificate.
adding timeout:
wget -q -T90 --no-Proxy HTTP: // blah: 8888 / file.zip
cancel wget proxy:
--no-proxy (or --proxy=off)
or /etc/wgetrc or ~/.wgetrc to delete proxy settings
requires account password:
wget ftp://10.0.0.66/xxx.war --user=ftp --password=password
output directly to the screen:
wwget http://xxx.com -q -O-
----------tc network damage------
Add:
tc q add dev eth1 root netem delay 340ms 50ms loss 5% rate 2mbit
Modification:
tc q change dev eth0 root netem delay 340ms 50ms loss 5 % rate 2mbit
340ms delay, 50ms jitter, 5% packet loss, bandwidth 2m
Query: tc q or tc qdisc
delete: tc qdisc del dev eth0 root
root is the root, you can write the superior id, tc q view id
netem is the network simulation function module, tc can control its working mode
--ping
ping -c 5 Specify the number of times
ping -c 2 -I 192.168.0.1 172.17.1.2
-I Connect from the specified port
--nc #Listener
1234 port
nc -lp 1234 #Send
message and exit
nc -w 1 192.168.80.172 1234 #Send
message without exit, ctrl+d exit
nc 192.168.80.172 1234 #Send
file
nc -w 1 192.168.80.172 1234 <jenkins.log
format:
nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]
[-x proxy_address[:port]] [hostname] [port[s]]
parameter description:
-4 mandatory use of ipv4
-6 mandatory use of ipv6
-D allow socket communication to return debug information
-d is not allowed to read from standard input
-h displays nc help file
-i interval
specifies the delay between sending and receiving content between each line, it can also delay the connection between multiple ports
-k when a connection ends , Force nc to monitor another connection. Must be used with
-l -l is used to monitor incoming data links, and cannot be used with -p -z -s. The timeout of the -w parameter will also be ignored
-n does not execute any address, hostname, port or DNS query
-p specifies the source port used by nc, which is restricted by permissions and cannot be used together with -l
-r specifies the source port used by nc And the destination port, you cannot use those ports originally specified by the system
-S allows the TCP MD5 signature option in RFC 2385
-s source_ip_address to
specify the IP address of the interface used to send the packet, and cannot be used with -l
-T ToS
specifies the IP of the link Type of service (TOS)
-C wrap
-t enable nc to interact with telnet
-U use UNIX domain socket
-u Use udp instead of the default tcp option
-v Output detailed report
-w timeout
A link will be automatically disconnected if there is no operation for a period of time, and there is no timeout by default
-X proxy_version
specifies the protocol used when nc uses the proxy, optional socksv4 , Socks5 and https. The default socks5
-x proxy_address[:port]
specifies the proxy address and port used by nc. Default setting: 1080 (SOCKS), 3128 (HTTPS)
-z only listens and does not send any packets