루트 파티션에 더 많은 공간을 제공하기 위해 암호화된 루트 및 기본 파티션의 크기를 조정하는 방법은 무엇입니까?

루트 파티션에 더 많은 공간을 제공하기 위해 암호화된 루트 및 기본 파티션의 크기를 조정하는 방법은 무엇입니까?

/(루트) 파티션을 확장해야 하는데 /home 파티션에 공간이 너무 많습니다. 어떻게 해야 합니까? 드라이브는 LUKS를 사용하여 암호화됩니다.

내 시스템은 Fedora 20입니다.

다른 주제가 있어요여기system-config-lvm에 대한 언급이 있지만 저장소에 설치되지 않았거나 위치가 없기 때문에 오래된 도구인 것 같습니다. Gparted는 LUKS 암호화를 지원하지 않기 때문에 작동하지 않습니다.

이것은:

~]$ sudo fdisk -l 

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 7AE6E531-9898-4C7C-8C35-41B4FDB9374A

Device           Start          End   Size Type
/dev/sda1         2048       411647   200M EFI System
/dev/sda2       411648      1435647   500M Microsoft basic data
/dev/sda3      1435648    976773119 465.1G Microsoft basic data


Disk /dev/mapper/luks-e69b0b4c-a8e0-425f-988d-8c635729503b: 465.1 GiB, 499370688512 bytes, 975333376 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/fedora_hostname-swap: 3.8 GiB, 4043309056 bytes, 7897088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/fedora_hostname-root: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/luks-b7af1bce-82c4-4921-aac1-bce701e30256: 50 GiB, 53684994048 bytes, 104853504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/fedora_hostname-home: 411.3 GiB, 441639239680 bytes, 862576640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

이것은:

~]$ df -h
Filesystem                       Size  Used Avail Use% Mounted on
/dev/dm-3                         50G   45G  2.0G  96% /
devtmpfs                         1.9G     0  1.9G   0% /dev
tmpfs                            1.9G   80K  1.9G   1% /dev/shm
tmpfs                            1.9G  9.0M  1.9G   1% /run
tmpfs                            1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs                            1.9G   20K  1.9G   1% /tmp
/dev/sda2                        477M  131M  317M  30% /boot
/dev/sda1                        200M  9.6M  191M   5% /boot/efi
/dev/mapper/fedora_hostname-home  405G  202G  183G  53% /home

이것은:

]$ sudo lvdisplay        
  --- Logical volume ---
  LV Path                /dev/fedora_hostname/swap
  LV Name                swap
  VG Name                fedora_hostname
  LV UUID                qQQRVR-toXX-J0M7-lTH5-d8Lr-AUq3-EHJ6A4
  LV Write Access        read/write
  LV Creation host, time hostname.lan, 2014-03-24 15:51:10 +0000
  LV Status              available
  # open                 2
  LV Size                3.77 GiB
  Current LE             964
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/fedora_hostname/home
  LV Name                home
  VG Name                fedora_hostname
  LV UUID                In2lRz-16ul-VhH5-SQOE-yqlt-tMB3-5JM7ea
  LV Write Access        read/write
  LV Creation host, time hostname.lan, 2014-03-24 15:51:10 +0000
  LV Status              available
  # open                 1
  LV Size                411.31 GiB
  Current LE             105295
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

  --- Logical volume ---
  LV Path                /dev/fedora_hostname/root
  LV Name                root
  VG Name                fedora_hostname
  LV UUID                bBWzcC-nhhd-s8km-MMGi-uGQ0-8yBv-HClQgp
  LV Write Access        read/write
  LV Creation host, time hostname.lan, 2014-03-24 15:51:16 +0000
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

답변1

대답은 거짓말이것철사....

발췌:

따라서 단계는 다음과 같습니다.

  1. /home "파일 시스템"을 축소합니다. (예를 들어 ext4라면 resize2fs를 이용해 크기를 조정해야 합니다.)

  2. lvreduce를 사용하여 /home LVM 파티션(/dev/mapper/fedora_hostname-home)의 크기를 줄여 /home 축소 파일 시스템을 완전히 포함하도록 합니다.

  3. 축소된 파일 시스템이 /home LVM 파티션보다 작은 경우 파일 시스템의 크기를 다시 조정하여 LVM 논리 볼륨을 완전히 채울 수 있습니다. 저는 주로 이 방법을 사용하기 때문에 정확한 치수를 계산할 필요가 없습니다! :피

(위의 각 단계를 완료한 후 /home을 마운트하여 올바르게 마운트되었는지, 데이터가 있는지 확인할 수 있습니다. 그렇지 않은 경우(예: 잘못된 매개변수로 인해) 문제의 단계로 되돌릴 수 있습니다.

확장/파티션 단계는 다음과 같습니다.

  1. /LVM 파티션(/dev/mapper/fedora_hostname-root)을 확장하여 사용 가능한 공간을 채웁니다(lvextend 사용).

  2. /LUKS 파티션을 확장하여 /dev/mapper/fedora_hostname-root LVM 파티션을 채웁니다(cryptsetup 크기 조정 사용).

  3. /LUKS 파티션을 채우기 위해 /filesystem을 확장합니다(예: ext2/3/4인 경우 resize2fs 사용).

관련 정보