精品免费在线观看-精品欧美-精品欧美成人bd高清在线观看-精品欧美高清不卡在线-精品欧美日韩一区二区

17站長網(wǎng)

17站長網(wǎng) 首頁 網(wǎng)站 服務(wù)器 查看內(nèi)容

Linux下如何掛載磁盤的方法示例

2022-10-14 12:52| 查看: 1318 |來源: 互聯(lián)網(wǎng)

使用虛擬機(jī)時(shí)發(fā)現(xiàn)磁盤空間不夠了,需要掛載一個(gè)磁盤以供繼續(xù)使用,但是磁盤不是添加就可以使用的,還需要進(jìn)行掛載。 一、添加磁盤 添加加新硬盤重啟服務(wù)器 添 ...

使用虛擬機(jī)時(shí)發(fā)現(xiàn)磁盤空間不夠了,需要掛載一個(gè)磁盤以供繼續(xù)使用,但是磁盤不是添加就可以使用的,還需要進(jìn)行掛載。

一、添加磁盤

添加加新硬盤重啟服務(wù)器

添加完之后就可以重啟機(jī)器了,如果你機(jī)器是開啟的,進(jìn)入系統(tǒng)并不能看見你剛添加的那塊磁盤,只有等系統(tǒng)重啟,重新加載之后才會(huì)顯示安裝的那塊磁盤

二、進(jìn)入系統(tǒng)

使用root用戶進(jìn)入系統(tǒng)

三、 查看硬盤信息

[root@localhost ~]# fdisk -l  //磁盤命令

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c4cb5

  Device Boot   Start     End   Blocks  Id System
/dev/sda1  *      1     64   512000  83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2       64    2611  20458496  8e Linux LVM

Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd0f5c869

  Device Boot   Start     End   Blocks  Id System
/dev/sdb1        1    2610  20964793+ 83 Linux

Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

可以看到這臺機(jī)器加載了三個(gè)磁盤sda、sdb、sdc

其中sda是初始磁盤,sdb已經(jīng)初始化且經(jīng)過使用,sdc是剛剛加載的,未格式化的新磁盤

四、創(chuàng)建新硬盤分區(qū)

[root@localhost ~]# fdisk /dev/sdc #進(jìn)入磁盤
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x45a3cadb.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
     switch off the mode (command 'c') and change display units to
     sectors (command 'u').

Command (m for help): m
Command action
  a  toggle a bootable flag   #設(shè)定可啟動(dòng)標(biāo)記
  b  edit bsd disklabel
  c  toggle the dos compatibility flag
  d  delete a partition     #刪除一個(gè)分區(qū)
  l  list known partition types #各分區(qū)類型所對應(yīng)的ID
  m  print this menu       #菜單
  n  add a new partition     #添加一個(gè)分區(qū)
  o  create a new empty DOS partition table
  p  print the partition table  #顯示該磁盤下的當(dāng)前分區(qū)信息
  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)

知道命令之后就可以進(jìn)行分區(qū)了

Command (m for help): p //打印分區(qū)信息,可以看到當(dāng)前并沒有分區(qū)

Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45a3cadb

  Device Boot   Start     End   Blocks  Id System

Command (m for help): n //創(chuàng)建一個(gè)新的分區(qū)
Command action
  e  extended//輸入e為創(chuàng)建擴(kuò)展分區(qū) 
  p  primary partition (1-4) //輸入p為創(chuàng)建邏輯分區(qū) 
p
Partition number (1-4): 1//劃分邏輯分區(qū)
First cylinder (1-2610, default 1): //我這里直接回車,是不想把該磁盤分成多個(gè)分區(qū),把整個(gè)磁盤作為1個(gè)分區(qū)
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 
Using default value 2610

Command (m for help): p //再次查看可以看到該磁盤已經(jīng)有1個(gè)分區(qū)了

Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45a3cadb

  Device Boot   Start     End   Blocks  Id System
/dev/sdc1        1    2610  20964793+ 83 Linux
Command (m for help): w //保存分區(qū)
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

再次使用”fdisk -l”命令查看磁盤信息

Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x406a4c58

  Device Boot   Start     End   Blocks  Id System
/dev/sdc1        1    2610  20964793+ 83 Linux

第三塊磁盤/dev/sdc已經(jīng)分區(qū)好了

五、格式化分區(qū)

[root@localhost ~]# mkfs.ext3 /dev/sdc1
//將/dev/sdc1格式化為ext3類型,好像大部分的磁盤都是格式化為ext3類型,具體為什么沒有深入研究,暫時(shí)不清楚,想了解的朋友可以自己查一下

[root@localhost ~]# mkfs.ext3 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
文件系統(tǒng)標(biāo)簽=
操作系統(tǒng):Linux
塊大小=4096 (log=2)
分塊大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
第一個(gè)數(shù)據(jù)塊=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
  32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
  4096000

正在寫入inode表: 完成              
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

格式化完畢,此時(shí)就可以使用“mount”命令掛載分區(qū)了,然后使用這個(gè)磁盤空間了

六、掛載分區(qū)以及開機(jī)自動(dòng)掛載

