본문 바로가기
프로그램...

[Virtual Box] 디스크 사이즈 늘리기

by 크크다스 2015. 9. 14.
반응형


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\user>cd C:\Program Files\Oracle\VirtualBox

C:\Program Files\Oracle\VirtualBox>dir *Man*.exe
 C 드라이브의 볼륨에는 이름이 없습니다.
 볼륨 일련 번호: F42F-5988

 C:\Program Files\Oracle\VirtualBox 디렉터리

2015-08-13  오후 06:25         1,288,360 VBoxManage.exe
               1개 파일           1,288,360 바이트
               0개 디렉터리  34,323,025,920 바이트 남음

C:\Program Files\Oracle\VirtualBox> VBoxManage.exe  modifyhd "D:\VMs\MyCent32\MyCent32.vdi"

--resize 150000     <= 단위는 Mega Bytes

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%


C:\Program Files\Oracle\VirtualBox>



------------------------------------------- Linux by root -------------------------------------------

[/home/firstpw] df -k
Filesystem           1K-blocks     Used Available Use% Mounted on
/dev/mapper/vg_cent32-lv_root
                      46869448 39599000   4882892  90% /
tmpfs                   969340        0    969340   0% /dev/shm
/dev/sda1               487652    28395    433657   7% /boot
[/home/firstpw] mount
/dev/mapper/vg_cent32-lv_root / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

[/home/firstpw] ls -l /dev/vg_cent32/lv_root

lrwxrwxrwx. 1 root root 7 2015-09-14 13:15 /dev/vg_cent32/lv_root -> ../dm-0


[/root] fdisk -l

Disk /dev/sda: 157.3 GB, 157286400000 bytes
255 heads, 63 sectors/track, 19122 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007eb7e

   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        6528    51915776   8e  Linux LVM

Disk /dev/mapper/vg_cent32-lv_root: 48.9 GB, 48897196032 bytes
255 heads, 63 sectors/track, 5944 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_cent32-lv_swap: 4261 MB, 4261412864 bytes
255 heads, 63 sectors/track, 518 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


mknod /dev/sda3 b 8 3
chown root:disk /dev/sda3
chmod 660 /dev/sda3

[/root] fdisk /dev/sda


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 157.3 GB, 157286400000 bytes
255 heads, 63 sectors/track, 19122 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007eb7e

   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        6528    51915776   8e  Linux LVM

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (6528-19122, default 6528):
Using default value 6528
Last cylinder, +cylinders or +size{K,M,G} (6528-19122, default 19122):
Using default value 19122

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 장치나 자원이 동작 중.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[/root] reboot

...............


[/root] pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created

[/root] pvscan
  PV /dev/sda2   VG vg_cent32   lvm2 [49.51 GiB / 0    free]
  PV /dev/sda3                  lvm2 [96.48 GiB]
  Total: 2 [145.99 GiB] / in use: 1 [49.51 GiB] / in no VG: 1 [96.48 GiB]


[/root] vgextend vg_cent32 /dev/sda3
  Volume group "vg_cent32" successfully extended


[/root] pvscan
  PV /dev/sda2   VG vg_cent32   lvm2 [49.51 GiB / 0    free]
  PV /dev/sda3   VG vg_cent32   lvm2 [96.48 GiB / 96.48 GiB free]
  Total: 2 [145.99 GiB] / in use: 2 [145.99 GiB] / in no VG: 0 [0   ]


[/root] vgdisplay vg_cent32
  --- Volume group ---
  VG Name               vg_cent32
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               145.99 GiB
  PE Size               4.00 MiB
  Total PE              37373
  Alloc PE / Size       12674 / 49.51 GiB
  Free  PE / Size       24699 / 96.48 GiB
  VG UUID               SNco3u-AEat-p0RL-qtHd-MzP2-Cfjy-r9BGdW

[/root] lvextend --size +96.48g /dev/vg_cent32/lv_root  <== -L error occured. so used --size
  Rounding size to boundary between physical extents: 96.48 GiB
  Size of logical volume vg_cent32/lv_root changed from 45.54 GiB (11658 extents) to 142.02 GiB (36357 extents).
  Logical volume lv_root successfully resized


[/root] resize2fs /dev/vg_cent32/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_cent32/lv_root is mounted on /; on-line resizing required
old desc_blocks = 3, new_desc_blocks = 9
Performing an on-line resize of /dev/vg_cent32/lv_root to 37229568 (4k) blocks.
The filesystem on /dev/vg_cent32/lv_root is now 37229568 blocks long.

[/root] df -k
Filesystem           1K-blocks     Used Available Use% Mounted on
/dev/mapper/vg_cent32-lv_root
                     146448928 39606892  99401868  29% /
tmpfs                   969340        0    969340   0% /dev/shm
/dev/sda1               487652    28395    433657   7% /boot
[/root]


반응형

'프로그램...' 카테고리의 다른 글

[C1004W] Booting Log  (0) 2015.10.29
[C-printf] %n %*s 포맷 사용법  (0) 2015.10.05
[git] branch 찾기 및 Baisc  (0) 2015.10.01
[Trouble Shooting]  (0) 2015.09.07
[Virtual Box] CentOs7 Minimal Version  (0) 2015.08.17