우분투의 디스크 파티션을 변경하는 방법은 무엇입니까?

우분투의 디스크 파티션을 변경하는 방법은 무엇입니까?

우분투를 설치한 후 다른 디스크 공간을 사용하도록 이동할 수 있나요?

답변1

GParted를 사용해 볼 수 있습니다. Live USB 및 GParted에 대한 매우 유용한 가이드가 있습니다.여기.

또한 파티션 이동의 경우 GParted를 사용하는 것도 가능할 수 있습니다. 현재 Ubuntu 파티션보다 더 큰 새 파티션을 만든 다음 GParted를 사용하여 모든 데이터를 복사하십시오. 이것은 다소 조잡하고 완전히 작동하지 않을 수도 있지만 운이 좋으면 트릭을 수행할 수 있습니다.

답변2

예, resize2fs를 사용하여 그렇게 할 수 있습니다.

먼저 여유 공간에 대해 알아야 합니다.

root@server:/# df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/sdb1                        3,7T  1,5T  2,1T  42% /users/home

이제 크기 조정을 진행합니다.

root@server:~# resize2fs /dev/sdb1 2500G
resize2fs 1.42 (29-Nov-2011)
Por favor ejecute antes 'e2fsck -f /dev/sdb1'.

따라서 진행하기 전에 디스크를 확인해야 합니다. 따라서 그 논리는 다음과 같습니다.

root@server:~# e2fsck -f /dev/sdb1
e2fsck 1.42 (29-Nov-2011)
Paso 1: Verificando nodos-i, bloques y tamaños
Paso 2: Verificando la estructura de directorios
Paso 3: Revisando la conectividad de directorios
No se encontró /lost+found.  Crear? no
Paso 4: Revisando las cuentas de referencia
Paso 5: Revisando el resumen de información de grupos
/dev/sdb1: ***** EL SISTEMA DE FICHEROS FUE MODIFICADO *****

/dev/sdb1: 3281220/244064256 files (0.4% non-contiguous), 383150021/976236032 blocks

이제 괜찮아!

resize2fs 1.42 (29-Nov-2011)
Resizing the filesystem on /dev/sdb1 to 655360000 (4k) blocks.
The filesystem on /dev/sdb1 is now 655360000 blocks long.

이제 파티션을 삭제하고 새로운 크기로 파티션을 복구해야 합니다.

Fdisk를 사용할 수 있지만 HD가 "큰" 경우에는 parted를 사용해야 할 수도 있습니다.

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


WARNING: The size of this disk is 4.0 TB (3998663944192 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID 
partition table format (GPT).

Using fdsik, we must put start from block 1 to last block that resize2fs, in our case was   655360000 and multiply by 4 (its k in every block). To get some safe margin, We can multiply this again by 1.05 and in this way you got a little more of space.

In parted, is very similar, like fdisk:

root@server:~# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes

Warning: /dev/sdb contains GPT signatures, indicating that it has a GPT table.  However, it does not have a valid fake msdos partition table, as it should.  Perhaps it was
corrupted -- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT
partition table?
Yes/No? Yes  

(parted)                                                                  
(parted) print                                                            
Model: DELL MD32xxi (scsi)
Disk /dev/sdb: 3999GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0GB 3000GB
(parted) print                                                            
Model: DELL MD32xxi (scsi)
Disk /dev/sdb: 3999GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  3000GB  3000GB  ext4         primary

(parted) quit                                                             
Information: You may need to update /etc/fstab.

준비가 된! 이제 새로운 파티션이 생겼습니다...

답변3

이를 위해 gparted 또는 fdisk를 사용할 수 있습니다. resize2fs, e2fsck를 사용하여 설치된 것을 덤프할 여유 공간을 찾습니다. 최상의 결과를 얻으려면 --help를 사용하십시오.

다음은 시도해 볼 수 있는 명령 세트의 예입니다.

df -h (사용 가능한 모든 드라이브를 나열하려면)

resize2fs /dev/sdx xG(xG가 GB 단위로 압축하려는 새 디스크 공간을 정의하는 실제 값으로 x를 바꾸십시오)

e2fsck -f /dev/sdb(패리티 및 동기화 메모리를 확인하기 위한 파일 시스템 검사) 이제 fdisk 도구를 사용하여 파티셔닝을 시작합니다.

fdisk -l/ 사용 가능한 모든 장치의 모든 파티션 세부 정보 나열

sudo fdisk /dev/sdx/* sdx 장치용 fdisk 도구 선택

p/* 현재 파티션 표시

d(파티션이 없을 때까지) /* 기존 파티션 삭제

n/* 새로운 파티션 생성

p/* 파티션을 기본으로 선택

1/* 파티션 번호 제공

(default)/* 오프셋 바이트

(select size)/* 필요한 파티션 크기 */

w/* 변경 사항 쓰기 */

sudo mkfs.(filesystem type) /dev/sdx1/* 새 파티션을 파일 시스템 유형으로 포맷합니다 */

자세한 도움말을 보려면 다음 링크를 참조하세요. http://noohonlinux.blogspot.qa/2014/10/1.html

관련 정보