设为首页 加入收藏

TOP

第五周-磁盘分区GPT、shell脚本练习、lvm详解(二)
2019-09-03 01:27:02 】 浏览:144
Tags:第五 磁盘 分区 GPT shell 脚本 练习 lvm 详解
nbsp;                                           

(parted) print                                                            

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 21.5GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number  Start   End     Size    File system  Name      Flags

 1      17.4kB  5000MB  5000MB               myNewGPT

 

(parted)

 

 

步骤4、如果分区错了,可以使用rm命令删除分区,后面跟分区的编号,比如我们要删除上面的分区1,然后打印删除后的结果

(parted) rm 1

(parted) print                                                           

Model: VMware, VMware Virtual S (scsi)

Disk /dev/sdb: 21.5GB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Disk Flags:

Number  Start  End  Size  File system  Name  Flags

(parted)  

 

 

步骤5、由于parted内建的mkfs还不够完善,所以完成以后我们可以使用quit命令退出parted并使用 系统的mkfs命令对分区进行格式化了,此时如果使用fdisk -l命令打印分区表会出现警告信息,这是正常的 

[root@localhost ~]# 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: 21.5 GB, 21474836480 bytes, 41943040 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: E53CF9CC-6556-41C1-B188-25735A0928F7

 

 

#         Start          End    Size  Type            Name

1                 34      9765625    4.7G  Microsoft basic myFirstGPT

 

 

步骤6、格式化文件系统

[root@localhost ~]# mkfs.ext4 /dev/sdb

mke2fs 1.42.9 (28-Dec-2013)

/dev/sdb is entire device, not just one partition!

Proceed anyway? (y,n) y

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

1310720 inodes, 5242880 blocks

262144 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2153775104

160 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

 

Allocating group tables: done                           

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done  

 

[root@localhost ~]#

 

 

步骤7、挂载

[root@localhost ~]# mkdir /mnt/myFirstGPT

[root@localhost ~]# mount /dev/sdb /mnt/myFirstGPT/

 

 

2、 创建一个10G的分区,并格式化为etx4文件系统。要求:

[root@localhost ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0x3a339f3a.

 

Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-41943039, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +1
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/12/12
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇ubuntu16.4系统和Gentos6.8系统查.. 下一篇48.Linux-普通U盘以及多分区U盘自..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目