01 > ȸҰ

작성일 : 14-04-16 14:20
 글쓴이 : 이로직…
조회 : 6,109  
Here is the procedure to create a RAMDISK. This is especially useful if you want to increase the size of an existing RAMDISK.
1. Create a file of zeroes for the size of the ramdisk you want. This example assumes a 32MB file system
[root@localhost jjd]# dd if=/dev/zero of=ramdisk bs=1M count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 0.243921 s, 138 MB/s
2. Format the file as a file system.
[root@localhost jjd]# mkfs ramdisk
mke2fs 1.40.8 (13-Mar-2008)
ramdisk is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
8192 inodes, 32768 blocks
1638 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33554432
4 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
	8193, 24577

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
3. Use the loop file system to mount it.
[root@localhost jjd]# mkdir mnt
[root@localhost jjd]# mount -o loop ramdisk mnt
4. Copy your root file system to mnt. Here you can copy a file system from an existing RAMDISK (see this link), and add other files as needed.
[root@localhost jjd]# cp -r /* mnt
5. Unmount the image
[root@localhost user]# umount mnt
5. Zip it up!
[root@localhost user]# gzip ramdisk
7. You should end up with a compressed ramdisk.gz