60GB 디스크에 40GB를 추가해서 100GB로 만들려고 합니다. 디스크는 백엔드에서 추가되고 fdisk에 100GB로 표시됩니다. 그러나 새 파티션을 만들려고 하면 "사용 가능한 여유 섹터가 없습니다."라는 오류가 표시됩니다.
다음과 같이 fdisk /dev/sda를 사용하여 파티션을 만들려고 하면:
]# fdisk /dev/sda
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0006d1e9
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 6528 51915776 8e Linux LVM
/dev/sda3 6528 7832 10481740 8e Linux LVM
/dev/sda4 7833 9137 10482412+ 5 Extended
/dev/sda5 7833 9137 10482381 8e Linux LVM
Partition 5 does not start on physical sector boundary.
Command (m for help): n
No free sectors available
Command (m for help): q
fdisk -l의 출력은 다음과 같습니다.
~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0006d1e9
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 6528 51915776 8e Linux LVM
/dev/sda3 6528 7832 10481740 8e Linux LVM
/dev/sda4 7833 9137 10482412+ 5 Extended
/dev/sda5 7833 9137 10482381 8e Linux LVM
Partition 5 does not start on physical sector boundary.
Disk /dev/mapper/vg_nkpdpbn01-lv_root: 69.2 GB, 69247959040 bytes
255 heads, 63 sectors/track, 8418 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_nkpdpbn01-lv_swap: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
또한:
~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
ââsda1 8:1 0 500M 0 part /boot
ââsda2 8:2 0 49.5G 0 part
â ââvg_nkpdpbn01-lv_root (dm-0) 253:0 0 64.5G 0 lvm /
â ââvg_nkpdpbn01-lv_swap (dm-1) 253:1 0 5G 0 lvm [SWAP]
ââsda3 8:3 0 10G 0 part
â ââvg_nkpdpbn01-lv_root (dm-0) 253:0 0 64.5G 0 lvm /
ââsda4 8:4 0 1K 0 part
ââsda5 8:5 0 10G 0 part
ââvg_nkpdpbn01-lv_root (dm-0) 253:0 0 64.5G 0 lvm /
sr0 11:0 1 1024M 0 rom
~]# pvs
File descriptor 63 (pipe:[355848]) leaked on pvs invocation. Parent PID 20225: -bash
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_nkpdpbn01 lvm2 a-- 49.51g 0
/dev/sda3 vg_nkpdpbn01 lvm2 a-- 9.99g 0
/dev/sda5 vg_nkpdpbn01 lvm2 a-- 9.99g 0
~]# lvs
File descriptor 63 (pipe:[356102]) leaked on lvs invocation. Parent PID 20225: -bash
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg_nkpdpbn01 -wi-ao---- 64.49g
lv_swap vg_nkpdpbn01 -wi-ao---- 5.00g
~]# vgs
File descriptor 63 (pipe:[356125]) leaked on vgs invocation. Parent PID 20225: -bash
VG #PV #LV #SN Attr VSize VFree
vg_nkpdpbn01 3 2 0 wz--n- 69.49g 0
~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_nkpdpbn01-lv_root
64G 44G 17G 73% /
tmpfs 3.9G 4.0K 3.9G 1% /dev/shm
/dev/sda1 477M 115M 337M 26% /boot
답변1
3개의 기본 파티션(sda1, sda2, sda3), 1개의 확장 파티션(sda4) 및 논리 파티션으로 sd5가 있는 것 같습니다. parted를 사용하여 파티션 4의 크기를 조정해 보세요.
예:
/dev/sdb를 분리하세요.
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1049GB 1049GB primary ntfs
2 1049GB 1796GB 747GB extended
5 1049GB 1796GB 747GB logical
(parted) resizepart
Partition number? 2
End? [1796GB]? 2000GB
(parted) p
Model: WD My Passport 0748 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1049GB 1049GB primary ntfs
2 1049GB 2000GB 951GB extended
5 1049GB 1796GB 747GB logical
이제 fdisk나 parted 중 원하는 것을 사용하여 새 논리 파티션을 추가해 보세요.
fdisk를 사용하면 sda4와 sd5를 제거한 다음 다시 추가하고 동일한 시작 부분을 유지해야 합니다. sda4와 sd5가 겹치면 문제가 발생할 수 있습니다.
참고: 데이터 백업을 유지하고 먼저 이해하고 테스트하십시오. 다음은 사용자의 책임하에 수행될 수 있지만 테스트되지 않았습니다.
1. Delete partition 4 ( Command (m for help): d and enter number 4 )
2. Add it again and keep the first sector as old one ( Command (m for help): n, choose extended partition e
, Partition number 4 , First Sector - 7833 , Last Sector - Default
3. Add logical partition 5 -
( Command (m for help): n, Adding logical partition 5 , choose default for first and last sector
4 Modify beginning of logical partition 5 to old value , Expert command (m for help): b
Partition number (1,2,5, default 5):5
New beginning of data - 7833
5 print table and verify
답변2
해결책을 찾았습니다. 1. 확장된 볼륨 크기를 늘리려면 parted를 사용하십시오. - 명령줄에 "parted" 명령을 입력합니다. 볼륨을 분리하거나 복구 모드로 들어갈 필요가 없습니다.
parted
테이블을 인쇄하고 현재 할당을 봅니다.
(parted) print
확장 파티션의 크기를 현재 크기에서 사용 가능한 새 크기로 조정합니다. 내 경우에는 100GB였다.
(분할) 크기 조정 4 64.4GB 100GB
새 과제 인쇄 및 보기
(별도) 인쇄
이제 fdisk 파티션을 만들고 새 파티션 sda6을 만듭니다.
fdisk /dev/sda