[root@localhost ~]# parted /dev/sdc #使用parted分区命令
GNU Parted 3.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)help#若不清楚如何操作,可以输入help查看帮助信息align-check TYPE N check partition N for TYPE(min|opt) alignmenthelp[COMMAND] print general help, or help on COMMANDmklabel,mktable LABEL-TYPE create a new disklabel (partition table)mkpart PART-TYPE [FS-TYPE] START END make a partitionname NUMBER NAME name partition NUMBER as NAMEprint [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partitionquit exit programrescue START END rescue a lost partition near START and ENDresizepart NUMBER END resize partition NUMBERrm NUMBER delete partition NUMBERselect DEVICE choose the device to editdisk_set FLAG STATE change the FLAG on selected devicedisk_toggle [FLAG] toggle the state of FLAG on selected deviceset NUMBER FLAG STATE change the FLAG on partition NUMBERtoggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBERunit UNIT set the default unit to UNITversion display the version number and copyright information of GNU Parted
(parted) mklabel gpt #设置磁盘分区表格式为GPT
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want
to continue?
Yes/No? yes#确认(parted) mkpart #创建新分区
Partition name? []? gpt1 #设置分区名称
File system type? [ext2]? xfs #设置分区格式化时采用的文件系统类型
Start? 0KB #设置分区起始位置
End? 2GB #设置分区结束位置
Warning: You requested a partition from 0.00B to 2000MB (sectors 0..3906250).
The closest location we can manage is 17.4kB to 2000MB (sectors 34..3906250).
Is this still acceptable to you?
Yes/No? yes#确认
Warning: The resulting partition is not properly aligned for best performance: 34s % 2048s != 0s
Ignore/Cancel? Ignore #忽略告警(parted) print #输出分区信息
Model: Virtio Block Device (virtblk)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:Number Start End Size File system Name Flags117.4kB 2000MB 2000MB xfs gpt1 #这个就是上面步骤创建的分区(parted) quit
Information: You may need to update /etc/fstab.
非交互式创建分区
步骤 1 输入如下命令直接创建分区。
[root@localhost ~]# parted /dev/sdc mkpart gpt2 2001M 4G #创建分区,设置起始和结束位置
Information: You may need to update /etc/fstab.[root@localhost ~]# parted /dev/sdc p #输出分区信息
Model: Virtio Block Device (virtblk)
Disk /dev/sdc: 5369MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:Number Start End Size File system Name Flags117.4kB 2000MB 2000MB gpt12 2001MB 4000MB 2000MB gpt2 #这个就是前述步骤创建的分区#因为/dev/sdc磁盘已经设置了分区表格式是GPT,所以这里没有重复设置。若是一块新的磁盘需要输入如下命令:[root@localhost ~]# parted /dev/sdc mklabel gpt
删除分区
步骤 1 执行如下命令删除/dev/sdc1分区。
[root@localhost ~]# parted /dev/sdc rm 1
Information: You may need to update /etc/fstab.[root@localhost ~]# parted /dev/sdc p
Model: Virtio Block Device (virtblk)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:Number Start End Size File system Name Flags2 2001MB 4000MB 2000MB gpt2
It’s time for us to learn how to analyse natural language documents, using Natural Language Processing (NLP). We’ll be focusing on the Hugging Face ecosystem, especially the Transformers library, and the vast collection of pretrained NLP models. Our proj…