crontab 执行(超时)中断错误
今天碰到了 crontab 执行命令半截中断的情况。查看日志中断的位置并没有什么特殊操作,查看内存,并没有内存不足的情况。记不清楚来源的资料说过太多的标注输出也有可能造成 crontab 命令中断,遂将标准输出完全重定向到log文件,经测试没有再次出现中断现象。问题解决。
*/5 * * * * root /usr/bin/命令 > /log.log 2>&1
今天碰到了 crontab 执行命令半截中断的情况。查看日志中断的位置并没有什么特殊操作,查看内存,并没有内存不足的情况。记不清楚来源的资料说过太多的标注输出也有可能造成 crontab 命令中断,遂将标准输出完全重定向到log文件,经测试没有再次出现中断现象。问题解决。
*/5 * * * * root /usr/bin/命令 > /log.log 2>&1
linaro@cubieboard:~$aptitude install cups
linaro@cubieboard:~$ sudo vi /etc/cups/cupsd.conf
# 修改相关的内容
Listen 0.0.0.0:631
Browsing On
# Restrict access to the server...
Order allow,deny
Allow All
# Restrict access to the admin pages...
Order allow,deny
Allow All
# Restrict access to configuration files...
AuthType Default
Allow All
Require user @SYSTEM
Order allow,deny
linaro@cubieboard:~$ sudo usermod -aG lpadmin 账号名
linaro@cubieboard:~$ sudo /etc/init.d/cups restart
现在访问 http://ip:631 可以看到cups的管理界面,选择”Adding Printers and Classes”输入账号及密码,正常情况下应该把打印机识别出来了,按说明填写即可。
我这里型号没找到,只能自己在 http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX 下载的驱动,然后从里面找到打印机的ppd文件上传到 cups 上面的。
打印测试页却发现无法打印,提示 Idle – “File “/opt/epson-inkjet-printer-201207w/cups/lib/filter/epson_inkjet_printer_filter” not available: No such file or directory” ,在官方网站没有找到 arm 的驱动,无奈下载
epson-inkjet-printer-201207w-1.0.0-1lsb3.2.src.rpm 。 alien rpm 提示 is for architecture amd64 ; the package cannot be built on this system,无法使用,只能自己也压缩编译了。
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ sudo aptitude install libcups2-dev
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ sudo aptitude install libcupsimage2-dev
linaro@cubieboard:~$ rpm2cpio epson-inkjet-printer-201207w-1.0.0-1lsb3.2.src.rpm | cpio -div
epson-inkjet-printer-201207w-1.0.0.tar.gz
epson-inkjet-printer-201207w.spec
epson-inkjet-printer-filter-1.0.0.tar.gz
4991 blocks
linaro@cubieboard:~$ tar -xzf epson-inkjet-printer-filter-1.0.0.tar.gz
linaro@cubieboard:~$ cd epson-inkjet-printer-filter-1.0.0/
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ ./configure --prefix=/opt
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ make
linaro@cubieboard:~/epson-inkjet-printer-filter-1.0.0$ make install
linaro@cubieboard:/opt$ sudo mkdir -p /opt/epson-inkjet-printer-201207w/cups/lib/filter/
linaro@cubieboard:/opt$ sudo ln -s /opt/lib/cups/filter/epson_inkjet_printer_filter /opt/epson-inkjet-printer-201207w/cups/lib/filter/epson_inkjet_printer_filter
linaro@cubieboard:/opt$ sudo /etc/init.d/cups restart
sudo aptitude install lsb # 这个也许需要安装。
好了,打印机安装完毕。可以 windows 远程使用了。现在打开 http://IP:361/printers/ 找到安装的打印机,点开他,然后把这个 URL 拷贝下来。在WINDOWS 下 打印机 => 添加打印机 => 添加网络、无线或 Bluetooth 打印机我这里直接自动就把打印机搜索出来了,如果没有搜索出来,需要手工输入之前拷贝下来的 URL ,然后会提示需要驱动,我这里自动搜索驱动没成功,手工选择的对应驱动。继续下一步,接着可以打印测试页试一下,一切正常的话应该打印出来了。
目前还有一个问题是,在 http://IP:361/printers/ 打印测试页时出错,目前先这样吧,反正很少直接在cups打印测试页,都是在windows下操作,windows下操作没有问题。
另附编译好的驱动及ppd文件,具体能用到哪些打印机就不确定了…
linaro@cubieboard:~$ sudo aptitude install smartmontools
linaro@cubieboard:~$ sudo smartctl -a /dev/sda
smartctl 6.2 2013-07-26 r3841 [armv7l-linux-3.4.79] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.10
Device Model: ST3160815AS
Serial Number: 6RA0H0PJ
Firmware Version: 3.AAC
User Capacity: 160,041,885,696 bytes [160 GB]
Sector Size: 512 bytes logical/physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA/ATAPI-7 (minor revision not indicated)
Local Time is: Tue Apr 28 10:24:05 2015 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
See vendor-specific Attribute list for marginal Attributes.
General SMART Values:
Offline data collection status: (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 430) seconds.
Offline data collection
capabilities: (0x5b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 54) minutes.
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 112 095 006 Pre-fail Always - 42480436
3 Spin_Up_Time 0x0003 098 097 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 094 094 020 Old_age Always - 6735
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 089 060 030 Pre-fail Always - 833016196
9 Power_On_Hours 0x0032 067 067 000 Old_age Always - 28938
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 094 094 020 Old_age Always - 6263
187 Reported_Uncorrect 0x0032 082 082 000 Old_age Always - 18
189 High_Fly_Writes 0x003a 094 094 000 Old_age Always - 6
190 Airflow_Temperature_Cel 0x0022 044 039 045 Old_age Always FAILING_NOW 56 (Min/Max 53/57)
194 Temperature_Celsius 0x0022 056 061 000 Old_age Always - 56 (0 2 0 0 0)
195 Hardware_ECC_Recovered 0x001a 072 060 000 Old_age Always - 170581721
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 1
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 1
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x0000 100 253 000 Old_age Offline - 0
202 Data_Address_Mark_Errs 0x0032 100 253 000 Old_age Always - 0
SMART Error Log Version: 1
ATA Error Count: 18 (device log contains only the most recent five errors)
CR = Command Register [HEX]
FR = Features Register [HEX]
SC = Sector Count Register [HEX]
SN = Sector Number Register [HEX]
CL = Cylinder Low Register [HEX]
CH = Cylinder High Register [HEX]
DH = Device/Head Register [HEX]
DC = Device Command Register [HEX]
ER = Error register [HEX]
ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.
Error 18 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 08 8f a5 6d e0 00 00:01:07.094 READ DMA EXT
25 00 08 87 a5 6d e0 00 00:01:07.094 READ DMA EXT
25 00 08 7f a5 6d e0 00 00:01:07.094 READ DMA EXT
25 00 08 77 a5 6d e0 00 00:01:07.088 READ DMA EXT
25 00 08 6f a5 6d e0 00 00:01:07.088 READ DMA EXT
Error 17 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 68 4f a5 6d e0 00 00:01:03.681 READ DMA EXT
25 00 00 37 9d 6b e0 00 00:01:03.679 READ DMA EXT
25 00 00 37 9c 6b e0 00 00:01:03.677 READ DMA EXT
25 00 00 b7 9a 6b e0 00 00:01:03.669 READ DMA EXT
25 00 00 b7 99 6b e0 00 00:01:03.669 READ DMA EXT
Error 16 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 08 8f a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 87 a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 7f a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 77 a5 6d e0 00 00:20:34.997 READ DMA EXT
25 00 08 6f a5 6d e0 00 00:20:34.996 READ DMA EXT
Error 15 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 68 4f a5 6d e0 00 00:20:31.667 READ DMA EXT
25 00 00 37 9d 6b e0 00 00:20:31.657 READ DMA EXT
25 00 00 37 9c 6b e0 00 00:20:31.654 READ DMA EXT
25 00 00 b7 9a 6b e0 00 00:20:31.643 READ DMA EXT
25 00 00 b7 99 6b e0 00 00:20:31.641 READ DMA EXT
Error 14 occurred at disk power-on lifetime: 12304 hours (512 days + 16 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 96 a5 6d e0 Error: UNC at LBA = 0x006da596 = 7185814
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
25 00 08 8f a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 87 a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 7f a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 77 a5 6d e0 00 00:09:29.947 READ DMA EXT
25 00 08 6f a5 6d e0 00 00:09:29.946 READ DMA EXT
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 14609 -
# 2 Short offline Aborted by host 90% 14609 -
# 3 Short offline Completed without error 00% 14380 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
linaro@cubieboard:~$ sudo hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
Model Number: ST3160815AS
Serial Number: 6RA0H0PJ
Firmware Revision: 3.AAC
Standards:
Supported: 7 6 5 4
Likely used: 7
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 312581808
Logical Sector size: 512 bytes
Physical Sector size: 512 bytes
device size with M = 1024*1024: 152627 MBytes
device size with M = 1000*1000: 160041 MBytes (160 GB)
cache/buffer size = 8192 KBytes
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = ?
Recommended acoustic management value: 208, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* DOWNLOAD_MICROCODE
SET_MAX security extension
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* Gen1 signaling speed (1.5Gb/s)
* Native Command Queueing (NCQ)
* Phy event counters
Device-initiated interface power management
* Software settings preservation
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
not supported: enhanced erase
Checksum: correct
linaro@cubieboard:~$ sudo smartctl -H /dev/sda
smartctl 6.2 2013-07-26 r3841 [armv7l-linux-3.4.79] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022 043 039 045 Old_age Always FAILING_NOW 57 (0 2 57 53 0)
检测磁盘驱动的健康程度SMART
http://www.linuxidc.com/Linux/2014-07/104674.htm
接着上一篇继续
安装 samba ,这里先安装 aptitude 。第一次时是用 apt-get 来安装的 samba ,结果出现包依赖错误,系统都挂了…
linaro@cubieboard:~$ sudo apt-get install aptitude
slinaro@cubieboard:~$ sudo aptitude update
linaro@cubieboard:~$ sudo aptitude safe-upgrade
linaro@cubieboard:~$ sudo aptitude install samba
下面配置账号。
linaro@cubieboard:~$ sudo adduser gftp
Adding user `gftp' ...
Adding new group `gftp' (1002) ...
Adding new user `gftp' (1001) with group `gftp' ...
Creating home directory `/home/gftp' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for gftp
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
linaro@cubieboard:~$ sudo usermod -a -G gftp linaro
linaro@cubieboard:/mnt/100g$ sudo chown gftp:gftp /mnt/100g
linaro@cubieboard:/mnt/100g$ sudo chmod ug+w /mnt/100g
linaro@cubieboard:~$ sudo smbpasswd -a gftp
New SMB password:
Retype new SMB password:
Added user gftp.
linaro@cubieboard:~$ sudo vi /etc/samba/smb.conf
# 追加以下内容:
[gftp_100g]
path = /mnt/100g
available = yes
valid users = gftp
read only = no
browseable = yes
public = yes
writable = yes
linaro@cubieboard:~$ sudo service smbd restart
smbd stop/waiting
smbd start/running, process 24739
好了,现在可以在 windows 下使用 \\IP 来访问共享了。
实测 win7 往 cubieboard 拷贝大文件速度在 9.77M -10.1M之间,应该是cubieboard 100M网卡的性能限制的。
参考:
How to Create a Network Share Via Samba Via CLI (Command-line interface/Linux Terminal) – Uncomplicated, Simple and Brief Way!
https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20%28Command-line%20interface/Linux%20Terminal%29%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!
今天把很早之前的 cubieboard 翻了出来,打算做 nas 。缺点是网卡是100M的。
现在的tf安装的 linaro server 14.04 系统。
tf卡是:三星(SAMSUNG)16GB UHS-1 Class10 TF(Micro SD)存储卡(读速48Mb/s)升级版
http://item.jd.com/763749.html
tf 卡速度为:
linaro@cubieboard:~$ sudo time dd if=/dev/zero bs=1024 count=1000000 of=/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 106.254 s, 9.6 MB/s
0.83user 20.45system 1:46.26elapsed 20%CPU (0avgtext+0avgdata 640maxresident)k
8inputs+2000000outputs (1major+208minor)pagefaults 0swaps
linaro@cubieboard:~$ time dd if=/1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 66.1161 s, 15.5 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 66.1271 s, 15.5 MB/s
real 1m6.146s
user 0m2.350s
sys 0m17.540s
找了一块古董100g硬盘来做测试。
linaro@cubieboard:~$ sudo fdisk -l
....
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe467e467
Device Boot Start End Blocks Id System
....
fdisk 列出硬盘分区,硬盘的分区已经预先删干净了,下面新建一个主分区,并建立文件系统。
linaro@cubieboard:~$ sudo fdisk /dev/sda
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-312581807, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-312581807, default 312581807): +1G
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 2):
Using default value 2
First sector (2099200-312581807, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-312581807, default 312581807):
Using default value 312581807
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sda: 160.0 GB, 160041885696 bytes
81 heads, 63 sectors/track, 61254 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe467e467
Device Boot Start End Blocks Id System
/dev/sda1 2048 2099199 1048576 82 Linux swap / Solaris
/dev/sda2 2099200 312581807 155241304 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
linaro@cubieboard:~$ sudo mkswap /dev/sda1
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=d1ba1e55-5eac-4226-9a2d-cda6eec6a84e
linaro@cubieboard:~$ sudo mkfs.ext4 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
9773056 inodes, 39072470 blocks
1953623 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1193 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks):
done
Writing superblocks and filesystem accounting information:
done
建立目录,挂载分区。
linaro@cubieboard:~$ sudo mkdir /mnt/100g
linaro@cubieboard:/mnt/100g$ cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
tmpfs /tmp tmpfs size=20m 0 0
/dev/sda1 none swap defaults 0 0
/dev/sda2 /mnt/100g ext4 defaults,noatime 0 2
linaro@cubieboard:~$ sudo swapon /dev/sda1
linaro@cubieboard:~$ sudo mount -a
linaro@cubieboard:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 1.5G 5.6G 21% /
devtmpfs 493M 4.0K 493M 1% /dev
none 4.0K 0 4.0K 0% /sys/fs/cgroup
tmpfs 20M 0 20M 0% /tmp
none 99M 244K 99M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 493M 0 493M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda2 147G 188M 140G 1% /mnt/100g
跑磁盘性能测试
linaro@cubieboard:/mnt/100g$ sudo time dd if=/dev/zero bs=1024 count=1000000 of=/mnt/100g/1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 52.1182 s, 19.6 MB/s
0.85user 20.33system 0:52.13elapsed 40%CPU (0avgtext+0avgdata 640maxresident)k
8inputs+2000056outputs (0major+217minor)pagefaults 0swaps
linaro@cubieboard:/mnt/100g$ time dd if=/mnt/100g/1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 39.456 s, 26.0 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 39.469 s, 25.9 MB/s
real 0m39.494s
user 0m2.220s
sys 0m20.660s
linaro@cubieboard:/mnt/100g$
性能并不好,不过由于网卡只有100M,NAS 瓶颈并不在磁盘,而是在网络…
参考:
linux测试硬盘读写速度
http://5iwww.blog.51cto.com/856039/432290
cubieboard的sata评测
http://raspiweb.ch/post-56.htm
ubuntu 自带的 redis 版本太老了,居然是去年1月的版本。决定自己编译安装新版本。
sudo aptitude install build-essential
sudo aptitude install tcl # 可能需要指定版本
wget http://download.redis.io/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
make test
redis-server Redis 服务器文件.
redis-sentinel 守护程序 (监控和故障转移).
redis-cli 命令行界面工具.
redis-benchmark 基准测试.
redis-check-aof and redis-check-dump 损坏数据修复工具.
手动拷贝文件到需要的地方时一个好主意。
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/
也可以使用 make install.
测试时出现过下面的错误,原因是内存不足,完整测试大约需要300M内存,加大内存即可。
[err]: Slave should be able to synchronize with the master in tests/integration/replication-psync.tcl
Replication not started.
[ok]: AOF rewrite of list with linkedlist encoding, int data
[ok]: EVAL does not leak in the Lua stack
[ok]: EVAL processes writes from AOF in read-only slaves
[ok]: We can call scripts rewriting client->argv from Lua
[ok]: Call Redis command with many args from Lua (issue #1764)
[ok]: Number conversion precision test (issue #1118)
[ok]: String containing number precision test (regression of issue #1118)
[ok]: Verify negative arg count is error instead of crash (issue #1842)
[ok]: Correct handling of reused argv (issue #1939)
I/O error reading reply
[exception]: Executing test client: I/O error reading reply.
I/O error reading reply
while executing
参考:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis
http://redis.io/topics/quickstart
Redis 命令参考
http://redis.readthedocs.org/en/latest/index.html
持久化(persistence)
http://redis.readthedocs.org/en/latest/topic/persistence.html
cubieboard ubuntu 默认没有增强自动补全,用起来真难受。
sudo apt-get install bash-completion
修改 /etc/bash.bashrc文件,去掉下面内容的注释
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
然后 source /etc/profile 一下就可以了。
看了一下,发现 ~/.bashrc 下面就有启动增强自动补全的代码,也就是只用安装 bash-completion 就可以了。
我这里路由器做了硬件地址绑定,需要固定ip和mac地址,记一下,下次重装直接拷贝就完了。
root@cubieboard:~# cat /etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 192.168.1.98
netmask 255.255.0.0
gateway 192.168.1.1
hwaddress ether 02:C9:06:C2:98:AB
root@cubieboard:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 219.146.1.66
nameserver 219.147.1.66
http://mirrors.163.com/
http://mirrors.sohu.com/
ubuntu 10.04 源(网易):
deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
我恳请诸位花一点时间读完这篇文章,因为将有数以万计的人会从您的爱心中得到帮助。
Unix-Center.Net的目标是为研究、学习和使用各种版本的Unix和类Unix操作系统的教师、学生和工程技术人员提供一个体验和测试各种版本的Unix和类Unix系统的软硬件平台。该平台能够为所有注册用户免费提供SSH/VNC服务,MySQL数据库服务,传统的C/C++、Java、Fortran等多种语言开发环境,基于Apache、MySQL和PHP的Web应用开发环境。简单地讲,Unix-Center.Net的注册用户可以远程登录进入多个不同的操作系统,具备自己独立的用户空间和磁盘配额,享受该操作系统上普通用户的所有权限,学习和使用各种版本的Unix和类Unix操作系统的常用命令和功能,可以将自己正在开发的应用程序上载到Unix体验中心的服务器,在不同的软硬件平台上编译和运行。
到目前为止,Unix-Center.Net所提供的操作系统包括AIX 5.3,Solaris 10,OpenSolaris 2009.04,Fedora Core 10,Ubuntu 8.04,FreeBSD 6.2,Debian Linux for MIPS。这些操作系统分别运行在IBM Power 5,Sun UltraSPARC T1,AMD Opteron,Intel Xeon,龙芯2E等不同构架的处理器上。各种各样的服务器,再加上交换机、防火墙、存储等等,Unix-Center.Net的全部设备需要整整三个机柜才能够装得下。
中国大陆的网络环境很独特。拿各个大学的接入情况来看,清华北大等高校是通过中国教育科研网(CERNET)接入互联网的,以中科院为代表的一大批科研院所访问国内网站是需要先从国外绕一大圈再绕回来的,南方相当多的高校是通过公网(网通、联通、电信)接入互联网的。由于Unix-Center.Net的主要服务对象是学生,所以选择将服务器托管在互连互通条件比较好的北京赛尔机房,不然的话大部分学生访问起来都有困难。
这个网站不是政府所设置的开放实验室,也不是任何网络公司投资的创新项目。它是我的个人网站。
做这样一个网站的缘起很简单。因为工作的关系,我注意到很多高校 -- 即使是非常好的高校 -- 也没有办法给学生提供一个全面的环境来学习操作系统。大部分学校的机房,运行的操作系统清一色的是Windows。极少数学校的机房可以提供一两个版本的Unix或者是Linux操作系统,但是和市面上版本繁多的操作系统相比较,可以选择的余地是在太少。在处理器构架方面,基本上都是x86/x64处理器,学生可能听说过其他种类的处理器,但是基本上没有机会见到,更不用说是使用了。因此,我萌发了一个极其简单的想法:买一些不同构架的服务器,安装上不同种类的操作系统,托管到一个机房,开放注册账号,免费地提供SSH登录服务。我是一个急性子的人,想到的事情就要赶紧去做,于是Unix-Center.Net的雏形在2007年初上线了。我没有想到的是,在短短的时间里便有上万名用户注册到这个系统,并且对系统功能提出了更多的需求。于是我赶紧添加新的服务器,并且恳求朋友帮忙开发一些必要的程序,逐渐完善这个系统的功能。
我于2000年底硕士毕业之后,在美国工作了三年,又在中国工作了六年。在过去的两年半中,这个系统烧掉了我大部分的工资和积蓄。购买各种服务器设备的费用,大概是70万人民币;北京赛尔机房的服务器托管和带宽费用,大概是每年30万人民币。(由于Unix-Center.Net对于推广我的雇主的操作系统有很大的帮助,我的雇主曾经在我的游说之下为Unix-Center.Net提供了半年的带宽费用。但是考虑到Unix-Center.Net同时提供其他种类的操作系统,我的雇主后来中止了对Unix-Center.Net的支持。)和我同年龄的人,现在大部分都有车有房了吧。而我最值钱的资产,是在保安严密的机房中的三个机柜。
我曾经和国家负责推广Linux和开源技术的机构取得联系,也曾经和某些教育部门取得联系,希望能够得到他们的支持。但是“有关部门”的负责人听取了我的陈述之后,不约而同地摇摇头,说:“你这个事情做得很好。很遗憾我们不能够给你提供任何帮助。”我也曾经考虑过将这个网站用商业化的模式来运作,但是这个公益性平台所服务的对象大部分是穷学生和穷教师,暂时并没有盈利的空间。并且,我自认为我是一个做事的人,而不是一个做生意的人。让我自己来运营一家公司的话,赚钱的可能性并不大。
中国是一个发展中国家,我们有很多教师、学生和工程人员希望能够学习Unix/Linux系统,却又苦于没有合适的环境和条件。Unix-Center.Net存在的目的,就是给这些爱好Unix/Linux的人一个学习和练习的条件。用一个简单的数据来说,到2009年6 月底,Unix-Center.Net的注册用户接近9 万人。我不知道这么多人都在这些服务器上做什么事情,但是我相信这些服务器对他们有用。譬如说,清华大学教授操作系统课程的一位教授告诉我说他让学生们到Unix-Center.Net来对不同的操作系统进行比较。又譬如说,我收到中国科技大学一位博士生的电子邮件,说是他利用这些服务器完成了毕业论文中比较关键的一些计算。这些有限的证言,让我坚信这个系统是有其存在的意义的。尽管没有获得“有关部门”的支持,我从来都没有想过要放弃。
坦率地说,我现在遇到了一些困难。我所在的公司,在这次经济危机中被收购了。我不能够确定将来我是否还有能力将这个系统支持下去。但是我非常希望能够维持这个系统的运行,因为它确实对很多人有用。如果您也相信这一点的话,我希望您能够帮助我将这个系统维持下去。不管是10元、100元还是1000元,对于Unix-Center.Net的用户来说都是莫大的帮助。
如果您在中国,您可以将您的捐款通过转帐支付给我的个人银行账号:
中国银行北京市分行清华园支行
蒋清野
4563-5101-0088-4741-228
招商银行北京市分行清华园支行
蒋清野
6226-0901-0156-8117
支付宝账户
13511026844
如果您在国外,您可以将您的捐款通过PayPal支付给我的个人账号([email protected]),或者是通过转帐支付到我在CitiBank的个人账号:
CitiBank
FDIC Routing #: 321171184
Account Name: Qingye Jiang
Account #: 40038862963
Debit Card #:5262-2519-8546-8207
我还恳请您在捐款之后给我发一封电子邮件(电子邮件地址[email protected]),详细说明您的个人姓名以及捐款数目,以便我定期地整理和公布捐款情况。
如果您希望进一步了解关于我个人的情况,欢迎您访问我个人的博客http://www.qyjohn.net/。
如果您希望进一步了解关于Unix-Center.Net的情况,欢迎您访问Unix-Center.Net的网站http://www.unix-center.net/?page_id=2。
如果您愿意进一步帮助Unix-Center.Net,请您将这篇文章转贴到您认为合适的论坛、社区,或者是转发给您的同事和朋友。
这一件事情,纯粹是我的个人行为。但是我仍然希望我能够代表Unix-Center.Net的用户对您说一声:谢谢您的爱心,谢谢您的支持。
蒋清野
2009年7 月13日