« Previous : 1 : 2 : 3 : 4 : 5 : ... 38 : Next »

ubuntu에서 타임머신 돌리기

http://kldp.org/node/115114 원문 입니다.

Posted by 눈빛마음

2010/07/31 11:43 2010/07/31 11:43
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/560


ip alias 하기 모든 배포판 요약본

http://www.cyberciti.biz/faq/linux-creating-or-adding-new-network-alias-to-a-network-card-nic/

Linux Creating or Adding New Network Alias To a Network Card (NIC)

by NIXCRAFT · 6 COMMENTS

Q. I would like to create alias for my network card (NIC). How do I setup 2 IP address on One NIC? How do I add alias under Centos / Fedora / Debian / Ubuntu Linux?

A. Linux allows you to add additional network address using alias feature. Please note that all additional network IP address must be in same subnet. For example if your eth0 using 192.168.1.5 IP address then alias must be setup using 192.168.1.0/24 subnet.

ifconfig command line

You can use ifconfig command to configure a network interface and alias. For example:

  • eth0 NIC IP 192.168.1.5
  • eth0:0 first NIC alias: 192.168.1.6

To setup eth0:0 alias type the following command as the root user:
# ifconfig eth0:0 192.168.1.6 up
Verify alias is up and running using following command:
# ifconfig -a
# ping 192.168.1.6
However, if you reboot the system you will lost all your alias. To make it permanent you need to add it network configuration file.

Debian / Ubuntu Linux Instructions

You can configure the additional IP addresses automatically at boot with another iface statement in /etc/network/interfaces:
# vi /etc/network/interfaces
Append text as follows:

auto eth0:1
iface eth0:1 inet static
name Ethernet alias LAN card
address 192.168.1.7
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0

Save and close the file. Restart the network:
# /etc/init.d/networking restart

Red Hat / RHEL / CentOS / Fedora Linux Instructions

Copy etc/sysconfig/network-scripts/ifcfg-eth0 file as /etc/sysconfig/network-scripts/ifcfg-eth0:0
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Open file /etc/sysconfig/network-scripts/ifcfg-eth0:0 using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
Find entry that read as follows:

DEVICE=eth0

Replace with:

DEVICE=eth0:0

Find entry that read as follows:

IPADDR=xxx.xxx.xxx.xxx

Replace it with your actual IP address:

IPADDR=192.168.1.7

At the end your file should like as follows:

DEVICE=eth0:0
IPADDR=192.168.1.7
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
NAME=eth0:0

Open file /etc/sysconfig/network-scripts/ifcfg-eth0 and make sure file does not have a GATEWAY= entry:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Find the entry that read as follows:

GATEWAY=your-ip

Remove or comment it out by prefixing # (hash) :

 # GATEWAY=192.168.1.254

Save the file. Add the GATEWAY= to your /etc/sysconfig/network:

# vi /etc/sysconfig/network

Append or modify GATEWAY entry:

GATEWAY=192.168.1.254

Save the file. Reboot the system or run the following command:

# ifup eth0:0

OR

# service network restart

Red Hat / CentOS / Fedora Multiple IP address range

You can assign multiple ip address range as follows to eth0:
vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
Append following code from 202.54.112.120 to 202.54.112.140:

IPADDR_START=202.54.112.120
IPADDR_END=202.54.112.140
CLONENUM_START=0
NETMASK=255.255.255.0

Save and close the file.

Posted by 눈빛마음

2010/05/20 20:37 2010/05/20 20:37
, ,
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/557

파일 백업

제 블로그를 방문해주시는 분들을 위한 팁!
Bash를 이용한 타겟 지정 파일 백업 팁(?) 이라고 부르기는 뭐하지만... 암튼 그거


#!/bin/bash
SOURCEDIR=/home/iz4blue/clien_data_cs1/cs2_data/
BASEDIR=/home/iz4blue/backup/clien_cs2_data/
HEAD=files_
DEST[1]="cheditor4"
DEST[2]="log"
DEST[3]="member"
DEST[4]="memo2"
DEST[5]="memo2_deleted"
DEST[6]="file"

