2014年5月10日 星期六

[轉貼] web server 設定對特定 IP 來源限速 XD

同個目的多種做法 XD

來源:
How to throttle the FCC to dial up modem speeds on your website using Nginx
https://gist.github.com/kyledrake/e6046644115f185f7af0

2014年5月1日 星期四

網樂通改機筆記(2) - 201404 -用 sh4twbox 開機後試玩的事


在功能選單試看看備份的選項
============ Please Enter Number:
3

We use 'nc' for backup, for example

To Server (192.168.1.1): nc -l -p 8888 > backup.dd
From Host (192.168.1.5): dd if=/dev/sda bs=1M | nc 192.168.1.1 8888

type 'nc -l -p 8888 > backup.dd' on server, Enter when ready:
Enter backup server IP:
Enter backup device (default:/dev/sda):

Wait about 16 minutes, file size should be 8,027,897,856
Start Backup Sat Apr DD hh:mm:ss CST 2014...

nc: can't connect to remote host (0.0.34.184): Invalid argument

因為開機碟空間不大所以吃不下


試著備份一點東東…不過沒啥保留意義了
dd if=/dev/sdb1 of=/mnt/sda1/ sdb1.dd
617101+0 records in
617101+0 records out
315955712 bytes (301.3MB) copied, 86.870065 seconds, 3.5MB/s


把原有的分割區全部掛起來看看
df -h

Filesystem     Size      Used Available Use% Mounted on
/dev/sda1       1.9G    174.3M      1.7G   9% /mnt/sda1
/dev/sdb1     291.9M    212.7M     73.2M  74% /mnt/sdb1
/dev/sdb2     291.9M    121.6M    164.3M  43% /mnt/sdb2
/dev/sdb4     866.4M     21.2M    827.6M   3% /mnt/sdb3
/dev/sdb3       6.0G      4.7G      1.3G  79% /mnt/sdb4




  • 準備把 DOM 的空間砍掉重練(應該要先全部 umount)


     這次目標是朝這方向做  http://lyhpcha.pixnet.net/blog/post/88474418

     再看最後一眼…
fdisk -l

Disk /dev/sdb: 8027 MB, 8027897856 bytes
160 heads, 19 sectors/track, 5157 cylinders
Units = cylinders of 3040 * 512 = 1556480 bytes

 Device Boot     Start         End      Blocks  Id System
/dev/sdb1            1         203      308550+ 83 Linux
/dev/sdb2          204         406      308560  83 Linux
/dev/sdb3          407        4546     6292800  83 Linux
/dev/sdb4         4547        5139      901360  83 Linux

Disk /dev/sda: 2059 MB, 2059403264 bytes
96 heads, 37 sectors/track, 1132 cylinders
Units = cylinders of 3552 * 512 = 1818624 bytes

  Device Boot     Start         End      Blocks  Id System
/dev/sda1             1        1133     2011078+  6 FAT16

  再看一下 fdisk 工具
fdisk

BusyBox v1.21.1 (2013-09-11 14:47:43 CST) multi-call binary.

Usage: fdisk [-ul] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK

Change partition table

   -u             Start and End are in sectors (instead of cylinders)
   -l             Show partition table for each DISK, then exit
   -b 2048        (for certain MO disks) use 2048-byte sectors
   -C CYLINDERS   Set number of cylinders/heads/sectors
   -H HEADS
   -S SECTORS

fdisk  /dev/sdb1

The number of cylinders for this disk is set to 5157.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m
Command Action
a       toggle a bootable flag
b       edit bsd disklabel
c       toggle the dos compatibility flag
d       delete a partition
l       list known partition types
n       add a new partition
o       create a new empty DOS partition table
p       print the partition table
q       quit without saving changes
s       create a new empty Sun disklabel
t       change a partition's system id
u       change display/entry units
v       verify the partition table
w       write table to disk and exit
x       extra functionality (experts only)

  用 d 把後面幾個砍了

  再用 n 建立新的分割區

  可再參考  http://changcancan.pixnet.net/blog/post/42716197

  這次在最後建了個 swap 分割

Command (m for help): p

Disk /dev/sdb: 8027 MB, 8027897856 bytes
160 heads, 19 sectors/track, 5157 cylinders
Units = cylinders of 3040 * 512 = 1556480 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1               1         203      308550+ 83 Linux
/dev/sdb2             204        5002     7294480  83 Linux
/dev/sdb3            5003        5157      235600  83 Linux



Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap)

Command (m for help):  v
18 unallocated sectors

Command (m for help):  w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy



BloggerAds