a亚洲精品_精品国产91乱码一区二区三区_亚洲精品在线免费观看视频_欧美日韩亚洲国产综合_久久久久久久久久久成人_在线区

首頁 > 學院 > 基礎常識 > 正文

vps的硬盤擴容后的掛載探索

2019-10-31 23:58:15
字體:
來源:轉載
供稿:網友

   對新硬盤的分區(qū),相對來說比較方便,因為不用擔心原來的數(shù)據(jù)丟失等等問題,操作失敗了,大不了重來,但是現(xiàn)在是對已經存在數(shù)據(jù)的硬盤,進行分區(qū)及掛載,所以必須得仔細,小心!

  首先認識下幾個命令符:

  fdisk:對分區(qū)信息進行查看,以及對分區(qū)進行操作;

  mkfs:對新分區(qū)進行格式化;

  mount:這個就是對分區(qū)后的硬盤進行掛載,只有掛載到指定的目錄后,才可以被正常使用。

  接下來記錄步驟:首先通過命令 “fdisk -l”查看所有的分區(qū)信息,顯示如下:

  root@MyVPS****:/dev# fdisk -l

  Disk /dev/xvdb: 42.9 GB, 42949672960 bytes

  255 heads, 63 sectors/track, 5221 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: 0x000d68a3

  Device Boot Start End Blocks Id System

  /dev/xvdb1 1 2610 20964793+ 83 Linux

  Disk /dev/xvda: 10.7 GB, 10737418240 bytes

  255 heads, 63 sectors/track, 1305 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: 0x0000aba6

  Device Boot Start End Blocks Id System

  /dev/xvda1 * 1 64 512000 83 Linux

  Partition 1 does not end on cylinder boundary.

  /dev/xvda2 64 1306 9972736 8e Linux LVM

  Disk /dev/mapper/vg_501153278-lv_root: 9135 MB, 9135194112 bytes

  255 heads, 63 sectors/track, 1110 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: 0×00000000

  Disk /dev/mapper/vg_501153278-lv_swap: 1073 MB, 1073741824 bytes

  255 heads, 63 sectors/track, 130 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: 0×00000000

  有點復雜,分析下里面有兩個盤,分別是

  Disk /dev/xvdb: 42.9 GB和Disk /dev/xvda: 10.7 GB

  xvda是系統(tǒng)盤 不管他 看xvdb 顯示是42.9gb 但是實際顯示只有20gb

  /dev/xvdb1 1 2610 20964793+ 83 Linux

  這說明還有沒掛載的,下面來操作這個過程,參考網絡上的。

  root@MyVPS2282:/dev# fdisk /dev/sdb

  Command (m for help): n (n表示新創(chuàng)建新區(qū),如果不知道命令如何使用,先打入m先查看幫助)

  Command action

  e extended

  p primary partition (1-4)

  (以上是讓選擇創(chuàng)建主分區(qū)還是擴展,我這里剛開始選擇創(chuàng)建的是擴展分區(qū),因為原來的30個G我創(chuàng)建的主分區(qū),但是后面通過mkfs創(chuàng)建文件系統(tǒng)的時候會報錯,所以這里我后來是刪除了創(chuàng)建的擴展分區(qū),重新選擇創(chuàng)建主分區(qū)才成功)

  p (選擇創(chuàng)建主分區(qū))

  Partition number (1-4): 2 (通過命令fdisk -l例出來的分區(qū)信息可以看到,已經sdb已經分了第一個區(qū)sdb1,因而這里必須輸入大于1的數(shù)字,否則系統(tǒng)會提示你輸入的分區(qū)號已經存在,要求重新輸入)

  First cylinder (3917-7832, default 3917): (讓選擇是從磁盤的那個位置開始創(chuàng)建,這里可以不需要輸入,直接回車即可,默認為從上個分區(qū)的結束位置開始)

  Using default value 3917

  Last cylinder, +cylinders or +size{K,M,G} (3917-7832, default 7832):(選擇硬盤結束位置,如果不想再分其它區(qū)了,直接回車即可,默認為剩余的所有磁盤空間)

  Using default value 7832

  Command (m for help): w (保存分區(qū)信息并退出,下面是一些提示信息)

  The partition table has been altered!

  Calling ioctl() to re-read partition table.

  WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

  The kernel still uses the old table. The new table will be used at

  the next reboot or after you run partprobe(8) or kpartx(8)

  最后這一行的提示是說,需要重新啟動系統(tǒng),分區(qū)才可以生效,如果這個時候不重啟系統(tǒng),直接通過mkfs創(chuàng)建文件系統(tǒng),系統(tǒng)會報錯:

  mke2fs 1.41.12 (17-May-2010)

  mkfs.ext3: inode_size (128) * inodes_count (0) too big for a

  filesystem with 0 blocks, specify higher inode_ratio (-i)

  or lower inode count (-N).

  那就乖乖的重啟系統(tǒng)吧。

  重啟后,再通過:

  mkfs -t exts /dev/sdb2

  對新分區(qū)創(chuàng)建文件系統(tǒng),分有如下提示:

  ke2fs 1.41.12 (17-May-2010)

  Filesystem label=

  OS type: Linux

  Block size=4096 (log=2)

  Fragment size=4096 (log=2)

  Stride=0 blocks, Stripe width=0 blocks

  1966080 inodes, 7863817 blocks

  393190 blocks (5.00%) reserved for the super user

  First data block=0

  Maximum filesystem blocks=0

  240 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

  Writing inode tables: done

  Creating journal (32768 blocks): done

  Writing superblocks and filesystem accounting information: done

  This filesystem will be automatically checked every 33 mounts or

  180 days, whichever comes first. Use tune2fs -c or -i to override.

  到此,分區(qū)就創(chuàng)建成功了,這個需要只需要將其掛載到指定的目錄即可:

  mount /dev/sdb2 /aaa

  當然為了能夠在下次啟動的時候,讓其自動掛載,我們需要在分區(qū)表中加入如下信息:

  /dev/sdb2 /aaa ext3 defaults 1 2

  分區(qū)表的文件位于:/etc/fstab

  通過df命令就可以看到我們掛載后的分區(qū)了,至此分區(qū)成功完成。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 综合av第一页 | 色吧久久| 国产精品久久久久久一区二区三区 | a视频在线观看 | 久久综合社区 | 国产精品无码专区在线观看 | 超碰av在线 | 久久一区二区三区四区 | 国产精品人成在线播放 | 九色91视频| 中文字幕 国产 | 中文字幕亚洲欧美精品一区四区 | 久久久久久久久蜜桃 | 欧美在线观看禁18 | youjizz国产 | 日韩一级视频 | 久久一本| 欧美日韩在线免费观看 | 我爱操 | 玖玖在线 | 久久久国产精品免费 | 一级毛片在线看aaaa | 亚洲福利网站 | 欧美一性一乱一交 | 日韩a电影 | 国产又粗又长又硬又猛电影 | 欧美综合在线观看 | 欧美日韩在线播放 | 综合一区在线观看 | 日本在线看 | 国产日韩中文字幕 | 国产精品一区二区三区免费看 | 成人在线观看亚洲 | www.一区二区三区 | 成人精品视频在线观看 | 日韩久久网| 日本中文字幕在线观看 | 人人草人人 | 久久韩日| 亚洲成人动漫在线观看 | 亚洲精品视频在线观看免费 |