首页 > 系统相关 >rocky linux:为新磁盘做分区/格式化/挂载(Rocky Linux 9.1)

rocky linux:为新磁盘做分区/格式化/挂载(Rocky Linux 9.1)

时间:2023-05-09 15:23:37浏览次数:49  
标签:partition rocky Linux bytes NUMBER dev linux 512 TYPE

一,查看所有磁盘

查看磁盘的分区
[root@blog ~]# fdisk -l
Disk /dev/vda: 50 GiB, 53687091200 bytes, 104857600 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: gpt
Disk identifier: CDEEAA24-BF4D-4FEA-965A-75143EC1F765


Device      Start       End   Sectors  Size Type
/dev/vda1    2048      4095      2048    1M BIOS boot
/dev/vda2    4096    208895    204800  100M EFI System
/dev/vda3  208896 104857566 104648671 49.9G Linux filesystem




Disk /dev/vdb: 100 GiB, 107374182400 bytes, 209715200 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
查看已挂载的分区,可以看到/dev/vdb未挂载
[root@blog ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           1.5G  544K  1.5G   1% /run
/dev/vda3        50G  3.1G   47G   7% /
/dev/vda2       100M  7.0M   93M   7% /boot/efi
tmpfs            50M     0   50M   0% /usr/local/aegis/cgroup
tmpfs           742M     0  742M   0% /run/user/0

二,分区:

[root@blog ~]# parted /dev/vdb
GNU Parted 3.5
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help
  align-check TYPE N                       check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all]            display the partition table, or available devices, or free space, or all found partitions
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  resizepart NUMBER END                    resize partition NUMBER
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  type NUMBER TYPE-ID or TYPE-UUID         type set TYPE-ID or TYPE-UUID of partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU Parted
(parted) print
Error: /dev/vdb: unrecognised disk label
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
(parted) mklabel gpt
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:


Number  Start  End  Size  File system  Name  Flags


(parted) mkpart primary 0 107GB
Warning: The resulting partition is not properly aligned for best performance: 34s % 2048s != 0s
Ignore/Cancel? C
(parted) mkpart primary 1MiB 107GB

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: [email protected]

三,格式化

[root@blog ~]# mkfs.ext4 /dev/vdb1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 26213888 4k blocks and 6553600 inodes
Filesystem UUID: d25c9fa0-6123-45d2-bbeb-adf1c21ee6c6
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872


Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done

四,挂载

