ログ日記

作業ログと日記とメモ

squeezeには/dev/ramや/dev/ram0がなかった

だいぶハマってる。
Debianのudevの設定はどういうポリシーかよくわからん…。
lennyにはあるのにsqueezeにはない。
ファイルの場所が変わっていて、/lib/udev/rules.d/ に設定ファイルが置かれているが、/etc/rules.d/ にあるものは自動生成されたものみたい。


あとmakedevも自動で入らないみたい。
/dev/MAKEDEV は使わない方針になってるのかな。


まさか単純にramdiskを使うだけでハマるとは。
検索してもtmpfsと混同している記事が沢山出て紛らわしい…。


カーネルコンフィグのCONFIG_BLK_DEV_RAMがlennyだとyでsqueezeだとmになってることも影響しているのかな。



# 追記
カーネルソースの drivers/block/brd.c に書いてあった。

/*
 * And now the modules code and kernel interface.
 */
static int rd_nr;
int rd_size = CONFIG_BLK_DEV_RAM_SIZE;
static int max_part;
static int part_shift;
module_param(rd_nr, int, 0);
MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices");
module_param(rd_size, int, 0);
MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");
module_param(max_part, int, 0);
MODULE_PARM_DESC(max_part, "Maximum number of partitions per RAM disk");
MODULE_LICENSE("GPL");
MODULE_ALIAS_BLOCKDEV_MAJOR(RAMDISK_MAJOR);
MODULE_ALIAS("rd");

(snip)

static int __init brd_init(void)
{
        int i, nr;
        unsigned long range;
        struct brd_device *brd, *next;

        /*
         * brd module now has a feature to instantiate underlying device
         * structure on-demand, provided that there is an access dev node.
         * However, this will not work well with user space tool that doesn't
         * know about such "feature".  In order to not break any existing
         * tool, we do the following:
         *
         * (1) if rd_nr is specified, create that many upfront, and this
         *     also becomes a hard limit.
         * (2) if rd_nr is not specified, create 1 rd device on module
         *     load, user can further extend brd device by create dev node
         *     themselves and have kernel automatically instantiate actual
         *     device on-demand.
         */


というわけで、brdカーネルモジュールロード時に最低一つはデバイスファイルができるみたい。
カーネルコンフィグで

CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=65536

こういうデフォルト値になっているけど、これを変更する必要はないみたい。

modprobe brd rd_nr=1 rd_size=2048000

これで2GBの ramdiskバイスファイルが /dev/ram0 に生成されるのでmke2fsなどを実行した後にマウントできるようになる。