[root@server1 ~]# parted /dev/sdc ----->对磁盘sdc进行分区
GNU Parted 3.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print ----->打印输出
Error: /dev/sdc: unrecognised disk label
Model: ATA ST2000NM0018-2F3 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
(parted) mklabel gpt ----->此处
(parted) print
Model: ATA ST2000NM0018-2F3 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(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
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) mkpart primary 0% 100% ----->此处
(parted) print
Model: ATA ST2000NM0018-2F3 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2000GB 2000GB primary
(parted) quit ----->此处
Information: You may need to update /etc/fstab.
[root@server1 ~]# fdisk -l
Disk /dev/sda: 960.2 GB, 960197124096 bytes, 1875385008 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x47cb140a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 718847 358400 7 HPFS/NTFS/exFAT
/dev/sda2 718848 1874327551 936804352 7 HPFS/NTFS/exFAT
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdc: 2000.4 GB, 2000398934016 bytes, 3907029168 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
Disk label type: gpt
Disk identifier: 9AF8F6E8-25B3-4933-9EF1-3B727597A49E
# Start End Size Type Name
1 2048 3907028991 1.8T Microsoft basic primary
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes, 3907029168 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
Disk label type: dos
Disk identifier: 0x00004c01
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 2099199 1048576 83 Linux
/dev/sdb2 2099200 421529599 209715200 83 Linux
/dev/sdb3 421529600 555747327 67108864 82 Linux swap / Solaris
/dev/sdb4 555747328 3907028991 1675640832 5 Extended
/dev/sdb5 555749376 3907028991 1675639808 83 Linux
Disk /dev/loop0: 4059 MB, 4059037696 bytes, 7927808 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
Disk label type: dos
Disk identifier: 0x5640c915
Device Boot Start End Blocks Id System
/dev/loop0p1 * 0 7927807 3963904 0 Empty
/dev/loop0p2 699276 717267 8996 ef EFI (FAT-12/16/32)
[root@server1 ~]#
[root@server1 ~]# parted /dev/sdc print
Model: ATA ST2000NM0018-2F3 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2000GB 2000GB primary
[root@server1 ~]#
[root@server1 ~]# mkfs.xfs /dev/sdc1 ----->此处把sdc1建立为xfs文件系统。
meta-data=/dev/sdc1 isize=512 agcount=4, agsize=122094592 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=488378368, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=238466, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@server1 ~]
[root@server1 ~]# blkid ----->此处使用blkid查询出sdc1的UUID,以便在fstab中使用该UUID。
/dev/sda1: LABEL="M-gM-3M-;M-gM-;M-^_M-dM-?M-^]M-gM-^UM-^Y" UUID="AE38544F38541923" TYPE="ntfs"
/dev/sda2: UUID="801654A216549ACC" TYPE="ntfs"
/dev/sdc1: UUID="68315acd-74a4-4e00-9e87-3397345dd46e" TYPE="xfs" PARTLABEL="primary" PARTUUID="744e90d5-1058-487e-86f4-3224b9fda3f7"
/dev/sdb1: UUID="0e1f5254-7868-4753-907d-312c8f9f12b6" TYPE="xfs"
/dev/sdb2: UUID="60a3cdf8-6cc3-4cf9-9163-59f59e8fadf1" TYPE="xfs"
/dev/sdb3: UUID="4a8f08e7-6600-4a63-80ba-735fed3765ab" TYPE="swap"
/dev/sdb5: UUID="6c7c0a86-f796-4bfd-8f9e-5ebef6882c8e" TYPE="xfs"
/dev/loop0: UUID="2017-07-11-01-39-24-00" LABEL="RHEL-7.4 Server.x86_64" TYPE="iso9660" PTTYPE="dos"
[root@server1 ~]#
[root@server1 ~]# mkdir /hgsoft
[root@server1 ~]# chown hg:hg /hgsoft
[root@server1 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Apr 12 23:47:44 2019
#
# 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
#
UUID=60a3cdf8-6cc3-4cf9-9163-59f59e8fadf1 / xfs defaults 0 0
UUID=0e1f5254-7868-4753-907d-312c8f9f12b6 /boot xfs defaults 0 0
UUID=6c7c0a86-f796-4bfd-8f9e-5ebef6882c8e /home xfs defaults 0 0
UUID=4a8f08e7-6600-4a63-80ba-735fed3765ab swap swap defaults 0 0
UUID=68315acd-74a4-4e00-9e87-3397345dd46e /hgsoft xfs defaults 0 0
[root@server1 ~]#