>  기사  >  운영 및 유지보수  >  Alibaba Cloud 호스트의 Linux 시스템 파티션 포맷 및 데이터 디스크 마운트

Alibaba Cloud 호스트의 Linux 시스템 파티션 포맷 및 데이터 디스크 마운트

缘亦
缘亦원래의
2021-09-09 22:53:111767검색

Alibaba Cloud의 무료 시스템 디스크를 제외하고 두 번째로 구매한 클라우드 디스크는 기본적으로 자동으로 마운트되지 않으며 마운트되도록 수동으로 구성해야 합니다.

[관리 터미널] 또는 원격 연결 도구를 사용하여 사용자 이름 루트와 비밀번호를 입력하여 Linux 시스템에 로그인하세요.

1. fdisk -l 명령을 실행하여 데이터 디스크를 봅니다. 데이터 디스크를 파티션하고 포맷하기 전에는 "df -h" 명령을 사용하여 데이터 디스크를 볼 수 없습니다. "fdisk -l" 명령을 사용하면 데이터 디스크를 볼 수 있습니다.

명령어 실행 후 /dev/vdb가 존재하지 않는다면 데이터 디스크가 없다는 뜻입니다. 데이터 디스크가 마운트되어 있는지 확인하세요.

2. 다음 명령을 순서대로 실행하여 단일 파티션 데이터 디스크를 만듭니다.

(1) fdisk -u /dev/vdb: 파티션 데이터 디스크를 실행합니다.

(2) p 입력: 데이터 디스크의 파티션 상태를 확인합니다. 이 예에서 데이터 디스크에는 파티션이 없습니다.

(3) n 입력: 새 파티션을 만듭니다.

(4) p 입력: 파티션 유형을 기본 파티션으로 선택합니다.

설명 이 예에서는 단일 파티션 데이터 디스크가 생성되므로 기본 파티션만 생성하면 됩니다. 4개 이상의 파티션을 생성하려면 확장 파티션을 하나 이상 생성해야 합니다. 즉, e(확장)를 선택합니다.

(5) 파티션 번호를 입력하고 Enter 키를 누릅니다. 이 예에서는 하나의 파티션만 생성됩니다. 1을 입력합니다.

(6) 사용 가능한 첫 번째 섹터 번호를 입력합니다. Enter를 눌러 기본값인 2048을 채택합니다.

(7) 마지막 섹터 번호 입력: 이 예에서는 하나의 파티션만 생성하며 Enter를 눌러 기본값을 채택합니다.

(8) p 입력: 데이터 디스크의 계획된 파티셔닝을 봅니다.

(9) w 입력: 파티셔닝을 시작하고 파티셔닝 후 종료합니다.

[root@ecshost~ ]# fdisk -u /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x3e60020e.
 
Command (m for help): p
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3e60020e
Device Boot Start End Blocks Id System
 
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
 
Command (m for help): p
 
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3e60020e
Device Boot Start End Blocks Id System
/dev/vdb1 2048 41943039 20970496 83 Linux
 
Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
Syncing disks.

3. fdisk -lu /dev/vdb 명령을 실행하여 새 파티션을 확인하세요.

다음 정보가 나타나면 새 파티션 /dev/vdb1이 성공적으로 생성되었음을 의미합니다.

[root@ecshost~ ]# fdisk -lu /dev/vdb
 
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3e60020e
 
Device Boot Start End Blocks Id System
/dev/vdb1 2048 41943039 20970496 83 Linux

4. mkfs.ext4 /dev/vdb1 명령을 실행하여 새 파티션에 파일 시스템을 만듭니다.

이 예에서는 ext4 파일 시스템을 만듭니다. 필요에 따라 다른 파일 시스템을 생성하도록 선택할 수도 있습니다. 예를 들어 Linux, Windows 및 Mac 시스템 간에 파일을 공유해야 하는 경우 mkfs.vfat를 사용하여 VFAT 파일 시스템을 생성할 수 있습니다.

참고: 파일 시스템을 생성하는 데 필요한 시간은 데이터 디스크 크기에 따라 다릅니다.

[root@ecshost~ ]# mkfs.ext4 /dev/vdb1
 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242624 blocks
262131 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2153775104
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
 
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

5. (권장) cp /etc/fstab /etc/fstab.bak 명령을 실행하여 etc/fstab 파일을 백업합니다.

6. echo /dev/vdb1 /data0 ext4 defaults 0 0 >> /etc/fstab 명령을 실행하여 /etc/fstab에 새 파티션 정보를 씁니다.

참고: Ubuntu 12.04 시스템은 echo '/dev/vdb1 /data0 ext4 Barrier=0 0 0' >> /etc/fstab 명령을 실행해야 합니다.

예를 들어 웹 페이지만 저장하기 위해 데이터 디스크를 폴더에 별도로 마운트하려면 명령의 /data0을 필요한 마운트 지점 경로로 바꾸세요.

7. cat /etc/fstab 명령을 실행하여 /etc/fstab에서 새 파티션 정보를 확인합니다.

[root@ecshost~ ]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Dec 12 07:53:08 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d67c3b17-255b-4687-be04-f29190d37396 / ext4 defaults 1 1
/dev/vdb1 /mnt ext4 defaults 0 0

8. mount /dev/vdb1 /data0 명령을 실행하여 파일 시스템을 마운트합니다.

9. df -h 명령을 실행하여 현재 디스크 공간과 사용량을 확인하세요.

새 파일 시스템에 대한 정보가 나타나면서 마운트가 성공했음을 나타냅니다.

<div><br class="Apple-interchange-newline">[root@ecshost~ ]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.6G 36G 5% /
devtmpfs 234M 0 234M 0% /dev
tmpfs 244M 0 244M 0% /dev/shm
tmpfs 244M 484K 244M 1% /run
tmpfs 244M 0 244M 0% /sys/fs/cgroup
tmpfs 49M 0 49M 0% /run/user/0
/dev/vdb1 20G 45M 19G 1% /mnt</div>
12345678910    [root@ecshost~ ]# df -h Filesystem Size Used Avail Use% Mounted on/dev/vda1 40G 1.6G 36G 5% /devtmpfs 234M 0 234M 0% /devtmpfs 244M 0 244M 0% /dev/shmtmpfs 244M 484K 244M 1% /runtmpfs 244M 0 244M 0% /sys/fs/cgrouptmpfs 49M 0 49M 0% /run/user/0/dev/vdb1 20G 45M 19G 1% /mnt

10. 마지막으로 재부팅하고 서버를 다시 시작하세요.

추천: "linux 비디오 튜토리얼"

위 내용은 Alibaba Cloud 호스트의 Linux 시스템 파티션 포맷 및 데이터 디스크 마운트의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

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