linux 新建分区 挂载分区 LVM创建

  • GPT:GUID partition table,全局唯一标识磁盘分区表
    • 可以支持无限个分区
    • 可以支持EB级别的硬盘

*********************************************************************************************************************

新建分区,格式化分区,挂载分区:
fdisk新建分区:

NAME
       fdisk - Partition table manipulator for Linux
[root@centos6 ~]#fdisk /dev/sda

Command (m for help): n        //新建分区
First cylinder (5492-6528, default 5492):   //使用默认起始柱面
Using default value 5492
Last cylinder, +cylinders or +size{K,M,G} (5492-6528, default 6528): +5G  //分区大小为5G

Command (m for help): w     //保存设置退出
The partition table has been altered!

[root@centos6 ~]#
[root@centos6 ~]#partx -a /dev/sda   //新建分区后需要让内核重读分区表,这里需要执行两次
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
BLKPG: Device or resource busy
error adding partition 3
BLKPG: Device or resource busy
error adding partition 4
BLKPG: Device or resource busy
error adding partition 5
BLKPG: Device or resource busy
error adding partition 6
BLKPG: Device or resource busy
error adding partition 7
[root@centos6 ~]#lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0     11:0    1   3.7G  0 rom  
sda      8:0    0    50G  0 disk 
├─sda1   8:1    0     1G  0 part /boot
├─sda2   8:2    0  19.5G  0 part /
├─sda3   8:3    0  19.5G  0 part /data
├─sda4   8:4    0  31.5K  0 part 
├─sda5   8:5    0     2G  0 part [SWAP]
├─sda6   8:6    0 343.5K  0 part 
└─sda7   8:7    0     5G  0 part     //内核已识别到新建的分区

mke2fs:ext系列文件系统管理工具,格式化分区
-t  {ext2|ext3|ext4}: 指定文件系统
-b {1024|2048|4096}: 指定分区块大小
-L : 指定分区卷标名
-m : 指定分区预留空间百分比,默认为5
 

//格式化新建的分区为ext4格式,块大小为2048,卷标为‘mydata’,预留空间20%的分区
[root@centos6 ~]#mke2fs -t ext4 -b 2048 -L 'mydata' -m 20 /dev/sda7 
mke2fs 1.41.12 (17-May-2010)
Filesystem label=mydata
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
328440 inodes, 2625440 blocks
525088 blocks (20.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=540016640
161 block groups
16384 blocks per group, 16384 fragments per group
2040 inodes per group
Superblock backups stored on blocks: 
        16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104, 
        2048000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@centos6 ~]#
[root@centos6 ~]#tune2fs -l /dev/sda7   //查看分区具体信息
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   mydata   //卷标
Last mounted on:          <not available>
Filesystem UUID:          02bbf8a1-84a1-4d06-8bdf-b395dd40e7ff
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
Filesy
  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值