TARGETDIR=$BASEDIR$HEAD`date +%Y%m%d`/
mkdir $TARGETDIR

for TMP in  "${DEST[@]}"
do
echo "START Copy $TMP Directory : `date`" >> ${TARGETDIR}log.txt
cp -r $SOURCEDIR$TMP $TARGETDIR
echo "END Copy $TMP Directory : `date`" >> ${TARGETDIR}log.txt
done

이 스크립트의 기능을 약간 요약하자면
1. for loop 구문 사용
2. 변수명 명확하게 구분하기
3. 배열 사용하기

Posted by 눈빛마음

2010/05/10 10:16 2010/05/10 10:16
,
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/556

http://ubuntuforums.org/showthread.php?t=1168360&page=2

결론적으로 이야기 하면 다음과 같다.
우선 일반적인 곳에서는 /dev/md0 로 raid 를 만들게 된다.
그런데 최근커널의 auto-detect는 /dev/md_d0 와 같은 형태의 디바이스로 생기는 것 때문에 생기는 현상이다.

mdadm --stop /dev/md_d0
mdadm --auto-detect

/usr/share/mdadm/mkconf force-generate /etc/mdadm/mdadm.conf
update-initramfs -u

ps. 이것 때문에 무려 RAID 3번 생성 총 3주의 시간을 허비했다. 이런 -_-;;


I found the same problem after an upgrade to linux-image-2.6.28-11-server (Jaunty, 9.04) when the /etc/mdadm/mdadm.conf file inside the initrd image had information that did not match the UUIDs of the real arrays, thus auto-start failed leaving me with /dev/md_d0, /dev/md_d1 and /dev/md_d2 instead of /dev/md0, /dev/md1, and dev/md2 as expected.

I then ran "mdadm --stop /dev/md_d0", then on md_d1, etc, to clear the bad assemble attempt (check /proc/mdstat to see), then ran "mdadm --auto-detect", mainly to just see what the issue was with auto-starting of the arrays, however it created them again but properly this time. I then let it finish the boot process at that point. All seemed fine. After the system was up, I then force-recreated the mdadm.conf file so the UUIDs matched... "/usr/share/mdadm/mkconf force-generate /etc/mdadm/mdadm.conf" (copy your mdadm.conf to /var/tmp or something first, if you want to diff it later). Then ran "update-initramfs -u" to re-build the initrd images. Then I rebooted.

Reboot went fine. All arrays recognized and auto-started properly. No leftover /dev/md_d0 and friends, so I have to assume that when the arrays auto-start properly, at some point they are renamed to match what's in /etc/mdadm/mdadm.conf. *shrug* YMMV.

Posted by 눈빛마음

2010/05/02 14:32 2010/05/02 14:32
,
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/555

스마트폰 앱에 관한 사설

http://rind.egloos.com/5258312

아이폰 사용자 백명중에 한명이 다이어트 헬퍼를 받았다. 이정도면 메가 히트작쯤 되지 않겠는가. 과연 수익이 얼마일까?

정부에서 앱 개발자를 육성하다고 한다. 좀 쌍시옷 소리 좀 하겠다.
어제 대한민국 대표 신문이라고 일컫는 ㅈ모신문과 인터뷰 아닌 인터뷰를 했다. 그래도 역시 ㅈ일보라고, 상황을 그래도 제일 잘 파악하고 있더라. 나를 만나기 전 만난 개발자는 아이폰 앱 20개 개발해서 겨우 150만원 건졌다고 한다. 이게 대다수 앱 개발자의 현실이라고 보면 된다. 잘 나가는 앱, 말 그대로 손에 꼽는다.  숫자 밝히자면, 요즘 다이어트헬퍼 하루에 40개정도 나간다. 1달러짜리 앱 기준으로 하루 120개 정도의 수익이다. 내가 알기로 유료앱 100 팔리면 탑 100에서도 상위권이다. 이걸로  못먹고 살지 당연히.
다이어트헬퍼 3.0 기능 구현 다 되었으면서도 안푸는게 괜히 그런게 아니다. 현재 개발 반쯤 끝난 KAP이랑 동시에 출시 안하면 못먹고 살거 같으니 그런거지 -_);/  사실, 다이어트 헬퍼는 판매 좀 줄여야된다.