[root@localhost ~]# df -h //此時(shí)只有sda1和sdb1兩個(gè)磁盤掛載
Filesystem          Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root  18G  15G 1.5G 92% /
tmpfs             932M  76K 932M  1% /dev/shm
/dev/sda1           485M  40M 421M  9% /boot
/dev/sdb1           20G 1.2G  18G  7% /disk/diskone
/dev/sr0           4.2G 4.2G   0 100% /media/CentOS_6.5_Final
[root@localhost /]# cd /disk/
[root@localhost disk]# ll
總用量 4
drwxr-xr-x. 4 root root 4096 7月 28 17:04 diskone
[root@localhost disk]# cd diskone/
[root@localhost diskone]# ll
總用量 20
drwx------. 2 root root 16384 7月 28 16:12 lost+found
drwxr-xr-x. 2 root root 4096 7月 28 17:09 software
[root@localhost diskone]# cd ../
[root@localhost disk]# mkdir disktwo //創(chuàng)建被掛載的路徑
[root@localhost disk]# ll
總用量 8
drwxr-xr-x. 4 root root 4096 7月 28 17:04 diskone
drwxr-xr-x. 2 root root 4096 8月  1 16:48 disktwo
[root@localhost disk]# mount /dev/sdc1 /disk/disktwo/ //進(jìn)行掛載
[root@localhost disk]# df -h //再次查看,發(fā)現(xiàn)sdc1已經(jīng)掛載在/disk/disktwo路徑下
Filesystem          Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root  18G  15G 1.5G 92% /
tmpfs             932M  76K 932M  1% /dev/shm
/dev/sda1           485M  40M 421M  9% /boot
/dev/sdb1           20G 1.2G  18G  7% /disk/diskone
/dev/sr0           4.2G 4.2G   0 100% /media/CentOS_6.5_Final
/dev/sdc1           20G 173M  19G  1% /disk/disktwo

磁盤已經(jīng)掛載上了

下面設(shè)置開機(jī)自動(dòng)掛載

編輯/etc/fstab文件,再最后面添加
/dev/sdc1(磁盤分區(qū)) /disk/disktwo(掛載目錄) ext3(文件格式)defaults 0 0

vim /etc/fstab
/dev/sdc1(磁盤分區(qū)) /disk/disktwo(掛載目錄) ext3(文件格式)defaults 0 0

之后重啟就OK啦!!!

以上所述是小編給大家介紹的Linux下如何掛載磁盤的方法示例,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對17站長網(wǎng)的支持!

本文最后更新于 2022-10-14 12:52,某些文章具有時(shí)效性,若有錯(cuò)誤或已失效,請?jiān)诰W(wǎng)站留言或聯(lián)系站長:17tui@17tui.com
·END·
站長網(wǎng)微信號:w17tui,關(guān)注站長、創(chuàng)業(yè)、關(guān)注互聯(lián)網(wǎng)人 - 互聯(lián)網(wǎng)創(chuàng)業(yè)者營銷服務(wù)中心

免責(zé)聲明:本站部分文章和圖片均來自用戶投稿和網(wǎng)絡(luò)收集,旨在傳播知識,文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請勿用于商業(yè)用途,如果損害了您的權(quán)利,請聯(lián)系我們及時(shí)修正或刪除。謝謝!

17站長網(wǎng)微信二維碼

始終以前瞻性的眼光聚焦站長、創(chuàng)業(yè)、互聯(lián)網(wǎng)等領(lǐng)域,為您提供最新最全的互聯(lián)網(wǎng)資訊,幫助站長轉(zhuǎn)型升級,為互聯(lián)網(wǎng)創(chuàng)業(yè)者提供更加優(yōu)質(zhì)的創(chuàng)業(yè)信息和品牌營銷服務(wù),與站長一起進(jìn)步!讓互聯(lián)網(wǎng)創(chuàng)業(yè)者不再孤獨(dú)!

掃一掃,關(guān)注站長網(wǎng)微信

大家都在看

熱門排行

    最近更新

      返回頂部
      主站蜘蛛池模板: 亚洲sss视频| 欧美一级特黄aa大片视频 | 欧美一级夜夜爽 | 久久久久婷婷国产综合青草 | 亚洲国产成人综合 | 欧美综合亚洲图片综合区 | 超级成人97碰碰碰免费 | 视频办公室添的我好爽 | 国产片翁熄系列乱在线视频 | 欧美日韩中文一区二区三区 | 欧美日本一本 | 黄色小视频免费 | 亚洲精品成人7777在线观看 | 国产chinese中国hdxxxx | 欧美特黄一级高清免费的香蕉 | 香蕉视频最新地址 | 中文国产成人精品久久水 | 在线 中文字幕 日韩 欧美 | 久久久国产99久久国产久 | 亚拍精品一区二区三区 | 国产亚洲精品久久久久久久久激情 | 男生福利网站 | 亚洲欧美一区二区三区在饯 | 性色成人网 | 亚洲精品在线第一页 | 成人看片毛片免费播放器 | 国产成人免费无庶挡视频 | 欧美成人h版影片在线观看 欧美成人h版影院在线播放 | 欧美日韩高清观看一区二区 | 又粗又大又爽 真人一级毛片 | 国产在线观看精品香蕉v区 国产在线每日更新 | 国产午夜视频在线观看第四页 | 狠狠操在线视频 | 欧美任你躁免费精品一区 | 视频一区国产 | 亚洲一区二区三区夜色 | 色花五月色婷婷 | 色婷婷亚洲精品综合影院 | 久久影院中文字幕 | 成人高清在线观看 | 日本片免费观看一区二区 |