찾다
php教程php手册阿里云格式化和挂载数据盘

当你在阿里云买了服务器,随着业务量越来越大。数据盘的容量也就会不够用。所以我们就会新增一块云盘。下面讲新增云盘之后,然后挂载上去。 这是新手的教程,也是我的笔记。
第一步: 使用远程连接工具,输入用户名 root 和密码登录到实例。

第二步:运行 fdisk -l 命令查看数据盘。注意:在没有分区和格式化数据盘之前,使用 df -h 命令是无法看到数据盘的。在下面的示例中,有一个 5 GB 的数据盘需要挂载。  [root@xxxx ~]# fdisk -l<br> <br>  Disk /dev/xvda: 42.9 GB, 42949672960 bytes<br>  255 heads, 63 sectors/track, 5221 cylinders<br>  Units = cylinders of 16065 * 512 = 8225280 bytes<br>  Sector size (logical/physical): 512 bytes / 512 bytes<br>  I/O size (minimum/optimal): 512 bytes / 512 bytes<br>  Disk identifier: 0x00078f9c<br> <br>  Device Boot      Start         End      Blocks   Id  System<br>  /dev/xvda1   *           1        5222    41940992   83  Linux<br> <br>  Disk /dev/xvdb: 5368 MB, 5368709120 bytes<br>  255 heads, 63 sectors/track, 652 cylinders<br>  Units = cylinders of 16065 * 512 = 8225280 bytes<br>  Sector size (logical/physical): 512 bytes / 512 bytes<br>  I/O size (minimum/optimal): 512 bytes / 512 bytes<br>  Disk identifier: 0x00000000第三步:执行下列命令,对数据盘进行分区。 fdisk /dev/xvdb第四步:根据提示,依次输入 n,p,1,两次回车,wq,分区就开始了。 [root@xxx ~]# fdisk /dev/xvdb<br>  Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab            el<br>  Building a new DOS disklabel with disk identifier 0x33eb5059.<br>  Changes will remain in memory only, until you decide to write them.<br>  After that, of course, the previous content won't be recoverable.<br> <br>  Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)<br> <br>  WARNING: DOS-compatible mode is deprecated. It's strongly recommended to<br>       switch off the mode (command 'c') and change display units to<br>       sectors (command 'u').<br> <br>  Command (m for help): n<br>  Command action<br>     e   extended<br>     p   primary partition (1-4)<br>  p<br>  Partition number (1-4): 1<br>  First cylinder (1-652, default 1): <br>  Using default value 1<br>  Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652):<br>  Using default value 652<br> <br>  Command (m for help): wq<br>  The partition table has been altered!<br> <br>  Calling ioctl() to re-read partition table.<br>  Syncing disks.第五步:执行 fdisk -l 命令,查看新的分区。新分区 xvdb1 已经创建好。如下面示例中的/dev/xvdb1。 [root@xxx ~]# fdisk -l<br> <br>  Disk /dev/xvda: 42.9 GB, 42949672960 bytes<br>  255 heads, 63 sectors/track, 5221 cylinders<br>  Units = cylinders of 16065 * 512 = 8225280 bytes<br>  Sector size (logical/physical): 512 bytes / 512 bytes<br>  I/O size (minimum/optimal): 512 bytes / 512 bytes<br>  Disk identifier: 0x00078f9c<br> <br>  Device Boot      Start         End      Blocks   Id  System<br>  /dev/xvda1   *           1        5222    41940992   83  Linux<br> <br>  Disk /dev/xvdb: 5368 MB, 5368709120 bytes<br>  255 heads, 63 sectors/track, 652 cylinders<br>  Units = cylinders of 16065 * 512 = 8225280 bytes<br>  Sector size (logical/physical): 512 bytes / 512 bytes<br>  I/O size (minimum/optimal): 512 bytes / 512 bytes<br>  Disk identifier: 0x33eb5059<br> <br>  Device Boot      Start         End      Blocks   Id  System<br>  /dev/xvdb1               1         652     5237158+  83  Linux第六步:执行下列命令,对新分区进行格式化。格式化所需时间取决于数据盘大小。您也可自主决定选用其他文件格式,如 ext14 等。mkfs.ext3 /dev/xvdb1第七步:执行下列命令写入新分区信息。 echo '/dev/xvdb1 /mnt ext3 defaults 0 0'>> /etc/fstab完成后,可以使用 cat /etc/fstab 命令查看。
注意: Ubuntu 12.04 不支持 barrier,所以对该系统正确的命令是:echo '/dev/xvdb1 /mnt ext3 barrier=0 0 0'>>/etc/fstab如果需要把数据盘单独挂载到某个文件夹,比如单独用来存放网页,可以修改以上命令中的 /mnt 部分。

第八步:执行 mount /dev/xvdb1 /mnt 挂载新分区,然后执行 df -h 查看分区。如果出现数据盘信息,说明挂载成功,可以使用新分区了。 [root@xxx ~]# mount /dev/xvdb1 /mnt<br>  [root@xxx ~]# df -h<br>  Filesystem      Size  Used Avail Use% Mounted on<br>  /dev/xvda1       40G  1.5G   36G   4% /<br>  tmpfs           498M     0  498M   0% /dev/shm<br>  /dev/xvdb1      5.0G  139M  4.6G   3% /mnt总结: 全部按照命令来的话,基本上是没有什么问题的。 可能比较疑惑的是挂载的路径问题。当前我以为挂载到某一个路径,然后就会把那个文件夹的容量增大。谁知道不是。而这只是一个链接指向而已。
也就是说。你的挂载路径,只是将路径重新指向到新的云盘。而且这个路径之前的数据就会看不见了。除非你umount ,才会看到原来的数据。
如果你们还有哪里不明白的地方,欢迎提问 或者加我QQ 164418960

AD:真正免费,域名+虚机+企业邮箱=0元

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

ZendStudio 13.5.1 맥

ZendStudio 13.5.1 맥

강력한 PHP 통합 개발 환경

mPDF

mPDF

mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

SecList

SecList

SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

MinGW - Windows용 미니멀리스트 GNU

MinGW - Windows용 미니멀리스트 GNU

이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.