CentOS 6.X 掛載4TB的硬碟的方法

來源:互聯網
上載者:User

標籤:centos   硬碟   4tb   掛載   

手頭有一個任務就是對於公司的一些重要資料做本地備份。使用的是希捷的4TB硬碟。

對於4TB的硬碟如果直接使用fdisk的分區會出現以下警告:

WARNING: GPT (GUID Partition Table) detected on '/dev/sde'! The util fdisk doesn't support GPT. Use GNU Parted.

而且分區的結果就是只剩下2TB。


於是乎就存在一個問題:怎麼在系統上掛載一個4TB的硬碟,只分1個區。

 parted命令可以劃分單個分區大於2T的GPT格式的分區,也可以劃分普通的MBR分區,fdisk命令對於大於2T的分區無法劃分,所以用fdisk無法看到parted劃分的GPT格式的分區。


這裡需要是使用一個工具:parted。

安裝parted工具:

yum install -y parted

parted工具的命令參數:

Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run ininteractive mode.選項:  -h, --help                      顯示此求助資訊  -l, --list                      lists partition layout on all block devices  -m, --machine                   displays machine parseable output  -s, --script                    從不提示使用者  -v, --version                   顯示版本  -a, --align=[none|cyl|min|opt]  alignment for new partitions命令:  align-check TYPE N                        check partition N for TYPE(min|opt)        alignment  check NUMBER                             do a simple check on the file system  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition  help [COMMAND]                           print general help, or help on        COMMAND  mklabel,mktable LABEL-TYPE               create a new disklabel (partition        table)  mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on        partition NUMBER  mkpart PART-TYPE [FS-TYPE] START END     make a partition  mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system  move NUMBER START END                    move partition NUMBER  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  resize NUMBER START END                  resize partition NUMBER and its file        system  rm NUMBER                                delete partition NUMBER  select DEVICE                            choose the device to edit  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 [options] [device [command [options...]...]]    options    -h  顯示協助資訊    -l  顯示所有塊裝置上的分區    device    對哪個塊裝置進行操作,如果沒有指定則使用第一個塊裝置    command [options...]    check partition      對分區做一個簡單的檢測    cp [source-device] source dest      複製source-device裝置上的source分區到當前裝置的dest分區    mklabel label-type     建立新分區表類型,label-type可以是:"bsd", "dvh", "gpt",  "loop","mac", "msdos", "pc98", or "sun" 一般的pc機都是msdos格式,如果分區大於2T則需要選用gpt格式的分區表。    mkfs partition fs-type      在partition分區上建立一個fs-type檔案系統,fs-type可以是:"fat16", "fat32", "ext2", "linux-swap","reiserfs" 注意不支援ext3格式的檔案系統,只能先分區然後用專有命令進行格式化。    mkpart part-type [fs-type] start end     建立一個part-type類型的分區,part-type可以是:"primary", "logical", or "extended" 如果指定fs-type則在建立分區的同時進行格式化。start和end指的是分區的起始位置,單位預設是M。    eg:mkpart  primary  0  -1   0表示分區的開始  -1表示分區的結尾  意思是劃分整個硬碟空間為主要磁碟分割    mkpartfs part-type fs-type start end     建立一個fs-type類型的part-type分區,不推薦使用,最好是使用mkpart分區完成後使用mke2fs進行格式化。    name partition name     給分區設定一個名字,這種設定只能用在Mac, PC98, and GPT類型的分區表,設定時名字用引號括起來    select device     在機器上有多個硬碟時,選擇操作那個硬碟    resize partition start end      調整分區大小    rm partition      刪除一個分區    rescue start end      拯救一個位於stat和end之間的分區    unit unit     在前面分區時,預設分區時數值的單位是M,這個參數卡伊改變預設單位,"kB", "MB",  "GB",  "TB"    move partition start end     移動partition分區    print  顯示分區表資訊  quit 退出parted

學習完parted的知識,來完成我們任務:

1、使用命令進入互動模式並且查看當前硬碟分區資訊:

parted /dev/sdep


2、刪除當前存在分區,並在此查看結果(為了寫這個教程,我把剛分區好的硬碟又刪除了^~^!!)

rm 1p


3、將硬碟格式化為gpt

mklabel gpt


4、對磁碟分割,將整個硬碟分為一個地區。

mkpart primary 0 -1Ignore

parted執行mkpart primary會直接分區(而fdisk需要儲存)

5、退出parted

quit

6、完成分區之後,就開始格式化分區的工作了:

mkfs.ext4 /dev/sde1


7、掛載硬碟

mount /dev/sde1 /var/XXX

終於大功告成啦。

散花!!!!


歡迎掃描下面的二維碼關注我的公眾號:codemanship(碼術)


著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

CentOS 6.X 掛載4TB的硬碟的方法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.