아이폰 앱시장에 대하여

1. 게임 시장
투입되는 자본량(또는 인력량)이 무슨 꼬꼬마가 건드릴게 아니다. 게임 시장의 경쟁이 어느정도 된다면 아예 건드릴 엄두를 못낼거다.

2. SI시장.
지금 아이폰 SI가 꽤 높은 가격을 받는건 사실이다. 얼마나 갈까? 1년가면 오래가는거라고 본다. 쾌속개발툴들 덕분에 소스단가는 낮아지고 있고, 회사마다 라이브러리 프레임웍 하나씩 갖출때쯤 동시에 무너질거다. 증권사들 HTS전부 한군데에서 만드는 것 처럼 SI시장은 곧 무너질 수 밖에 없다. 사실상 스마트폰에서 할 수 있는 일은 웹에서 데이타 긁어서 보여주는 것밖에 없다. 지금 삼천만원, 오천만원 받아서 횡재했다고 생각하는 스마트폰 업체들 무너지는거 일순간이라고 본다. 지금 외주주는 회사들은 결국 자사 전산망에서 해결하려 들걸. 그리고 나중엔 웹에이젼시를 통하여 개발하려 하지 앱에이젼시를 통하려 하진 않을거라고 본다.

3. 광고시장
네이버 블로그에 광고 달아서 돈 버는 사람 봤냐.  행운의 편지마냥 한 사람 통장에 돈 넣어주고 50개 글 싸질르면 그중에 7명의 사람이 자신에게 돈 준다는 그 예전에 유행했던 광고가 생각나는 이유는 뭐냐.

4. 유틸리티 시장
아이디어 좋아서 하나 만들었다고 치자. 다른 사람이 그 아이디어 그대로 무료로 푸는거 일순간이다.  웹메일 시장이 왜 다 무너졌는지 이해하면 빠르다. 한군데에서 무료로 풀면, 게임은 끝.  다이어트헬퍼는 미친척 DB때려박아서 저정도 순위권에서 버티는거지,  (그래도 얼마나 갈거같냐)

5. KT/SKT 외주( ? ) 시장
자기들 앱스토어 텅 비니까 어떻게든 해결하려고 하는데, 이것도 과연 오래 갈까 싶다. 통신사들도 제 살 깎아먹을거라는거 모르는거 아닐테고.  일단 몇개 이런식으로 퍼블리쉬한 다음에는 뭐 먹고 살까 걱정하면, 역시 깝깝하긴 깝대형이다. KT는 무려 MHP 앱까지 만들 태세던데, 과연 그 환경에서 개발이 쉬울까도 문제지만, 이거 뭐 .... 답이 없어. LGT는 리비젼A라서 어떻게든 SKT KT앱스토어에 빌붙을려는 모양이다만, SKT가 허락해줄리 없지. 그게 바로 SKT의 한계라고 본다만.



