国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

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

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

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

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

  首先認識下幾個命令符:

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

  mkfs:對新分區進行格式化;

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

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

  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是系統盤 不管他 看xvdb 顯示是42.9gb 但是實際顯示只有20gb

  /dev/xvdb1 1 2610 20964793+ 83 Linux

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

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

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

  Command action

  e extended

  p primary partition (1-4)

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

  p (選擇創建主分區)

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

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

  Using default value 3917

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

  Using default value 7832

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

  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)

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

  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).

  那就乖乖的重啟系統吧。

  重啟后,再通過:

  mkfs -t exts /dev/sdb2

  對新分區創建文件系統,分有如下提示:

  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.

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

  mount /dev/sdb2 /aaa

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

  /dev/sdb2 /aaa ext3 defaults 1 2

  分區表的文件位于:/etc/fstab

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沂南县| 连州市| 贺兰县| 从化市| 北碚区| 九龙坡区| 孟连| 澄迈县| 承德县| 西青区| 兴隆县| 郸城县| 历史| 天门市| 丰镇市| 山西省| 沁水县| 定远县| 象州县| 景洪市| 陆良县| 谢通门县| 天祝| 随州市| 馆陶县| 乌兰县| 柘城县| 台南市| 理塘县| 周宁县| 花莲市| 永嘉县| 津南区| 濉溪县| 会东县| 靖边县| 错那县| 怀集县| 莱西市| 阿拉善右旗| 呈贡县|