Linux下磁碟掛載

來源:互聯網
上載者:User

標籤:

公司硬碟不夠用了,新買了一個儲存,需要掛載到現在的系統上。前期的步驟就不說了,營運全部搞定,無非是硬體和網路那一套,這裡只說分配到本人後在Linux下如何掛載。

具體步驟如下:

1、查看是否已經分配

[[email protected] home]# fdisk -l磁碟 /dev/sda:64.4 GB, 64424509440 位元組,125829120 個扇區Units = 扇區 of 1 * 512 = 512 bytes扇區大小(邏輯/物理):512 位元組 / 512 位元組I/O 大小(最小/最佳):512 位元組 / 512 位元組磁碟標籤類型:dos磁碟標識符:0x000a47ad   裝置 Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048     1026047      512000   83  Linux/dev/sda2         1026048   125829119    62401536   8e  Linux LVM磁碟 /dev/sdb:1649.3 GB, 1649267441664 位元組,3221225472 個扇區Units = 扇區 of 1 * 512 = 512 bytes扇區大小(邏輯/物理):512 位元組 / 512 位元組I/O 大小(最小/最佳):512 位元組 / 512 位元組

2、發現有磁碟,路徑為/dev/sdb。然後使用fdisk命令進行建立分區

[[email protected] home]# fdisk /dev/sdb

fdisk命令如下:

命令(輸入 m 擷取協助):m命令操作   a   toggle a bootable flag   b   edit bsd disklabel   c   toggle the dos compatibility flag   d   delete a partition   g   create a new empty GPT partition table   G   create an IRIX (SGI) partition table   l   list known partition types   m   print this menu   n   add a new partition   o   create a new empty DOS partition table   p   print the partition table   q   quit without saving changes   s   create a new empty Sun disklabel   t   change a partition‘s system id   u   change display/entry units   v   verify the partition table   w   write table to disk and exit   x   extra functionality (experts only)

3、然後先建立分區(我這裡因為要儲存大資料庫檔案   所以邏輯全部是一個分區)

命令(輸入 m 擷取協助):nPartition type:   p   primary (0 primary, 0 extended, 4 free)   e   extendedSelect (default p): Using default response p分區號 (1-4,預設 1):起始 扇區 (2048-3221225471,預設為 2048):將使用預設值 2048Last 扇區, +扇區 or +size{K,M,G} (2048-3221225471,預設為 3221225471):將使用預設值 3221225471分區 1 已設定為 Linux 類型,大小設為 1.5 TiB

4、最後儲存分區

命令(輸入 m 擷取協助):wThe partition table has been altered!Calling ioctl() to re-read partition table.正在同步磁碟。

5、使用fdisk -l命令查看,已經有分區了

磁碟 /dev/sdb:1649.3 GB, 1649267441664 位元組,3221225472 個扇區Units = 扇區 of 1 * 512 = 512 bytes扇區大小(邏輯/物理):512 位元組 / 512 位元組I/O 大小(最小/最佳):512 位元組 / 512 位元組磁碟標籤類型:dos磁碟標識符:0xe0bc0098   裝置 Boot      Start         End      Blocks   Id  System/dev/sdb1            2048  3221225471  1610611712   83  Linux

6、建好分區後要格式化分區,建立檔案系統

[[email protected] home]# mkfs.xfs -f /dev/sdsda   sda1  sda2  sdb   sdb1  [[email protected] home]# mkfs.xfs -f /dev/sdb1meta-data=/dev/sdb1              isize=256    agcount=4, agsize=100663232 blks         =                       sectsz=512   attr=2, projid32bit=1         =                       crc=0        finobt=0data     =                       bsize=4096   blocks=402652928, imaxpct=5         =                       sunit=0      swidth=0 blksnaming   =version 2              bsize=4096   ascii-ci=0 ftype=0log      =internal log           bsize=4096   blocks=196607, version=2         =                       sectsz=512   sunit=0 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0

7、這樣檔案系統就建好了,然後選擇一個掛載點掛上就可以了,我掛載在/home/data/ 下了

[[email protected] home]# mount /dev/sdb1 /home/data/

8、查看一下掛載是否成功了

[[email protected] home]# df -TH /home/data/檔案系統       類型  容量  已用  可用 已用% 掛載點/dev/sdb1      xfs   1.7T   34M  1.7T    1% /home/data

9、修改一下系統配置加入下列行到/etc/fstab,讓系統啟動後自動掛載,否則有可能會掉啊

/dev/sdb1  /home/data xfs  defaults  0  0

 

Linux下磁碟掛載

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.