16 June 2007

(Linux) swapパーティションが認識されない…

Fedora Core 6 の起動時に、スワップ・パーティションがマウントできないとのシステムメッセージが出ている。
システムの状況を表示させてみると…


[root@localhost ~]# top -n 1

top - 15:31:34 up 12 min, 2 users, load average: 0.25, 0.33, 0.25
Tasks: 136 total, 2 running, 133 sleeping, 0 stopped, 1 zombie
Cpu(s): 8.9%us, 2.1%sy, 0.0%ni, 78.6%id, 10.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 1161432k total, 709364k used, 452068k free, 90212k buffers
Swap: 0k total, 0k used, 0k free, 448364k cached

〜 略 〜

やはり、スワップ・パーティションがマウントされていない。

念のため、fstab を確認。自動マウントの行はちゃんと記述されている。

/etc/fstab

LABEL=/ / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
LABEL=SWAP-sda7 swap swap defaults 0 0

パーティション・テーブルは特に問題なさそうに見える。


[root@localhost ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 4864.
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): p

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 1828 14683378+ 7 HPFS/NTFS
/dev/sda2 1829 4377 20474842+ f W95 Ext'd (LBA)
/dev/sda3 * 4496 4863 2955960 1c Hidden W95 FAT32 (LBA)
/dev/sda5 1829 3103 10241406 b W95 FAT32
/dev/sda6 3104 4250 9213246 83 Linux
/dev/sda7 4251 4377 1020096 82 Linux swap / Solaris

Command (m for help):

ラベルが破壊されていると思われるので、スワップ・パーティションを再作成する。


[root@localhost ~]# swapoff -a
swapoff: cannot find the device for LABEL=SWAP-sda7
[root@localhost ~]# sync
[root@localhost ~]# mkswap -L SWAP-sda7 /dev/sda7
Setting up swapspace version 1, size = 1044574 kB
LABEL=SWAP-sda7, no uuid
[root@localhost ~]# swapon -a
[root@localhost ~]#

スワップ・パーティションが認識されたかどうか確認して終了


[root@localhost ~]# dmesg |tail

〜 略 〜

Adding 1020088k swap on /dev/sda7. Priority:-1 extents:1 across:1020088k

[root@localhost ~]# top

top - 16:32:10 up 1:12, 2 users, load average: 0.14, 0.10, 0.03
Tasks: 136 total, 2 running, 133 sleeping, 0 stopped, 1 zombie
Cpu(s): 1.7%us, 0.0%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 1161432k total, 730852k used, 430580k free, 96644k buffers
Swap: 1020088k total, 0k used, 1020088k free, 453292k cached

こんなマシンが、よく動いていたものだ…