linux伺服器掛載資料硬碟執行個體介紹

來源:互聯網
上載者:User

首先使用 SSH登陸到阿里雲伺服器 SSH登陸的軟體我用putty 百度裡面下載。

然後使用你的ROOT帳號登陸。修改密碼的命令為 passwd

如何掛載資料盤如下:

第一步使用 fdisk -l 查看你的硬碟
顯示如下

 代碼如下 複製代碼

[root@AY110519013348b ~]# fdisk -l
Disk /dev/hda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 6004 48227098+ 83 Linux
/dev/hda2 6005 6526 4192965 82 Linux swap / Solaris
Disk /dev/xvdb: 96.6 GB, 96636764160 bytes
255 heads, 63 sectors/track, 11748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdb1 1 11748 94365778+ 83 Linux

紅色的硬碟就是我們要掛載的。

使用mount 命令進行掛載

 代碼如下 複製代碼

[root@AY110519013348b ~]# mount /dev/xvdb1 /home

註:/dev/xvdb1 為你要掛載的盤(這裡的/dev/xvdb1 必須要和上面使用fdisk -l命令查看到的盤一樣,不然會掛載失敗) /home 是要掛載的目錄 一般網站資料都儲存在/home/wwwroot 裡面

最後再使用 mount 命令查看是否掛載成功

 代碼如下 複製代碼
[root@AY110519013348b ~]# mount
/dev/hda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/xvdb1 on /home type ext3 (rw)

以上命令掛載後重啟會自動消失。下面我介紹的是讓它開機自動掛載 。

ROOT登陸後 鍵入命令 vi /etc/fstab

在最下面加上一條

 代碼如下 複製代碼
/dev/xvdb1 /home ext3 defaults 1 1

儲存退出

這裡不會使用VI 進行編輯的朋友可以使用 winSCP 軟體來進行修改,和FTP一樣

注意空格,還有開機掛載資料盤一定要仔細檢查

最後順便介紹一下掛載移動資料硬碟方法

 代碼如下 複製代碼

#查看分區情況:

# fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/sda1             1      7904  63488848+   7  HPFS/NTFS
/dev/sda2          7905     11983  32764567+   c  Win95 FAT32 (LBA)  #這個就是我的移動硬碟分區
/dev/sda3   *     11984     16062  32764567+   c  Win95 FAT32 (LBA) #這個就是我的移動硬碟分區
/dev/sda4         16063     30401 115178017+   f  Win95 Ext'd (LBA)
/dev/sda5         16063     30401 115177986    7  HPFS/NTFS

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1        13    104391   83  Linux
/dev/hda2            14       268   2048287+  82  Linux swap
/dev/hda3           269     19457 154135642+  83  Linux

#掛載:

# mkdir /mnt/usb1

# mkdir /mnt/usb1

# mount /dev/sda2 /mnt/usb1

# mount /dev/sda3 /mnt/usb2

聯繫我們

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