300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > Linux根文件系统的文件镜像 构建小型Linux根文件系统镜像

Linux根文件系统的文件镜像 构建小型Linux根文件系统镜像

时间:2022-12-29 23:43:18

相关推荐

Linux根文件系统的文件镜像 构建小型Linux根文件系统镜像

小型linux制作参考文档

1,构建镜像文件(100M)

mkdir work

dd if=/dev/zero of=/work/linux_root.img bs=1k count=100000 100000+0 records in

100000+0 records out

102400000 bytes (102 MB) copied, 0.803413 s, 127 MB/s

2,将文件挂载为设备

losetup /dev/loop0 /work/linux_root.img

3,格式化设备(Ext2)

mkfs.ext2 /dev/loop0 (或者 mkfs.ext3)

mke2fs 1.41.1 (01-Sep-)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

5016 inodes, 20000 blocks

1000 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=20709376

3 block groups

8192 blocks per group, 8192 fragments per group

1672 inodes per group

Superblock backups stored on blocks:

8193

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

4,将文件从设备中卸载

losetup -d /dev/loop0

5,挂载镜像文件为目录

mount -o loop /work/linux_root.img /mnt/ramdisk/

6,df 命令查看文件使用情况

df -h

Filesystem Size Used Avail Use% Mounted on

.............

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。