CentOS 파티셔닝

CentOS 파티셔닝

2개의 1TB 디스크가 있는 CentOS 서버가 있습니다. 그러나 분할이 잘못되었습니다. 아래를 확인하세요:

[root@p16282558 ~]# fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0xd4f28eb2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         523     4194304   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2             523         784     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sdb3             784      121602   970470104   fd  Linux raid autodetect
Partition 3 does not end on cylinder boundary.

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x724abfe3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         523     4194304   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             523         784     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             784      121602   970470104   fd  Linux raid autodetect
Partition 3 does not end on cylinder boundary.

Disk /dev/md3: 993.8 GB, 993761296384 bytes
2 heads, 4 sectors/track, 242617504 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 4294 MB, 4294901760 bytes
2 heads, 4 sectors/track, 1048560 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-usr: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 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/vg00-var: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 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/vg00-home: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 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

내가 달렸을 때 df:

[root@p16282558 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              4.0G  4.0G     0 100% /
/dev/mapper/vg00-usr  4.0G  1.5G  2.4G  38% /usr
/dev/mapper/vg00-var  4.0G  880M  2.9G  23% /var
/dev/mapper/vg00-home
                      4.0G  136M  3.7G   4% /home
none                  7.9G  556K  7.9G   1% /tmp

/opt이(가) 내에 있으며 /, 에 남은 공간이 없습니다./

/etc/fstab모습은 다음과 같습니다.

/dev/md1        /               ext3    defaults        1 1
/dev/sda2   none            swap    sw
/dev/sdb2   none            swap    sw
/dev/vg00/usr   /usr            ext4    defaults        0 2
/dev/vg00/var   /var            ext4    defaults,usrquota   0 2
/dev/vg00/home  /home           ext4    defaults,usrquota   0 2
devpts          /dev/pts        devpts  gid=5,mode=620  0 0
none            /proc           proc    defaults        0 0
none            /tmp    tmpfs   defaults        0 0

그러면 전체 디스크가 있고 , 993.8GB의 여유 공간이 있는 md1사용되지 않은 디스크가 있습니까??/dev/md3

하지만,

[root@p16282558 ~]# df -h /dev/md3
Filesystem            Size  Used Avail Use% Mounted on
-                     7.9G  204K  7.9G   1% /dev

/dev이는 fstab에 따라 시스템 시작 시 마운트되지 않는다는 의미입니까 ?

Output of vgdisplay:

--- Volume group ---
  VG Name               vg00
  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               925.51 GiB
  PE Size               4.00 MiB
  Total PE              236931
  Alloc PE / Size       3072 / 12.00 GiB
  Free  PE / Size       233859 / 913.51 GiB

내 문제는 /opt더 많은 공간이 있는 디스크/파티션에 마운트해야 한다는 것입니다. 모든 디스크 공간을 효율적으로 활용하도록 디스크를 재구성하려면 어떻게 해야 합니까?

답변1

출력 에 따르면 할당되지 않은 공간( 값) vgdisplay이 900GB를 넘습니다 .Free PE

루트 볼륨은 LVM 볼륨이 아니고 /opt현재 에 있으므로 /사용 가능한 공간을 늘릴 수 없습니다.
그러나 당신이 할 수 있는 일은 /opt.

프로세스는 다음과 같이 진행됩니다.

# create a new 5gb logical volume
lvcreate -n opt -L 5G vg00

# format it as ext4
mkfs.ext4 /dev/vg00/opt

# move the old dir out of the way
mv /opt /opt.orig

# mount the new logical volume
echo "/dev/vg00/opt /opt ext4 defaults 0 2" >> /etc/fstab
mkdir /opt
mount /opt

# move all data into the new mount
mv /opt.orig/* /opt
rmdir /opt.orig

LVM에서는 볼륨 크기 조정이 가능하므로 나중에 에 더 많은 공간을 추가해야 하는 경우 /opt매우 쉽게 수행할 수 있습니다.

답변2

두 가지 모두의 출력을 보면 대략 913.51GB의 여유 PE가 있다는 것을 알 수 없습니다 vgs. vgdisplay이는 물리적 범위이므로 LVM 볼륨 그룹(VG)에는 이러한 물리적 범위가 할당되어 있지 않습니다. 그들은 여유 공간입니다.

Output of vgdisplay:

--- Volume group ---
  VG Name               vg00
  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               925.51 GiB
  PE Size               4.00 MiB
  Total PE              236931
  Alloc PE / Size       3072 / 12.00 GiB
  Free  PE / Size       233859 / 913.51 GiB

따라서 이러한 물리적 범위를 할당해야 한다고 결론을 내릴 수 있습니다. 모든 여유 공간을 할당하기 위해 이 VG 내의 논리 볼륨(LV) 중 하나를 확장하는 가장 쉬운 방법은 다음 명령을 사용하는 것입니다.

$ sudo lvextend -l+233859 /dev/vg00/home

+233859PE의 ( )를 LV에 추가하는 곳입니다 /dev/vg00/home.

관련 정보