[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 在内存中可以建立 swap 分区吗?



On Thursday 29 December 2005 23:13, Guo Liang wrote:

这样当然是可以用,不过我想这样弄并没有什么实际的意义。

> 有一个办法可以,就是在swapdisk上建立一个文件,用这个文件做swap文件,具体操作如下:
> blueice:/# mkfs.ext3 /dev/ram9
> mke2fs 1.39-WIP (10-Dec-2005)
> Filesystem label=
> OS type: Linux
> Block size=1024 (log=0)
> Fragment size=1024 (log=0)
> 2048 inodes, 8192 blocks
> 409 blocks (4.99%) reserved for the super user
> First data block=1
> 1 block group
> 8192 blocks per group, 8192 fragments per group
> 2048 inodes per group
>
> Writing inode tables: done
> Creating journal (1024 blocks): done
> Writing superblocks and filesystem accounting information: done
>
> This filesystem will be automatically checked every 32 mounts or
> 180 days, whichever comes first.  Use tune2fs -c or -i to override.
> blueice:/# mount /dev/ram9 /mnt
> blueice:/# cd /mnt
> blueice:/mnt# ls
> lost+found
> blueice:/mnt# dd if=/dev/zero of=ramswap bs=1M count=4
> 4+0 records in
> 4+0 records out
> 4194304 bytes (4.2 MB) copied, 0.056658 seconds, 74.0 MB/s
> blueice:/mnt# ls
> lost+found  ramswap
> blueice:/mnt# mkswap ramswap
> Setting up swapspace version 1, size = 4190 kB
> no label, UUID=9535fd5a-36d1-45b5-a679-ac0dcd2b5c9c
> blueice:/mnt# swapon /mnt/ramswap
> blueice:/mnt# swapon -s
> Filename                                Type            Size    Used 
> Priority /dev/hda5                               partition       2008084 0 
>    -1 /mnt/ramswap                            file            4088    0    
> -2
>

-- 
Regards,

Gong Jie (龚颉)
Email: neo@mamiyami.com



Reply to: