当前位置:网站首页>Rhcsa 01 - create partitions and file systems
Rhcsa 01 - create partitions and file systems
2022-07-04 04:28:00 【Wangwanlin Ben】
Preface
This article demonstrates Create a loop file , And its Partition 、 format , and mount .
What is? loop equipment ?
loop The device is a pseudo disk , It USES image File as its storage backend . Linux dd The program provides a simple tool to create this image file .
practice
step 1: Check whether the root directory is larger than 10GB Remaining space of ,
[[email protected] ~]# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rl-root 35G 1.9G 33G 6% /step 2: Use dd Command to create a image file ,
[[email protected] ~]# dd if=/dev/zero of=/root/diskfile.img bs=1M count=8192
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 13.7321 s, 626 MB/s
[[email protected] ~]# du -hs diskfile.img
8.0G diskfile.imgstep 3: Use losetup Tools , Will be image The file is set to loop equipment ,
[[email protected] ~]# losetup -fP diskfile.img
[[email protected] ~]# losetup -a # see
/dev/loop0: [64768]:67202764 (/root/diskfile.img)step 4: Partition .Linux There are several commands to complete disk partition , Use here fdisk,
[[email protected] ~]# fdisk /dev/loop0
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x1f69de20.
Command (m for help): p
Disk /dev/loop0: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1f69de20
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-16777215, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-16777215, default 16777215): +2G
Created a new partition 1 of type 'Linux' and of size 2 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 8G 0 loop
└─loop0p1 259:0 0 2G 0 loop
sr0 11:0 1 1024M 0 rom
vda 252:0 0 40.1G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 38.1G 0 part
├─rl-root 253:0 0 34.2G 0 lvm /
└─rl-swap 253:1 0 3.9G 0 lvm [SWAP]
vdb 252:16 0 5G 0 disk step 5: format partition
[[email protected] ~]# mkfs.xfs /dev/loop0p1
meta-data=/dev/loop0p1 isize=512 agcount=4, agsize=131072 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=524288, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Discarding blocks...Done.step 6: mount
[[email protected] ~]# mount /dev/loop0p1 /mnt
[[email protected] ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 8G 0 loop
└─loop0p1 259:0 0 2G 0 loop /mnt
sr0 11:0 1 1024M 0 rom
vda 252:0 0 40.1G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 38.1G 0 part
├─rl-root 253:0 0 34.2G 0 lvm /
└─rl-swap 253:1 0 3.9G 0 lvm [SWAP]
vdb 252:16 0 5G 0 disk
[[email protected] ~]# mount | grep /mnt
/dev/loop0p1 on /mnt type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
[[email protected] ~]# step 7: Use
[[email protected] ~]# echo "A test file." > /mnt/test.txt
[[email protected] ~]# cat /mnt/test.txt
A test file.
[[email protected] ~]# Reference material
https://man7.org/linux/man-pages/man4/loop.4.html#:~:text=The%20loop%20device%20is%20a,or%20to%20another%20block%20device.
边栏推荐
- [Logitech] m720
- Ppt tutorial, how to save a presentation as a PDF file in PowerPoint?
- 【愚公系列】2022年7月 Go教学课程 001-Go语言前提简介
- UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x98 in position 1093: illegal multibyte sequence
- ModStartBlog 现代化个人博客系统 v5.2.0 源码下载
- 【微服务|openfeign】feign的两种降级方式|Fallback|FallbackFactory
- Leader: who uses redis expired monitoring to close orders and get out of here!
- What does software testing do? Find defects and improve the quality of software
- Wechat brain competition answer applet_ Support the flow main belt with the latest question bank file
- 网络 - VXLAN
猜你喜欢

Redis:有序集合zset类型数据操作命令

RPC技术

Graduation project

EventBridge 在 SaaS 企业集成领域的探索与实践

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

How to telecommute more efficiently | community essay solicitation

ctf-pikachu-XSS

什么是上下文?

多位科技公司创始人向Entrepreneur First提供高达1.58亿美元的C轮融资,协助其投资下一代全球创新者

UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x98 in position 1093: illegal multibyte sequence
随机推荐
程序员远程办公喜忧参半| 社区征文
Asynchronous development process - touch your hand and lead you to realize a promise
Architecture training graduation design + summary
Exercises in quantum mechanics
Keysight N9320B射频频谱分析仪解决轮胎压力监测方案
FT2000+下LPC中断绑核使用说明
软件测试是干什么的 发现缺陷错误,提高软件的质量
Understand the principle of bytecode enhancement technology through the jvm-sandbox source code
网络 - VXLAN
leetcode刷题:二叉树05(翻转二叉树)
博朗与Virgil Abloh于2021年为纪念博朗品牌100周年而联合打造的“功能性艺术”将在博物馆展出Abloh作品期间首次亮相
沃博联结束战略评估,决定保留表现优异的博姿业务
leetcode刷题:二叉树07(二叉树的最大深度)
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
02 specific implementation of LS command
RHCSA 01 - 创建分区与文件系统
Configuration and hot update of nocturnal simulator in hbuildx
ctf-pikachu-XSS
仿《游戏鸟》源码 手游发号评测开服开测合集专区游戏下载网站模板
RHCSA 08 - automount配置