앱시장은 환상이다. 지금 저 수만가지 앱중에서 수익이 150이라도 넘어서 애플에서 돈 받는 개발자가 몇명이나 될 거 같냐. 지금 다들 마약처럼 들떠있는데, 좀 적나라하게 앱 개발자 수익 까보면, 말 그대로 처참하다. 정부가 청년실업 어떻게 해결하겠다고 1인기업 어쩌고 하는 모양이지만 이것도 정말 실상 알고나면 어이가 없다.  얼마전 알아봤던 정부 지원은 말 그대로 /1인/ 이어야 된다. 회사로 출근하는 알바생 한명 데리고 있으면 지원대상이 아니란다. 다이어트헬퍼 정말 한 사람이서 만들 수 있을까? _- ? 상식적으로 데이타관리, 개발및 기획, 디자이너 최소한 셋은 있어야된다. 이런걸 생까고 말 그대로 숫자 '1'에 집착한다.  중기청에서 제공해준다는 사무실은 오후 여섯시 반이면 퇴근해야된단다. 참으로 웃긴 비극이다.

그래도 앱시장에 뛰어들겠다는 사람에게 조언을 하자면

1. 자신의 능력을 의심해라
내가 만드는 앱이 진짜 잘 팔릴것 같은지 고민 좀 해봐라.

2. 자신의 앱을 의심해라
뭐 그냥 뚝딱뚝딱 여러개 만들어서 돈 벌 생각 하는 사람이 많다. 여러개 중에 하나 정도는 걸리겠지. 이거 마치 주식시장에서 아무거나 마구 사놓고 '그중 하나 걸리겠지' 라거나 문방구앞 뽑기에서 열심히 긁어대는 초딩과 뭐가 다르냐고 묻고 싶다.


3. 그냥하지마!!

Posted by 눈빛마음

2010/05/01 15:25 2010/05/01 15:25
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/554

export LC_CTYPE=ko_KR.UTF-8 나
export LC_CTYPE=en_US.UTF-8 을 이용하면 되는 것 같다.

2개의 차이점이 약간 있는 것 같은데 아직은 정확히 찾아내지는 못하였다.
짐작으로는 한글입력 위치에 대한 보존은 en_US.UTF-8 이 더 정확하게 맞는 것 같기도 하다.

http://juretta.com/log/2007/05/09/svn_can_t_convert_string_from_utf-8_to_native_encoding_/

Posted by 눈빛마음

2010/04/30 17:57 2010/04/30 17:57
,
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/552

trac에서 UTF-8 쓰기

우선 SVN 서비스에서 한글을 따로 한글인코딩 해서 저장하는 것은 아니란다.
즉 SVN 서버는 단순히 바이너리를 넣을뿐이고
VIEW하는 TRAC에서 서비스를 변경해줘야 한글을 볼수 있다는 것이다.

아직 쉘에 적용하는 부분은 아직 못해봐서 잘 모르고 우선은 다음을 해보고 이야기 하자!
[trac]
...
default_charset = utf-8
...

http://code.djangoproject.com/ticket/7310

Posted by 눈빛마음

2010/04/30 17:42 2010/04/30 17:42
,
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/551

linux에서 GUID 파티션 삭제하자

http://www.virtualvcp.com/linux-technical-guides/125-clearing-a-guid-partition-table-gpt-in-linux

This is more of a note for future reference rather than a blog post.

I recently had to replace a RAID-10 member disk as the original disk had developed bad sectors and was causing mostly read related problems in the array. (That’s a whole other story it it’s won right and I don’t have time to get into that now). However, when I tried adding the replacement disk to the server, I found that the disk had a GPT table and not an msdos partition table, unlike the other 3 members in the RAID array. I was therefore unable to add the disk “as-is” to the RAID array as all disks are required to have the same partition table type. I therefore needed to remove the GUID Partition Table and replace it with an msdos partition table.

My initial though was to use fdisk. However, fdisk does not understand GUID Partition Tables and therefore cannot remove such tables. The other tool that does understand GPT is a tool called “parted”.

So to replace the GPT table with msdos, I did:

parted /dev/sdc
mklabel msdos
quit


If you are running Windows and would like to clear a GPT table, you may use the "clean" command in diskpart (Diskpart can be accessed from the command prompt)

Posted by 눈빛마음

2010/04/30 10:43 2010/04/30 10:43
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/550

