/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のサイズを変更/拡張する前に、ファイルシステムをアンマウントしてください(ブロックデバイスとして表示)。

おすすめ記事