CentOS 操作一块9T的硬盘

文章
林里克斯

MBR 分区形式支持的磁盘最大容量为2TB。如果硬盘分区为 MBR 格式,且需要超过 2TB 时,建议使用 GPT 分区方式后将数据拷贝至新盘上。对于 Linux 操作系统而言,当磁盘分区形式选用 GPT 时,fdisk 分区工具将无法使用,需要采用 parted 工具。

实验平台:CentOS 7.4
fdisk只能操作最大为2T容量的磁盘
MBR 分区最大支持2T,超过2T的容量需要使用 GPT 分区


操作步骤:


一、查看系统磁盘


$ fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0008de3e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/sdc: 9896.9 GB, 9896849672960 bytes, 8323886080 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: 0x0008de3e

二、操作磁盘


1.使用parted命令操作大于2T的磁盘

$ parted /dev/sdc
#操作/dev/sdc这块磁盘
GNU Parted 3.1
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
#选择gpt格式
(parted) mkpart p1
#选择磁盘格式
File system type?  [ext2]? ext3     
#选择为ext3格式
Start? 0             
#开始容量
End? 9T   
#结束容量
eg:(这里也可以使用unit TB;修改单位为TB)
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                     
(parted) p  
#列出已有磁盘信息
Model: DELL MD38xxf (scsi)
Disk /dev/sdc: 9896GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  9000GB  9000GB               p1

2.格式化磁盘

$ mkfs.ext3 -T largefile /dev/sdc1 
#mkfs.ext3需要加参数才能操作超大磁盘,此操作磁盘越大需要时间越长
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
8583168 inodes, 2197265620 blocks
109863281 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
67056 block groups
32768 blocks per group, 32768 fragments per group
128 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, 512000000, 550731776, 644972544, 1934917632

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

3.挂载磁盘

$ mount /dev/sdc1 /homt/ftp/upload

三、测试


$ fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0008de3e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/sdc: 9896.9 GB, 9896849672960 bytes, 8323886080 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: 0x0008de3e


   Device Boot      Start         End           Blocks      Id  System
/dev/sdc1   *        2048    9896849672960    41941230992   83   gpt
df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G  6.5G   31G  18% /
devtmpfs        911M     0  911M   0% /dev
tmpfs           920M   84K  920M   1% /dev/shm
tmpfs           920M  416K  920M   1% /run
tmpfs           920M     0  920M   0% /sys/fs/cgroup
tmpfs           184M     0  184M   0% /run/user/0
/dev/sdc1       9.0T    6M  8.9T   1% /home/ftp/upload

Over~

版权协议须知!

本篇文章来源于 Uambiguous ,如本文章侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意

1498 0 2018-06-16


分享:
icon_mrgreen.gificon_neutral.gificon_twisted.gificon_arrow.gificon_eek.gificon_smile.gificon_confused.gificon_cool.gificon_evil.gificon_biggrin.gificon_idea.gificon_redface.gificon_razz.gificon_rolleyes.gificon_wink.gificon_cry.gificon_surprised.gificon_lol.gificon_mad.gificon_sad.gificon_exclaim.gificon_question.gif
博主卡片
林里克斯 博主大人
一个致力于Linux的运维平台
运维时间
搭建这个平台,只为分享及记载自己所遇之事和难题。

现在时间 2024-12-28

今日天气
站点统计
  • 文章总数:241篇
  • 分类总数:29个
  • 评论总数:12条
  • 本站总访问量 353817 次

@奥奥

@Wong arrhenius 牛比

@MakerFace 厉害了!