그중 가장 유용한 것 : 하드 온도 체크하기
smartctl -A /dev/sdg | grep Temperature_Celsius | awk '{print $10}'

http://www.howtoforge.com/checking-hard-disk-sanity-with-smartmontools-debian-ubuntu

1 Installing Smartmontools

In order to install smartmontools, all we have to do is run:

apt-get install smartmontools

The smartmontools package comes with two utilities, smartctl which you can use to check your hard drives on the command line, and smartd, a daemon that checks your hard disks at a specified interval and logs warnings/errors to the syslog and can also send warnings and errors to a specified email address (usually the admin of the system).


2 Using Smartctl

Before we can use smartctl, we must find out how our hard disks are named. You can do this, for example, by running:

df -h

or

fdisk -l

server1:~# fdisk -l

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1       19269   154778211   83  Linux
/dev/hda2           19270       19457     1510110    5  Extended
/dev/hda5           19270       19457     1510078+  82  Linux swap / Solaris
server1:~#

As you see, my hard disk is called /dev/hda.

Now that we know the name of our hard drive, we can run smartctl as follows:

smartctl -a /dev/hda

If you run it for the first time, you'll probably see something like this:

server1:~# smartctl -a /dev/hda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model:     ST3160022ACE
Serial Number:    5JS3XTZX
Firmware Version: 9.01
User Capacity:    160,041,885,696 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   6
ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 2
Local Time is:    Tue Apr  8 18:58:44 2008 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Disabled

SMART Disabled. Use option -s with argument 'on' to enable it.
server1:~#

So SMART is disabled, to enable it, we need to run that command again with the -s on switch:

smartctl -s on -a /dev/hda

Now we get more output, including all errors that are in the SMART log (if any):

