/home에서 /root로 사용 가능한 하드 디스크를 할당하는 방법

/home에서 /root로 사용 가능한 하드 디스크를 할당하는 방법

CentOS 6.7용 500GB 하드 드라이브가 있습니다. 그런데 파티션을 생성할 때 루트용으로 작은 저장공간을 생성했을 뿐인데 /home 폴더의 용량이 너무 커졌습니다. /home 폴더에서 /root 폴더로 여유 용량을 이동할 수 있나요? /root 폴더는 약 300GB입니다.

[trieutruong@moodle mapper]$ sudo df -ha
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_moodle-lv_root
                       50G   14G   33G  31% /
proc                     0     0     0    - /proc
sysfs                    0     0     0    - /sys
devpts                   0     0     0    - /dev/pts
tmpfs                 2.9G  144K  2.9G   1% /dev/shm
/dev/sda1             477M   98M  354M  22% /boot
/dev/mapper/vg_moodle-lv_home
                      405G   19G  366G   5% /home
none                     0     0     0    - /proc/sys/fs/binfmt_misc
sunrpc                   0     0     0    - /var/lib/nfs/rpc_pipefs
gvfs-fuse-daemon         0     0     0    - /root/.gvfs

    [trieutruong@owncloud ~]$ sudo vgdisplay
  --- Volume group ---
  VG Name               vg_moodle
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               465.27 GiB
  PE Size               4.00 MiB
  Total PE              119109
  Alloc PE / Size       119109 / 465.27 GiB
  Free  PE / Size       0 / 0   
  VG UUID               XjErZu-p3bD-2giP-Uy1x-JXpz-qsaN-82zs2X

[trieutruong@owncloud ~]$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_moodle/lv_root
  LV Name                lv_root
  VG Name                vg_moodle
  LV UUID                akruVU-c3oT-eQsr-UTK6-3x70-uwpt-atyMeY
  LV Write Access        read/write
  LV Creation host, time moodle, 2015-04-10 22:44:22 +0700
  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:0

  --- Logical volume ---
  LV Path                /dev/vg_moodle/lv_home
  LV Name                lv_home
  VG Name                vg_moodle
  LV UUID                9V7IoG-t4KL-8YOj-TzKQ-jgXf-7DEi-Vc4vWD
  LV Write Access        read/write
  LV Creation host, time moodle, 2015-04-10 22:44:31 +0700
  LV Status              available
  # open                 1
  LV Size                411.52 GiB
  Current LE             105349
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/vg_moodle/lv_swap
  LV Name                lv_swap
  VG Name                vg_moodle
  LV UUID                IXlxAv-t6J0-NdXa-OaQJ-s9sS-HUNc-LQojsv
  LV Write Access        read/write
  LV Creation host, time moodle, 2015-04-10 22:45:44 +0700
  LV Status              available
  # open                 1
  LV Size                3.75 GiB
  Current LE             960
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

[trieutruong@owncloud ~]$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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: 0xd9047926

   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       60802   487873536   8e  Linux LVM

Disk /dev/mapper/vg_moodle-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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_moodle-lv_swap: 4026 MB, 4026531840 bytes
255 heads, 63 sectors/track, 489 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_moodle-lv_home: 441.9 GB, 441865732096 bytes
255 heads, 63 sectors/track, 53720 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

답변1

기본 LV를 줄인 다음 루트 LV를 확장해야 합니다. LV의 크기를 조정/확장하기 전에 파일 시스템을 마운트 해제하십시오(차단 장치로 표시).

관련 정보