非交互式增加分区【澳门新葡亰官网app】,交互式加多分区

By admin in 澳门新葡亰官网app on 2019年5月2日

 

非交互式增添分区,交互式增加分区

 

非交互式增加分区

方法一

加多/deb/sdb
下的分区,其实地方为一到一千M,第壹个分区地点为100一至两千M,地点千万无法内定错误

parted /dev/sdb mkpart primary 1 1000M
parted /dev/sdb     mkpart     primary 1001    3000M

 

方法二

(一)将您要在parted命令行输入的授命达成写入3个文本文件,比如叫做part.txt

(二)然后part.txt的始末接近于那般

    [[email protected] ~]# cat part.txt
    mkpart    
    part4    
    ext4        
    3073    
    4096    
    q      

(三)然后用接近如下命令完成自动分区:

  parted /dev/sdb < part.txt

第一来查看/dev/sdb现成分区情状

[[email protected] ~]# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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

# Start End Size Type Name
1 2048 2000895 976M Microsoft basic part1
2 2001953 4000000 975.6M Microsoft basic part2 

接下去运营命令:

parted /dev/sdb < part.txt

[[email protected] ~]# parted /dev/sdb < part.txt
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart
Partition name? []? part4
File system type? [ext2]? ext4
Start? 3073
End? 4096
(parted) q
Information: You may need to update /etc/fstab. 

再来查看分区境况

[[email protected] ~]# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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

# Start End Size Type Name
1 2048 2000895 976M Microsoft basic part1
2 2001953 4000000 975.6M Microsoft basic part2
3 6002688 7999487 975M Microsoft basic part4

  

 

方法三

恍如措施二,但是使用gdisk命令

(壹)写二个文书文件gdisk.txt

(二)编辑分区用到的文本

[[email protected] ~]# cat gdisk.txt
n
    ##空行,但必须有
    ##空行,但必须有
+1G
    ##空行,但必须有
w
y 

(3)然后用接近如下命令完毕自动分区:

gdisk /dev/sdb < gdisk.txt

第叁来查阅/dev/sdc现存分区意况

[[email protected] ~]# gdisk -l /dev/sdc
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdc: 10485760 sectors, 5.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F227EC43-CB17-4248-9B1A-13A35CEF8E92
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 10485726
Partitions will be aligned on 2048-sector boundaries
Total free space is 6291389 sectors (3.0 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 4196351 2.0 GiB 8300 Linux filesystem

下来运营命令:

gdisk /dev/sdb < gdisk.txt

[[email protected] ~]# gdisk /dev/sdb < gdisk.txt
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): Partition number (4-128, default 4): 
First sector (34-10485726, default = 7999488) or {+-}size{KMGTP}: Last sector (7999488-10485726,
 default = 10485726) or {+-}size{KMGTP}: Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem'

Command (? for help):
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully. 

再来查看分区景况

[[email protected] ~]# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.6
[……]
Total free space is 2394845 sectors (1.1 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 2000895 976.0 MiB 0700 part1
2 2001953 4000000 975.6 MiB 0700 part2
3 6002688 7999487 975.0 MiB 0700 part4
4 7999488 10096639 1024.0 MiB 8300 Linux filesystem

能够见见已经增进成功

fdisk也足以由此这种方式完毕非交互是分区

 

澳门新葡亰官网app, 非交互式加多分区
方法1 增加/deb/sdb
下的分区,其实地点为一到一千M,第壹个分区地点为100壹至2000M,位…

非交互式增添分区

方法一

加多/deb/sdb
下的分区,其实地点为一到1000M,第一个分区地点为100壹至三千M,地方千万无法内定错误

parted /dev/sdb mkpart primary 1 1000M
parted /dev/sdb     mkpart     primary 1001    3000M

 

方法二

(一)将你要在parted命令行输入的通令完成写入2个文件文件,举个例子叫做part.txt

(二)然后part.txt的内容左近于那样

    [root@local ~]# cat part.txt
    mkpart    
    part4    
    ext4        
    3073    
    4096    
    q      

(叁)然后用类似如下命令完毕机关分区:

  parted /dev/sdb < part.txt

先是来查看/dev/sdb现存分区情形

[root@local ~]# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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

# Start End Size Type Name
1 2048 2000895 976M Microsoft basic part1
2 2001953 4000000 975.6M Microsoft basic part2 

接下去运维命令:

parted /dev/sdb < part.txt

[root@local ~]# parted /dev/sdb < part.txt
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart
Partition name? []? part4
File system type? [ext2]? ext4
Start? 3073
End? 4096
(parted) q
Information: You may need to update /etc/fstab. 

再来查看分区意况

[root@local ~]# fdisk -l /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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

# Start End Size Type Name
1 2048 2000895 976M Microsoft basic part1
2 2001953 4000000 975.6M Microsoft basic part2
3 6002688 7999487 975M Microsoft basic part4

  

 

方法三

看似情势2,可是使用gdisk命令

(壹)写二个文本文件gdisk.txt

(贰)编辑分区用到的文本

[root@local ~]# cat gdisk.txt
n
    ##空行,但必须有
    ##空行,但必须有
+1G
    ##空行,但必须有
w
y 

(三)然后用类似如下命令达成机关分区:

gdisk /dev/sdb < gdisk.txt

先是来查看/dev/sdc现成分区境况

[root@local ~]# gdisk -l /dev/sdc
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdc: 10485760 sectors, 5.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F227EC43-CB17-4248-9B1A-13A35CEF8E92
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 10485726
Partitions will be aligned on 2048-sector boundaries
Total free space is 6291389 sectors (3.0 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 4196351 2.0 GiB 8300 Linux filesystem

下来运转命令:

gdisk /dev/sdb < gdisk.txt

[root@local ~]# gdisk /dev/sdb < gdisk.txt
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): Partition number (4-128, default 4): 
First sector (34-10485726, default = 7999488) or {+-}size{KMGTP}: Last sector (7999488-10485726,
 default = 10485726) or {+-}size{KMGTP}: Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): Changed type of partition to 'Linux filesystem'

Command (? for help):
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully. 

再来查看分区景况

[root@local ~]# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.6
[……]
Total free space is 2394845 sectors (1.1 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 2000895 976.0 MiB 0700 part1
2 2001953 4000000 975.6 MiB 0700 part2
3 6002688 7999487 975.0 MiB 0700 part4
4 7999488 10096639 1024.0 MiB 8300 Linux filesystem

能够见见曾经增加成功

fdisk也足以由此那种艺术落成非交互是分区

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2020 澳门新葡亰官网app 版权所有