server1:~# smartctl -s on -a /dev/hda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model:     ST3160022ACE
Serial Number:    5JS3XTZX
Firmware Version: 9.01
User Capacity:    160,041,885,696 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   6
ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 2
Local Time is:    Tue Apr  8 18:59:14 2008 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Disabled

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

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:                 (15556) 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:        ( 111) 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   059   056   006    Pre-fail  Always       -       163692057
  3 Spin_Up_Time            0x0003   096   096   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   100   253   030    Pre-fail  Always       -       722959
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       55
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       37
194 Temperature_Celsius     0x0022   039   046   000    Old_age   Always       -       39
195 Hardware_ECC_Recovered  0x001a   059   056   000    Old_age   Always       -       163692057
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   199   000    Old_age   Always       -       1
200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline      -       0
202 TA_Increase_Count       0x0032   100   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
ATA Error Count: 1
        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 1 occurred at disk power-on lifetime: 28 hours (1 days + 4 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
  -- -- -- -- -- -- --
  84 51 00 5d 4c 85 e0  Error: ICRC, ABRT at LBA = 0x00854c5d = 8735837

  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 00 5d 4c 85 e0 00      05:05:31.855  READ DMA EXT
  25 00 00 5d 4b 85 e0 00      05:05:31.810  READ DMA EXT
  25 00 00 5d 4a 85 e0 00      05:05:31.773  READ DMA EXT
  25 00 00 5d 49 85 e0 00      05:05:31.737  READ DMA EXT
  25 00 00 5d 48 85 e0 00      05:05:31.651  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%        54         -
# 2  Short offline       Aborted by host               80%        54         -
# 3  Short offline       Completed without error       00%        54         -

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.

server1:~#

Now that SMART is enabled, we don't need the -s on switch anymore, which means that you can now call smartctl as in the first example.

To learn more about smartctl and how it can be used, take a look at the smartctl man page:

man smartctl


3 Using Smartd

Smartctl is a nice tool, but you have to run it manually. Of course, it would be nice to have some daemon that monitors our hard disk at specified intervals and logs and/or emails us if something is wrong with the hard disk so that we can react before it fails completely. Smartd is just what we need.

To use smartd, we have to modify /etc/default/smartmontools first and uncomment the start_smartd=yes and smartd_opts="--interval=1800"lines (set the monitoring interval to whatever value (in seconds) you prefer; 1800 means 30 minutes):

vi /etc/default/smartmontools

# Defaults for smartmontools initscript (/etc/init.d/smartmontools)
# This is a POSIX shell fragment

# List of devices you want to explicitly enable S.M.A.R.T. for
# Not needed (and not recommended) if the device is monitored by smartd
#enable_smart="/dev/hda /dev/hdb"

# uncomment to start smartd on system startup
start_smartd=yes

# uncomment to pass additional options to smartd on startup
smartd_opts="--interval=1800"

Next we must configure the smartd configuration file, /etc/smartd.conf. You should take a look at

man smartd

to learn more about the available configuration options and also check out the examples that are in /etc/smartd.conf.

vi /etc/smartd.conf

For the beginning the following configuration is fine:

DEVICESCAN -m root -M exec /usr/share/smartmontools/smartd-runner

DEVICESCAN means that smartd will monitor all hard drives it can find. The -m switch specifies the user or email address that smartd will send warnings/errors to. For example, to monitor only /dev/hda and send warnings/errors to admin@example.com, you'd use the following configuration instead:

/dev/hda  -m admin@example.com -M exec /usr/share/smartmontools/smartd-runner

Afterwards we start smartd:

/etc/init.d/smartmontools start

Now if you take a look at /var/log/syslog, you should find the startup messages of smartd there:

tail -n50 /var/log/syslog

[...]
Apr  8 19:12:17 server1 smartd[3731]: smartd version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Apr  8 19:12:17 server1 smartd[3731]: Home page is http://smartmontools.sourceforge.net/
Apr  8 19:12:17 server1 smartd[3731]: Opened configuration file /etc/smartd.conf
Apr  8 19:12:17 server1 smartd[3731]: Drive: DEVICESCAN, implied '-a' Directive on line 22 of file /etc/smartd.conf
Apr  8 19:12:17 server1 smartd[3731]: Configuration file /etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
Apr  8 19:12:17 server1 smartd[3731]: Problem creating device name scan list
Apr  8 19:12:17 server1 smartd[3731]: Device: /dev/hda, opened
Apr  8 19:12:17 server1 smartd[3731]: Device: /dev/hda, not found in smartd database.
Apr  8 19:12:17 server1 smartd[3731]: Device: /dev/hda, is SMART capable. Adding to "monitor" list.
Apr  8 19:12:17 server1 smartd[3731]: Device: /dev/hdc, opened
Apr  8 19:12:17 server1 smartd[3731]: Device: /dev/hdc, packet devices [this device CD/DVD] not SMART capable
Apr  8 19:12:17 server1 smartd[3731]: Monitoring 1 ATA and 0 SCSI devices
Apr  8 19:12:17 server1 smartd[3733]: smartd has fork()ed into background mode. New PID=3733.
Apr  8 19:12:17 server1 smartd[3733]: file /var/run/smartd.pid written containing PID 3733
[...]

If smartd finds something interesting about your hard disk or errors/warnings, it will also log these events, e.g.:

Apr  8 19:36:01 server2 smartd[13160]: Device: /dev/hda, SMART Usage Attribute: 194 Temperature_Celsius changed from 36 to 37

(This is of course no error or warning, just something interesting.)

Errors and warnings will also be sent to a user/email address if you told smartd to do so.


4 Links

Posted by 눈빛마음

2010/04/26 03:15 2010/04/26 03:15
, ,
Response
No Trackback , No Comment
RSS :
http://iz.apgu.co.kr/tc/rss/response/548

« Previous : 1 : 2 : 3 : 4 : 5 : ... 38 : Next »

블로그 이미지

눈빛마음의 사색공간

- 눈빛마음

Archives

Calendar

«   2010/08   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Site Stats

Total hits:
292913
Today:
44
Yesterday:
81