1
這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。
/etc/bash_completion.d/zfs-fuse
/etc/rc.d/init.d/zfs-fuse
/usr/sbin/zdb
/usr/sbin/zfs
/usr/sbin/zfs-fuse
/usr/sbin/zpool
/usr/sbin/ztest
/usr/share/doc/zfs-fuse
/usr/share/doc/zfs-fuse/BUGS
/usr/share/doc/zfs-fuse/CHANGES
/usr/share/doc/zfs-fuse/HACKING
/usr/share/doc/zfs-fuse/INSTALL
/usr/share/doc/zfs-fuse/LICENSE
/usr/share/doc/zfs-fuse/README
/usr/share/doc/zfs-fuse/STATUS
/usr/share/doc/zfs-fuse/TESTING
/usr/share/doc/zfs-fuse/TODO
/usr/share/man/man1/zdb.1.lzma
/usr/share/man/man1/zfs.1.lzma
/usr/share/man/man1/zpool.1.lzma
zpool
missing command
usage: zpool command args ...
where 'command' is one of the following:
create [-fn] [-o property=value] ...
[-O file-system-property=value] ...
[-m mountpoint] [-R root]
...
destroy [-f]
add [-fn]
...
remove
...
list [-H] [-o property[,...]] [pool] ...
iostat [-v] [pool] ... [interval [count]]
status [-vx] [pool] ...
online
...
offline [-t]
...
clear
[device]
attach [-f]
detach
replace [-f]
[new-device]
scrub [-s]
...
import [-d dir] [-D]
import [-o mntopts] [-o property=value] ...
[-d dir | -c cachefile] [-D] [-f] [-R root] -a [-v]
import [-o mntopts] [-o property=value] ...
[-d dir | -c cachefile] [-D] [-f] [-R root]
[newpool]
export [-f]
...
upgrade
upgrade -v
upgrade [-V version] <-a | pool ...>
history [-il] [
] ...
get <"all" | property[,...]>
...
set
# zfs
missing command
usage: zfs command args ...
where 'command' is one of the following:
create [-p] [-o property=value] ...
create [-ps] [-b blocksize] [-o property=value] ... -V
destroy [-rRf]
snapshot [-r] [-o property=value] ...
rollback [-rRf]
clone [-p] [-o property=value] ...
promote
rename
rename -p
rename -r
list [-rH][-d max] [-o property[,...]] [-t type[,...]] [-s property] ...
[-S property] ... [filesystem|volume|snapshot] ...
set
...
get [-rHp] [-d max] [-o field[,...]] [-s source[,...]]
<"all" | property[,...]> [filesystem|volume|snapshot] ...
inherit [-r]
...
upgrade [-v]
upgrade [-r] [-V version] <-a | filesystem ...>
userspace [-hniHp] [-o field[,...]] [-sS field] ... [-t type[,...]]
groupspace [-hniHpU] [-o field[,...]] [-sS field] ... [-t type[,...]]
mount
mount [-vO] [-o opts] <-a | filesystem>
unmount [-f] <-a | filesystem|mountpoint>
share <-a | filesystem>
unshare [-f] <-a | filesystem|mountpoint>
send [-R] [-[iI] snapshot]
receive [-vnF]
receive [-vnF] -d
allow
allow [-ldug] <"everyone"|user|group>[,...]
[,...]
allow [-ld] -e
[,...]
allow -c
[,...]
allow -s @setname
[,...]
unallow [-rldug] <"everyone"|user|group>[,...]
[
[,...]]
unallow [-rld] -e [
[,...]]
unallow [-r] -c [
[,...]]
unallow [-r] -s @setname [
[,...]]
Each dataset is of the form: pool/[dataset/]*dataset[@name]
For the property list, run: zfs set|get
For the delegated permission list, run: zfs allow|unallow
[root@info /]# mkdir /zfs
[root@info /]# dd if=/dev/zero of=/zfs/zfs-1.dat bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.594376 s, 176 MB/s
[root@info /]# dd if=/dev/zero of=/zfs/zfs-2.dat bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.671803 s, 156 MB/s
[root@info /]# zpool create test /zfs/zfs-1.dat /zfs/zfs-2.dat
[root@info /]# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
test 191M 78K 191M 0% ONLINE -
[root@info /]# zpool status
pool: test
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
test ONLINE 0 0 0
/zfs/zfs-1.dat ONLINE 0 0 0
/zfs/zfs-2.dat ONLINE 0 0 0
errors: No known data errors
[root@info /]# zfs create test/n1
[root@info /]# zfs create test/n2
[root@info /]#
[root@info /]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 134K 159M 23K /test
test/n1 21K 159M 21K /test/n1
test/n2 21K 159M 21K /test/n2
[root@info /]# zfs set mountpoint=/n1 test/n1
[root@info /]# zfs set mountpoint=/n2 test/n2
[root@info /]#
[root@info /]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 152K 159M 23K /test
test/n1 21K 159M 21K /n1
test/n2 21K 159M 21K /n2
[root@info /]# df -h | grep test
test 159M 21K 159M 1% /test
test/n1 159M 21K 159M 1% /n1
test/n2 159M 21K 159M 1% /n2
[root@info /]# for((i=1;i<100;i++)); do cat /etc/termcap >> /n1/file1.dat; done
[root@info /]#
[root@info /]# ls -lh /n1/
total 66M
-rw-r--r-- 1 root root 67M Jan 21 05:32 file1.dat
[root@info /]#
[root@info /]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 66.9M 92.1M 24K /test
test/n1 66.6M 92.1M 66.6M /n1
test/n2 21K 92.1M 21K /n2
[root@info /]#
[root@info /]# df -h | grep test
test 93M 21K 93M 1% /test
test/n1 159M 67M 93M 42% /n1
test/n2 93M 21K 93M 1% /n2
[root@info /]# zfs set compression=on test/n2
[root@info /]#
[root@info /]# for((i=1;i<100;i++)); do cat /etc/termcap >> /n2/file1.dat; done
[root@info /]#
[root@info /]# ls -lh /n2/file1.dat
-rw-r--r-- 1 root root 67M Jan 21 05:37 /n2/file1.dat
[root@info /]#
[root@info /]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 110M 48.9M 21K /test
test/n1 66.6M 48.9M 66.6M /n1
test/n2 43.0M 48.9M 43.0M /n2
[root@info /]#
[root@info n1]# df -h | grep test
test 44M 21K 44M 1% /test
test/n1 111M 67M 44M 61% /n1
test/n2 92M 49M 44M 53% /n2
[root@info n1]#
[root@info /]# md5sum /n1/file1.dat /n2/file1.dat
30e4f82d620e3bdc3999ce96f5c93cde /n1/file1.dat
30e4f82d620e3bdc3999ce96f5c93cde /n2/file1.dat
[root@info /]#
[root@info /]# dd if=/dev/zero of=/zfs/zfs-3.dat bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.534388 s, 196 MB/s
[root@info /]#
[root@info /]# zpool add test /zfs/zfs-3.dat
[root@info /]#
[root@info /]# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
test 286M 115M 171M 40% ONLINE -
[root@info /]#
[root@info /]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 115M 139M 21K /test
test/n1 66.6M 139M 66.6M /n1
test/n2 48.2M 139M 48.2M /n2
[root@info /]#
[root@info /]# df -h | grep test
test 140M 21K 140M 1% /test
test/n1 206M 67M 140M 33% /n1
test/n2 188M 49M 140M 26% /n2
[root@info /]# zfs clone test/n1@20100121 test/n3
[root@info /]#
[root@info /]# zfs set mountpoint=/n3 test/n3
[root@info /]#
[root@info /]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 115M 139M 21K /test
test/n1 66.6M 139M 66.6M /n1
test/n2 48.2M 139M 48.2M /n2
test/n3 16K 139M 66.6M /n3
[root@info /]# df -h | grep test
test 140M 21K 140M 1% /test
test/n1 206M 67M 140M 33% /n1
test/n2 188M 49M 140M 26% /n2
test/n3 206M 67M 140M 33% /n3
[root@info ~]# ls -lh /n1/file1.dat
-rw-r--r-- 1 root root 67M Jan 21 05:46 /n1/file1.dat
[root@info ~]#
[root@info ~]# cat /n1/file1.dat >> /n3/file1.dat
[root@info ~]#
[root@info ~]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 174M 80.7M 21K /test
test/n1 66.6M 80.7M 66.6M /n1
test/n2 48.2M 80.7M 48.2M /n2
test/n3 66.6M 72.0M 133M /n3
[root@info ~]#
[root@info ~]# df -h | grep test
test 73M 21K 73M 1% /test
test/n1 139M 67M 73M 49% /n1
test/n2 121M 49M 73M 41% /n2
test/n3 206M 133M 73M 65% /n3
[root@info ~]#
[root@info ~]# ls -lh /n3/file1.dat
-rw-r--r-- 1 root root 133M Jan 21 06:31 /n3/file1.dat
[root@info n3]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
test 183M 71.4M 21K /test
test/n1 66.6M 71.4M 66.6M /n1
test/n2 48.2M 71.4M 48.2M /n2
test/n3 67.2M 71.4M 133M /n3
Clones
A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space.
iptables-save
iptables -L
iptables -t nat -L
iptables -L -n
iptables -t nat -L -n
iptables -L -n -v
iptables -t nat -L -n -v
/etc/init.d/iptables stop
chkconfig iptables off
# With this variable you can determine if the SuSEfirewall when enabled
# should get started when network interfaces are starte
FIREWALL="yes|no"
這可以設定每次啟動網路時是否啟用 firewall 配置。iptables-restore < /etc/sysconfig/iptables
iptables-save > /etc/sysconfig/iptables
# Load additional iptables modules (nat helpers)
# Default: -none-
# Space separated list of nat helpers (e.g. 'ip_nat_ftp ip_nat_irc'),
# which are loaded after the firewall rules are applied. Options for
# the helpers are stored in /etc/modprobe.conf.
IPTABLES_MODULES=""
===== iptables -F # 若是沒有加上 -t 指定 table,預設是使用 -t filter
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
iptables -P INPUT ACCEPT # 沒加上 -t 指定 table,預設使用 -t filter
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT
iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
http://ebtables.sourceforge.net/br_fw_ia/bridge3b.png
iptables -P INPUT ACCEPT
iptables -A INPUT -s 192.168.1.1 -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -j DROP
iptables -P INPUT ACCEPT
iptables -A INPUT -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -j DROP
iptables -P INPUT ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -j DROP
......
iptables -P INPUT DROP
iptables -A INPUT -s 192.168.1.0/24 -j ACCEPT
......
iptables -P INPUT DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
modprobe ip_conntrack_ftp # 若是 kernel 2.6 開始請改成 modprobe nf_conntrack_ftp
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
modprobe ip_conntrack_ftp ports=21,30000 # kernel 2.6 開始改成 nf_conntrack_ftp
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 30000 -j ACCEPT
iptables -P INPUT ACCEPT
iptables -P OUTPUT DROP
iptables -P OUTPUT DROP
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -P OUTPUT DROP
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A OUTPUT -p tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
PDP-IP: 10.128.18.116modprobe ip_conntrack_ftp # kernel 2.6 開始要改成 nf_conntrack_ftp
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
modprobe ip_conntrack_ftp # kernel 2.6 開始要改成 nf_conntrack_ftp
iptables -P INPUT ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -m state --state NEW,INVALID -j DROP
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A POSTROUTING -t nat -s 192.168.1.0/24 -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A POSTROUTING -t nat -s 192.168.1.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe ip_nat_ftp # kernel 2.6 開始改成 nf_nat_ftp
iptables -A POSTROUTING -t nat -o eth0 -s 192.168.1.0/24 -j MASQUERADE
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A PREROUTING -t nat -d 210.1.1.1 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -A POSTROUTING -p tcp -d 192.168.1.1 --dport 80 -s 192.168.1.0/24 -j SNAT --to 192.168.1.254
iptables -A POSTROUTING -t nat -s 192.168.1.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A POSTROUTING -t nat -s 192.168.1.0/24 -j SNAT --to 210.1.1.1
echo 1 > /proc/sys/net/ipv4/ip_forward