[root@blog ~]# mount /dev/vdb1 /web
[root@blog ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           1.5G  544K  1.5G   1% /run
/dev/vda3        50G  3.1G   47G   7% /
/dev/vda2       100M  7.0M   93M   7% /boot/efi
tmpfs            50M     0   50M   0% /usr/local/aegis/cgroup
tmpfs           742M     0  742M   0% /run/user/0
/dev/vdb1        98G   24K   93G   1% /web

五,编辑fstab配置文件,实现启动时自动挂载:

[root@blog ~]# blkid
/dev/vdb1: UUID="d25c9fa0-6123-45d2-bbeb-adf1c21ee6c6" TYPE="ext4" PARTLABEL="primary" PARTUUID="980c51af-a08b-4f3e-932a-2f0b6ced4a46"
/dev/vda2: SEC_TYPE="msdos" UUID="54F8-66C8" TYPE="vfat" PARTUUID="a5b87af5-0a78-4a81-a97e-79ff22a64bc9"
/dev/vda3: LABEL="root" UUID="87d48954-0eea-4e64-8c6e-27a537d26032" TYPE="xfs" PARTUUID="78a160b6-9409-479c-91ce-10f0989470b6"
/dev/vda1: PARTUUID="dfead5b8-c2c1-41f6-b3d4-0fdc094b74f4”


[root@blog ~]# vi /etc/fstab
增加一行:
UUID=d25c9fa0-6123-45d2-bbeb-adf1c21ee6c6 /web                ext4     defaults        0 2

六,查看linux的版本:

[root@blog ~]# cat /etc/redhat-release
Rocky Linux release 9.1 (Blue Onyx)

 

标签:partition,rocky,Linux,bytes,NUMBER,dev,linux,512,TYPE
From: https://www.cnblogs.com/architectforest/p/17385116.html

相关文章

  • Linux之select、poll、epoll讲解
    目录1select、poll、epoll1.1引言1.2IO和Linux内核发展1.2.1整体概述1.2.2阻塞IO1.2.3非阻塞IO1.2.4select1.2.5共享空间1.2.6零拷贝1.3select1.3.1简介1.3.2select缺点1.4poll介绍1.4.1与select差别1.4.2poll缺点1.5epoll1.5.1ep......
  • Linux部署Prometheus+Alertmanager并配置钉钉告警
    一、Prometheus告警简介告警能力在Prometheus的架构中被划分成两个独立的部分。如下所示,通过在Prometheus中定义AlertRule(告警规则),Prometheus会周期性的对告警规则进行计算,如果满足告警触发条件就会向Alertmanager发送告警信息。在Prometheus中一条告警规则主要由以下几部分组......
  • linux上使用yum部署mongodb4.2+分片副本
    系统配置Linux是有文件句柄限制的,而且默认不是很高,一般都是1024,作为一台生产服务器,其实很容易就达到这个数量。为防止服务因toomanyopenfiles错误出现宕机,这里需要对linux系统句柄数进行调整。##临时调整,系统重启即失效ulimit-SHn65535##永久调整,编辑/etc/security/limi......
  • centos(linux):yum报错:removing mirrorlist with no valid mirrors的处理(centos 6.1
    一,报错[root@osc~]#yuminstall-ypython3-pipLoadedplugins:fastestmirror,securitySettingupInstallProcessDeterminingfastestmirrorsYumRepoError:AllmirrorURLsarenotusingftp,http[s]orfile.Eg.Invalidrelease/repo/archcombination/rem......
  • 解决 VirutalBox 安装 Alpine Linux 出现 Kernel Panic 的问题
    问题如图,使用默认配置安装AlpineLinux时总是会启动都启动不了,找了半天后终于在官方论坛上找到原因了。解决在设置里分配大于1个的cpu就行,如图我这里给的是2个,分配完毕后重新启动就正常了......
  • 安装nginx--银河麒麟V10Kylin Linux
    原文链接:https://blog.csdn.net/qq_30665009/article/details/1260217961、安装nginx之前,在内网环境下需要先进行配置本地yum源。2、本文使用的操作系统:银河麒麟V10飞腾版3、查看操作系统CPU型号[root@localhost/]#lscpu4、查看操作系统信息cat/etc/*release5、安装的......
  • Linux 系统中,找到运行在某个特定端口的应用程序目录
    首先,你需要找到运行在特定端口上的进程的PID。这可以通过使用lsof命令完成:lsof-i:<port>其中,<port>是你要查找的端口号。在返回的结果中,你可以找到PID(进程ID)。然后,你可以使用pwdx命令来获取这个进程的当前工作目录:pwdx<pid>其中,<pid>是你在上一步找到的进程......
  • 《Linux高性能服务器编程》学习记录(二)linux网络编程基础API
    Linux网络API主要有三种:socket地址API。socket最开始的含义是一个IP地址和端口对(ip,port)。它唯一地表示了使用TCP通信的一端,称其为socket地址。socket基础API。socket的主要API都定义在sys/socket.h头文件中,包括创建socket、命名socket、监听socket、接受连接、发起连接、读写......
  • 学习LXC(Linux 容器)技术
    安装LXC、LXD、zfs测试机器为ubuntusudoapt-getinstalllxclxdzfsutils-linux-y创建LXD的zfs存储池sudolxdinit##根据提示全部敲回车即可添加官方镜像源sudolxcremoteaddimagesimages.linuxcontainers.org查看镜像lxcimagelist[<remote>:][<filter>......
  • 如何创建可引导的 ESXi USB 安装介质 (macOS, Linux, Windows)
    如何制作ESXiUSB启动盘请访问原文链接:https://sysin.org/blog/create-bootable-esxi-usb-installer/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org以下USB存储设备可以是U盘/SD卡,当然USBSSD更佳。macOSmacOS使用终端自带命令即可完成操作。查看US......