parted 磁盘分区

一、对于磁盘空间大于2T的,需要使用parted进行分区了

# parted /dev/sdj              # 对指定4T的硬盘进行分区
GNU Parted 3.1
Using /dev/sdj
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|NUMBER]     display the partition table, available devices, free space, all found partitions, or a
        particular partition
  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
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU Parted
(parted) mklabel gpt            # 将磁盘类型格式为gpt                                            
(parted) print                  # 进行显示                                          
Model: ATA ST4000NM016A-2HZ (scsi)
Disk /dev/sdj: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0 4001G  # 创建主分区并划分容量 或者使用 mkpart primary 0% 100%                                      
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore            # 键入Ignore                                         
(parted) print                                                            
Model: ATA ST4000NM016A-2HZ (scsi)
Disk /dev/sdj: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  4001GB  4001GB               primary

(parted) quit                     # 退出             

最后再格式化进行挂载

# mkfs.xfs -f /dev/sdj

挂载报错信息

Feb 14 16:07:05 host systemd: Unit data10.mount is bound to inactive unit dev-disk-by\x2duuid-ce5c8e38\x2dd7b1\x2d4769\x2d9672\x2d391a590e2b2f.device. Stopping, too.
Feb 14 16:07:05 host systemd: Stopped target Local File Systems.
Feb 14 16:07:05 host systemd: Unmounting /data10...
Feb 14 16:07:05 host kernel: XFS (sdj): Unmounting Filesystem
Feb 14 16:07:05 host systemd: Unmounted /data10.

解决方法

执行命令加载daemon-reload
systemctl daemon-reload

再次挂载硬盘
mount  /dev/sdj /data10

 

posted @ 2022-02-14 16:30  林中龙虾  阅读(349)  评论(0编辑  收藏  举报