IDEプライマリ・マスター及びセカンダリ・マスターに、
同容量のハードディスクをリムーバブルケースにてセットしているものとする。
ただし、リカバリー作業時、どちらのハードディスクが損傷しても、
正常なハードディスクからブートできる(プライマリー、セカンダリーを入れ替えても)
という前提を構成することとする。
現時点で最新の Red Hat Linux 9 を使用する。
また、RAID1は標準搭載のソフトウェアRAIDにて構成する。
(メインメモリーが128MBなので、swapは256MBとることにする。)
- To install or upgrade Red Hat Linux in graphical mode,
press the <ENTER> key.
- To install or upgrade Red Hat Linux in text mode, type:
Linux text <ENTER>.
- Use thefunction keys listed below for more information.
[F1-Main][F2-Options][F3-General][F4-Kernel][F5-Rescue]
boot: linux text_
CD Found
To begin testing the CD media before
installation press OK.
Choose Skip to skip the media test
and start the installation.
[OK] [Skip]
パーティションの追加
マウントポイント:<利用不可>___________
ファイル システム タイプ: 選択可能なドライブ:
physical volume (LVM) # [*] hda #
software RAID [ ] hdc
容量 (MB): 100____ (*) 固定容量:
( ) 最大容量 (MB): 1____
( ) 利用できるスペースをすべて利用:
[*]第一パーティションとして強制指定
[*]不良ブロックをチェック
[OK] [取り消し]
RAID デバイス作成
マウントポイント:<利用不可>___________
ファイル システム タイプ: RAID レベル:
physical volume (LVM) # RAID0
swap RAID1
RAID5
RAID メンバー: 0__いくつのスペアを使いますか?
[*] hda1 # [*]パーティションをフォーマットしますか?
[ ] hda2
[OK] [取り消し]
パーティション設定
デバイス 開始 終了 容量 タイプ マウント
RAID Device 0 255M swap
RAID Device 1 99M ext3 /boot
RAID Device 2 37801M ext3 /
/dev/hda
自由領域 1 1 0M 自由領域
/dev/hda1 1 13 101M ソフト
/dev/hda2 14 46 258M ソフト
/dev/hda3 47 4865 37801M ソフト
自由領域 4866 4866 1M 自由領域
/dev/hdc
/dev/hdc1 1 203 99M ソフト
/dev/hdc2 204 723 255M ソフト
/dev/hdc3 724 78656 38849M ソフト
[新規] [編集] [削除] [RAID] [OK] [戻る]
eth0用のネットワークの設定
ネットワークデバイスeth0
[ ] bootp/dhcp を使用
[*] 起動時にアクティブにする
IP アドレス: 192.168.1.2_____
ネットマスク: 255.255.255.0___
デフォルトゲートウェイ(IP): 192.168.1.254___
1番目のネームサーバ: 192.168.1.1_____
2番目のネームサーバ: ________________
3番目のネームサーバ: ________________
[OK] [取り消し]
device (hd0) /dev/hda root (hd0,0) install /grub/stage1 (hd0,0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst install /grub/stage1 d (hd0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst setup (hd0) device (hd0) /dev/hdc root (hd0,0) install /grub/stage1 (hd0,0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst install /grub/stage1 d (hd0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst setup (hd0) quit
#grub --no-floppy --batch < raid1.grub
GRUB version 0.93 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> device (hd0) /dev/hda
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd
grub> install /grub/stage1 (hd0,0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst
grub> install /grub/stage1 d (hd0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.
conf"... succeeded
Done.
grub>
grub> device (hd0) /dev/hdc
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd
grub> install /grub/stage1 (hd0,0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst
grub> install /grub/stage1 d (hd0) /grub/stage2 0x8000 (hd0,0) /grub/menu.lst
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.
conf"... succeeded
Done.
grub>
grub> quit
# _
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hda3[1]
38708544 blocks [2/1] [_U]
md0 : active raid1 hda2[1]
262016 blocks [2/1] [_U]
md1 : active raid1 hda1[1]
102208 blocks [2/1] [_U]
unused devices: <none>
プライマリ・マスター及びセカンダリ・マスターに、
同容量のハードディスクをリムーバブルケースにてセットしているものとする。
ただし、このリカバリー作業はRAID構築時に、どちらのハードディスクが損傷しても、
正常なハードディスクからブートできるという前提を仕組んでいます。
その方法については、RAID構築編を参照して下さい。
プライマリ・マスターにセットした[hda]が破損したものとし、同容量またはそれ以上のハードディスクに交換。
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hdc3[1]
38708544 blocks [2/1] [U_]
md0 : active raid1 hdc2[1]
262016 blocks [2/1] [U_]
md1 : active raid1 hdc1[1]
102208 blocks [2/1] [U_]
unused devices: <none>
# cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hda3[1]
38708544 blocks [2/1] [_U]
md0 : active raid1 hda2[1]
262016 blocks [2/1] [_U]
md1 : active raid1 hda1[1]
102208 blocks [2/1] [_U]
unused devices: <none>
#fdisk /dev/hda -l
Disk /dev/hda: 40.0 GB, 40016019456 bytes
16 heads, 63 sectors/track, 77536 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 203 102280+ fd Linux raid autodetect
/dev/hda2 204 723 262080 fd Linux raid autodetect
/dev/hda3 724 77536 38713752 fd Linux raid autodetect
#fdisk /dev/hdc
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
m print this menu
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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
partition number (1-4): 1
First cylinder (1-79656, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-79656,default 79656): 203
Command (m for help): _
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
partition number (1-4): 2
First cylinder (204-79656, default 204): 204
Last cylinder or +size or +sizeM or +sizeK (204-79656,default 79656): 723
Command (m for help): _
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
partition number (1-4): 3
First cylinder (724-79656, default 724): 724
Last cylinder or +size or +sizeM or +sizeK (724-79656,default 79656): 77536
Command (m for help): _
Command (m for help): p
Disk /dev/hdc: 41.1 GB, 41110142976 bytes
16 heads, 63 sectors/track, 79656 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 203 102280+ 83 Linux
/dev/hdc2 204 723 262080 83 Linux
/dev/hdc3 724 77536 38713752 83 Linux
Command (m for help):
Command (m for help): t Partition number (1-4): 1 Hex code (type L to list codes): fd Change system type of partition to fd (Linux raid autodetect) Command (m for help): _
Command (m for help): p
Disk /dev/hdc: 41.1 GB, 41110142976 bytes
16 heads, 63 sectors/track, 79656 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 1 203 102280+ fd Linux raid autodetect
/dev/hdc2 204 723 262080 fd Linux raid autodetect
/dev/hdc3 724 77536 38713752 fd Linux raid autodetect
Command (m for help):
Command (m for help): w The partition table ha been altered! Colling ioctl() to re-read partition table. Syncing disks.
# raidhotadd /dev/md0 /dev/hdc2 # raidhotadd /dev/md1 /dev/hdc1 # raidhotadd /dev/md2 /dev/hdc3 [追記] Fedora Core では # mdadm /dev/md0 --add /dev/hdc2 # mdadm /dev/md1 --add /dev/hdc1 # mdadm /dev/md2 --add /dev/hdc3
#cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md2 : active raid1 hdc3[2] hda3[1]
38708544 blocks [2/1] [_U]
[=>...................] recovery = 7.0% (2715972/38708544) finish=59.3mi
n speed=10103K/sec
md0 : active raid1 hdc2[0] hda2[1]
262016 blocks [2/2] [UU]
md1 : active raid1 hdc1[0] hda1[1]
102208 blocks [2/2] [UU]
unused devices: <none>
#vi /etc/samba/smb.conf
[global]
coding system = euc
client code page = 932
workgroup = MYGROUP
server string = Samba Server hosts allow = 192.168.1. 192.168.2. 127.
log file = /var/log/samba/%m.log max log size = 0 security = user encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd
unix password sync = Yes passwd program = /usr/bin/passwd %u passwd chat = *New*password* %n\n *Retype*new*password* %n\n *passwd:*all*aut hentication*tokens*updated*successfully* pam password change = yes obey pam restrictions = yes socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 dns proxy = no [homes] comment = Home Directories browseable = no writable = yes valid users = %S
[public] comment = Public Stuff path = /home/samba public = yes writable = yes printable = no write list = @group1 force user = user1
#service smb start Starting SMB services: [ OK ] Starting NMB services: [ OK ]
#chkconfig --list
kudzu 0:off 1:off 2:off 3:on 4:on ・・・
syslog 0:off 1:off 2:on 3:on 4:on ・・・
(省略)
smb 0:off 1:off 2:off 3:off 4:off ・・
(省略)
cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd
chmod 600 /etc/samba/smbpasswd
smbpasswd username
この作業後に、useradd したユーザについては、smbpasswd -a username とする。
#finger username 自分自身の場合、username は不要です。 /etc/passwdに格納 #chfn username ユーザプロファイルの変更 #groupmod -n newgroupname oldgroupname グループ名の変更
#mkdir /home/grouppath /home下にグループの共有フォルダを作成 #groupadd groupname 新しいグループを作成 #chgrp groupname /home/grouppath グループ用フォルダの所有権をグループに与える #chmod 770 /home/grouppath 所有者とグループにread/writeのアクセス権を設定 #usermod -G groupname[,groupname2,groupname3] username グループにユーザを追加 #id username ユーザの所属を確認 #useradd dummyuser 架空のユーザを作る #usermod -G groupname dummyuser そのユーザをグループに加る #useradd -s /bin/false username 実行権限の無いユーザの作成 #useradd -d /dev/null username ホームディレクトリの無いユーザの作成 #userdel -r username ユーザの削除(-r:ホームディレクトリも削除)
#vi /etc/samba/smb.conf
[public]
comment = Public Stuff
path = /home/samba
public = yes
writable = yes
printable = no
write list = @groupname
force user = dummyuser
#vi filename ;username:password:userID(uid):groupID(gid):Full Name:/home/username:/bin/bash testuser:test:1001:502:Test User san:/home/testuser:/bin/bash ・・・・・・・・・・・・・・・・・ ・・・・・・・・・・・・・・・・・ #newusers filename
#rpm -ghU samba-swat-2.2.7a-7.9.0.i386.rpm
#vi /etc/xinetd.d/swat
# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
service swat
{
port = 901
socket_type = stream
wait = no
only_from = 127.0.0.1
only_from = 192.168.1.
user = root
server = /usr/sbin/swat
log_on_failure += USERID
disable = no
}
#vi /etc/hosts.allow # hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # swat: 192.168.1.
#service xinetd restart
#lokkit
#rpm -qa | grep samba samba-2.2.7a-7.9.0 redhat-config-samba-1.0.4-1 samba-swat-2.2.7a-7.9.0 samba-common-2.2.7a-7.9.0 samba-client-2.2.7a-7.9.0
#rpm -e [確認した標準SAMBA]
#rpm -ghU samba-2.2.8a.ja-2.rh9.i686.rpm
#vi /etc/samba/smb.conf
[global]
coding system = euc
client code page = 932
workgroup = MYDOMAIN
netbios name = SAMBA
server string = Samba Server
hosts allow = 192.168.1. 192.168.2. 127.
log file = /var/log/samba/%m.log
max log size = 0
security = user
encrypt passwords = yes
os level = 64
preferrd master = yes
domain master = yes
local master = yes
domain logons = yes
logon script = FileName <------- [netlogon]オプション必須
logon path = \\%N\%U\.profile <-------「.」は隠しフォルダにするため
logon drive = H: <------- ログオンユーザのプライベートフォルダが
自動的に[h:]ドライブになる
add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u
[NETLOGON]
comment = Script for Domain Logon
path = /ver/samba/netlogon
browseable = no
# --- OUR TIMESERVERS ----- # or remove the default restrict line # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. # restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap noquery # server mytrustedtimeserverip server ntp3.jst.mfeed.ad.jp
#chkconfig ntpd on
#chkconfig --list
kudzu 0:off 1:off 2:off 3:on 4:on ・・・
syslog 0:off 1:off 2:on 3:on 4:on ・・・
(省略)
ntpd 0:off 1:off 2:on 3:on 4:on ・・・
(省略)