루트 파티션의 LVM을 줄이는 방법은 무엇입니까?

루트 파티션의 LVM을 줄이는 방법은 무엇입니까?

실제로는 필요하지 않고 몇 가지 질문이 있기 때문에 루트 LVM 전용 공간을 줄이려고 합니다. 출력은 다음과 같습니다 lvdisplay.

# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/root
  LV Name                root
  VG Name                pc_rperez_lvm
  LV UUID                m7XejM-82cZ-hODn-nT8H-y2BM-3B4s-lq2xgn
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                72.37 GiB
  Current LE             18527
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/home
  LV Name                home
  VG Name                pc_rperez_lvm
  LV UUID                Ehl9tF-XV30-uF4Y-T1Bc-WB8r-Pfim-ONQFn3
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                25.00 GiB
  Current LE             6400
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/swap
  LV Name                swap
  VG Name                pc_rperez_lvm
  LV UUID                pJuBnV-fhD1-NgOe-xMUc-gck8-CfeM-YkQHAX
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                8.00 GiB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

내가 달성하고 싶은 것은 root25GB로 축소한 다음 여유 공간을 home. 그러면 이 정보를 이용하면 설치 파티션의 공간을 줄일 수 있을까요? 그렇다면 어떨까요? 그렇지 않다면 나에게 무엇을 추천하시겠습니까? 저는 페도라 23을 사용하고 있습니다

내가 무엇을 놓치고 있나요?

편집: 파일 시스템:

요청에 따라 사용되는 파일 시스템은 다음과 같습니다.

# cat /etc/fsatb
/dev/mapper/pc_rperez_lvm-root /                       ext4
/dev/mapper/pc_rperez_lvm-home /home                   ext4
/dev/mapper/pc_rperez_lvm-swap swap                    swap

참고: LVM(예: GParted) 파티션 관리를 위한 일부 Live CD에 대해 읽었지만 지금까지 아무것도 찾지 못했습니다. 알고 계시다면 답장에 추가해 주세요!

기사 읽기:1,2,,4그리고 많은 다른 사람들

편집: 다른 LVM을 확장할 수 없습니다.

축소 명령을 실행했는데 pc_lvm_root아래와 같이 모든 것이 정상입니다.

$ sudo ssm resize -s 50G /dev/mapper/pc_rperez_lvm-root 
fsck from util-linux 2.28
/dev/mapper/pc_rperez_lvm-root: 425214/4743168 files (0.2% non-contiguous), 9042371/18971648 blocks
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /dev/mapper/pc_rperez_lvm-root to 13107200 (4k) blocks.
The filesystem on /dev/mapper/pc_rperez_lvm-root is now 13107200 (4k) blocks long.

  Size of logical volume pc_rperez_lvm/root changed from 72.37 GiB (18527 extents) to 50.00 GiB (12800 extents).
  Logical volume root successfully resized.

이제 이 50G를 추가하고 싶지만 pc_rperez_lvm-home할 수 없습니다. 아래 출력을 참조하세요.

$ sudo ssm resize -s+50G /dev/mapper/pc_rperez_lvm-home 
SSM Error (2005): There is not enough space in the pool 'pc_rperez_lvm' to grow volume '/dev/mapper/pc_rperez_lvm-home' to size 78538342.4 KB!

편집: 여전히 LVM을 성장시킬 수 없습니다

불행히도 아직 홈 LVM을 확장할 수 없었습니다. 답변의 제안을 기반으로 수행한 작업은 다음과 같습니다.

$ sudo ssm resize /dev/mapper/pc_rperez_lvm-home 
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/pc_rperez_lvm-home: 34602/1638400 files (3.0% non-contiguous), 2213886/6553600 blocks
resize2fs 1.42.13 (17-May-2015)
Please run 'e2fsck -f /dev/mapper/pc_rperez_lvm-home' first.

SSM Error (2012): ERROR running command: "resize2fs /dev/mapper/pc_rperez_lvm-home"

$ df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             3.9G     0  3.9G   0% /dev
tmpfs                3.9G  260K  3.9G   1% /dev/shm
tmpfs                3.9G  1.4M  3.9G   1% /run
tmpfs                3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sdb1             15G  1.6G   13G  11% /run/initramfs/live
/dev/mapper/live-rw  6.3G  4.2G  2.2G  66% /
tmpfs                3.9G   20K  3.9G   1% /tmp
vartmp               3.9G   63M  3.9G   2% /var/tmp
tmpfs                798M   24K  798M   1% /run/user/1000

$ sudo lvdisplay 
  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/root
  LV Name                root
  VG Name                pc_rperez_lvm
  LV UUID                m7XejM-82cZ-hODn-nT8H-y2BM-3B4s-lq2xgn
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/home
  LV Name                home
  VG Name                pc_rperez_lvm
  LV UUID                Ehl9tF-XV30-uF4Y-T1Bc-WB8r-Pfim-ONQFn3
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                25.00 GiB
  Current LE             6400
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/pc_rperez_lvm/swap
  LV Name                swap
  VG Name                pc_rperez_lvm
  LV UUID                pJuBnV-fhD1-NgOe-xMUc-gck8-CfeM-YkQHAX
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                8.00 GiB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

