parted和fdisk分区挂载
parted
[root@centos7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 1.1T 0 disk ├─sda1 8:1 0 476M 0 part /boot ├─sda2 8:2 0 8G 0 part [SWAP] └─sda3 8:3 0 1.1T 0 part / sdb 8:16 0 1.8T 0 disk sr0 11:0 1 1024M 0 rom [root@centos7 ~]# parted /dev/sd sda sda1 sda2 sda3 sdb [root@centos7 ~]# parted /dev/sdb GNU Parted 3.1 使用 /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) p 错误: /dev/sdb: unrecognised disk label Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: unknown Disk 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) mklabel msdos (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 (parted) p Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name 标志 (parted) mkpart aaa 0 100% 警告: The resulting partition is not properly aligned for best performance. 忽略/Ignore/放弃/Cancel? i (parted) p Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name 标志 1 17.4kB 2000GB 2000GB aaa (parted) gpt 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) p Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name 标志 1 17.4kB 2000GB 2000GB aaa (parted) mkpart 1 0 100% 错误: 无法满足分区的所有限制。 (parted) rm aaa 错误: 需要分区编号。 (parted) rm 1 (parted) p Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name 标志 (parted) mkpart 1 0 100% 警告: The resulting partition is not properly aligned for best performance. 忽略/Ignore/放弃/Cancel? c (parted) p Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name 标志 (parted) mkpart a 0 100% 警告: The resulting partition is not properly aligned for best performance. 忽略/Ignore/放弃/Cancel? i (parted) p Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sdb: 2000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name 标志 1 17.4kB 2000GB 2000GB a (parted) quit 信息: You may need to update /etc/fstab. [root@centos7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 1.1T 0 disk ├─sda1 8:1 0 476M 0 part /boot ├─sda2 8:2 0 8G 0 part [SWAP] └─sda3 8:3 0 1.1T 0 part / sdb 8:16 0 1.8T 0 disk └─sdb1 8:17 0 1.8T 0 part sr0 11:0 1 1024M 0 rom [root@centos7 ~]#
[root@centos7 ~]# part
parted partprobe partx
[root@centos7 ~]# partx -h
用法:
partx [-a|-d|-s|-u] [--nr <n:m> | <分区>] <磁盘>
选项:
-a, --add 添加指定的分区或所有分区
-d, --delete 删除指定的分区或所有分区
-s, --show 列出分区
-u, --update 更新指定的分区或所有分区
-b, --bytes 以字节为单位而非易读的格式来打印 SIZE
-g, --noheadings --show 时不打印标题
-n, --nr <n:m> 指定分区范围(例如:--nr 2:4)
-o, --output <type> 定义使用哪个输出列
-P, --pairs 使用 key=“value” 输出格式
-r, --raw 使用原生输出格式
-t, --type <类型> 指定分区类型(dos、bsd、solaris 等)
-v, --verbose 详尽模式
-h, --help 显示此帮助并退出
-V, --version 输出版本信息并退出
可用的列(针对 --show、--raw 或 --pairs):
NR 分区号
START 分区起点(扇区数)
END 分区终点(扇区数)
SECTORS 扇区数
SIZE 易读形式的大小
NAME 分区名
UUID 分区 UUID
TYPE 分区类型 十六进制 或 uuid
FLAGS 分区标志
SCHEME 分区表类型(dos、gpt、...)
更多信息请参阅 partx(8)。
[root@centos7 ~]# partx -s /dev/sdb
NR START END SECTORS SIZE NAME UUID
1 34 3905945566 3905945533 1.8T a 7e88976f-26aa-4319-af6a-48f0048e5db5
[root@centos7 ~]# partx -s /dev/sda
NR START END SECTORS SIZE NAME UUID
1 2048 976895 974848 476M
2 976896 17754111 16777216 8G
3 17754112 2339373055 2321618944 1.1T
[root@centos7 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
122060800 inodes, 488243191 blocks
24412159 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2636120064
14900 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@centos7 ~]# tune2fs -c 0 -i 0 /dev/sdb1
tune2fs 1.42.9 (28-Dec-2013)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
[root@centos7 ~]# mkdir /data2
[root@centos7 ~]# mount /dev/sdb1 /data2
[root@centos7 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda3 1.1T 1.1T 61G 95% /
devtmpfs 5.8G 0 5.8G 0% /dev
tmpfs 5.8G 4.0K 5.8G 1% /dev/shm
tmpfs 5.8G 8.6M 5.8G 1% /run
tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
/dev/sda1 473M 169M 305M 36% /boot
tmpfs 1.2G 0 1.2G 0% /run/user/0
tmpfs 1.2G 0 1.2G 0% /run/user/1006
/dev/sdb1 1.8T 77M 1.7T 1% /data2
[root@centos7 ~]#
自用博文.不限传播.欢迎留言.共同进步.

浙公网安备 33010602011771号