parted


title: “Parted”
createTime: 2021-07-07T16:58:26+08:00
updateTime: 2021-07-07T16:58:26+08:00
draft: false
author: “name”
tags: [“分区”,“磁盘”]
categories: [“linux”]
description: “测试的”

parted

规划分区

  • 进入某个磁盘的分区

    • parted /dev/sdb
  • 新建标签类型

    • mklabel

    • (parted) mklabel                                                  
      新的磁盘标签类型? gpt                                             
      警告: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
      是/Yes/否/No? yes 
      
  • 新建分区

    • mkpart

    • (parted) mkpart
      分区名称?  []? BigDataPart
      文件系统类型?  [ext2]? ext4
      起始点? 1    可以输入具体的起始点(1M或者1G)1表示扇区最小的起始点   
      结束点? -1   结束点一样也可以输入具体的结束点(100M或者300G)-1表示扇区最后的结束点                                                     
      
  • 输出分区

    • p

    • (parted) p                                                                
      Model: DELL PERC H730P Adp (scsi)
      Disk /dev/sdb: 10.0TB
      Sector size (logical/physical): 512B/4096B
      Partition Table: gpt
      Disk Flags: 
      
      Number  Start   End     Size    File system  Name         标志
       1      1049kB  10.0TB  10.0TB  xfs          BigDataPart
      
      
  • 退出

    • quit

    • (parted) quit                                                             
      

createTime: 2021-07-07T16:58:26+08:00
updateTime: 2021-07-07T16:58:26+08:00
```

格式化分区

  • mkfs.ext4 /dev/sdb1
  • 上面的是ext4的格式化 sdb1 是上面规划出来的分区

挂载分区

  • 临时

  • mount /dev/sdb1 /docker/software

  • 永久

    • vi /etc/fstab

    • /dev/sdb1 /docker/software ext4 defaults 0 0

    • #
      # /etc/fstab
      # Created by anaconda on Sat Jul  3 02:18:23 2021
      #
      # Accessible filesystems, by reference, are maintained under '/dev/disk'
      # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
      #
      /dev/mapper/centos-root /                       xfs     defaults        0 0
      UUID=c35ab2e3-6af6-46c2-bdd9-3a4562f25d47 /boot                   xfs     defaults        0 0
      UUID=869C-6235          /boot/efi               vfat    umask=0077,shortname=winnt 0 0
      /dev/mapper/centos-swap swap                    swap    defaults        0 0
      
      /dev/sdb1              /docker/software                     ext4    defaults        0 0
      

你可能感兴趣的:(微信)