$ sudo e2fsck -f /dev/mapper/pc_rperez_lvm-home
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts

Pass 5: Checking group summary information
/dev/mapper/pc_rperez_lvm-home: 34602/1638400 files (3.0% non-contiguous), 2213886/6553600 blocks

지금 어떤 아이디어가 있나요?

편집: 필수 정보

$ sudo vgdisplay 
  --- Volume group ---
  VG Name               pc_rperez_lvm
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               105.38 GiB
  PE Size               4.00 MiB
  Total PE              26976
  Alloc PE / Size       21248 / 83.00 GiB
  Free  PE / Size       5728 / 22.38 GiB
  VG UUID               Gi0r0L-gRJe-Tzwz-QQE0-CLOY-ofb2-Hk5YCe

$ sudo dumpe2fs -h /dev/mapper/pc_rperez_lvm-home 
dumpe2fs 1.42.13 (17-May-2015)
Filesystem volume name:   <none>
Last mounted on:          /home
Filesystem UUID:          eb319b45-03f2-49d3-b849-6e1ff4b19046
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              1638400
Block count:              6553600
Reserved block count:     327680
Free blocks:              4358401
Free inodes:              1607559
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1022
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Fri Mar 18 13:16:13 2016
Last mount time:          Thu Jul  7 08:06:05 2016
Last write time:          Thu Jul  7 13:21:17 2016
Mount count:              1
Maximum mount count:      -1
Last checked:             Thu Jul  7 07:56:48 2016
Check interval:           0 (<none>)
Lifetime writes:          714 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      a4d5967b-3ad8-4d22-833d-a6126de8ee41
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             128M
Journal length:           32768
Journal sequence:         0x002cb467
Journal start:            0

여기에 이미지 설명을 입력하세요.

답변1

resize2fs마운트된 파일 시스템 축소 는 지원 되지 않습니다 .

설명 resize2fs 프로그램은 ext2, ext3 또는 ext4 파일 시스템의 크기를 조정합니다. 장치에 마운트되지 않은 파일 시스템을 확대하거나 축소하는 데 사용할 수 있습니다. 파일 시스템이 마운트된 경우 커널과 파일 시스템이 온라인 크기 조정을 지원한다고 가정하면 이를 사용하여 마운트된 파일 시스템의 크기를 확장할 수 있습니다.

System Storage ManagerFedora 배포판을 사용하면 기본 파티션/논리 볼륨 크기에 대한 변경 사항을 한 번에 처리하므로 파일 시스템 크기를 변경하는 것이 더 쉽습니다 . 다음 중 하나에서 시스템을 부팅해야 하지만LiveCD 회전, Fedora 커뮤니티에서 제공(다운로드 크기를 줄이려면 XFCE 또는 LXDE를 권장함) 터미널 창에서 다음을 실행하세요.

sudo ssm resize -s -5G /dev/mapper/pc_rperez_lvm-root 

루트 파일 시스템을 5GB 줄입니다. 또는

sudo ssm resize -s 15G /dev/mapper/pc_rperez_lvm-root 

fs 크기를 15GB로 설정합니다.

ssm다운로드하려는 Live CD에 파일이 없으면 다음을 수행하십시오 .

sudo yum install system-storage-manager

크기를 조정하기 전에.

볼륨을 사용 가능한 최대 공간으로 확장하려면 다음 -s옵션을 생략하면 됩니다.

sudo ssm resize /dev/mapper/pc_rperez_lvm-home

답변2

참고로, 작업을 수행하기 전에 가능하면 전체 백업을 만들거나 최소한 루트 드라이브를 백업해 두십시오. 문제가 발생하지 않는 한 복구하기 어렵기 때문에 LVM을 사용하는 것이 좋습니다.

이제 루트 파티션을 마운트 해제해야 하므로 Live CD에서 이 작업을 수행한 다음 라이브 세션의 터미널에서 다음을 수행해야 합니다.

루트 LVM이 마운트 해제되었는지 확인하십시오.

mountLive CD와 관련된 마운트 지점만 표시 되어야 합니다 .

# mount

루트 파일 시스템에 오류가 있는지 확인하세요.

# e2fsck -f /dev/mapper/pc_rperez_lvm/root

루트 파일 시스템 축소

우리는 항상 계약할 때 안전을 위해 약간의 완충 공간을 갖고 싶어합니다.

# resize2fs /dev/mapper/pc_rperez_lvm/root 23500M

루트 LV 축소

# lvresize -L 24G pc_rperez_lvm/root

루트 LV 확인

이제 "Free PE"가 있고 루트 파일 시스템이 약 24G임을 알 수 있습니다.

# vgdisplay
# lvdisplay pc_rperez_lvm/root

LV를 채우기 위해 루트 파일 시스템 확장

그 공간을 낭비하고 싶지 않습니다.

# resize2fs -M /dev/mapper/pc_rperez_lvm/root

기본 LV에 범위 할당

# lvresize -l +100%FREE /dev/mapper/pc_rperez_lvm/home

메인 파일 시스템 확장

# resize2fs -M /dev/mapper/pc_rperez_lvm/home

재시작

# reboot

관련 정보