memo/Linux

ubuntu vmware disk 늘리기

slow333 2023. 1. 14. 11:36

디스크 확장-vmware ubuntu

:/home/kalpa # parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free                                                       
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  540MB   538MB   fat32              boot, esp
 3      540MB   42.9GB  42.4GB                     lvm
        42.9GB  85.9GB  43.0GB  Free Space

(parted) resizepart 3
End?  [42.9GB]? 85.9GB                                                    
(parted) print free                                                       
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  540MB   538MB   fat32              boot, esp
 3      540MB   85.9GB  85.4GB                     lvm

(parted) quit                 

/:/dev # resize2fs /dev/sda3
resize2fs 1.46.5 (30-Dec-2021)
resize2fs: Device or resource busy while trying to open /dev/sda3
Couldn't find valid filesystem superblock.
/:/dev # pvs
  PV         VG       Fmt  Attr PSize  PFree
  /dev/sda3  vgubuntu lvm2 a--  39.48g    0 
/:/dev # pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized
/:/dev # df -h
Filesystem                 Size  Used Avail Use% Mounted on
tmpfs                      1.6G  2.0M  1.6G   1% /run
/dev/mapper/vgubuntu-root   38G   11G   26G  30% /
tmpfs                      7.8G     0  7.8G   0% /dev/shm
tmpfs                      5.0M  4.0K  5.0M   1% /run/lock
/dev/sda2                  512M  5.3M  507M   2% /boot/efi
tmpfs                      1.6G  2.4M  1.6G   1% /run/user/1000
/:/dev # lvextend -r -l +100%FREE /dev/mapper/vgubuntu-root
  Size of logical volume vgubuntu/root changed from 38.53 GiB (9864 extents) to <78.54 GiB (20106 extents).
  Logical volume vgubuntu/root successfully resized.
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/mapper/vgubuntu-root is mounted on /; on-line resizing required
old_desc_blocks = 5, new_desc_blocks = 10
The filesystem on /dev/mapper/vgubuntu-root is now 20588544 (4k) blocks long.

/:/dev # df -h
Filesystem                 Size  Used Avail Use% Mounted on
tmpfs                      1.6G  2.0M  1.6G   1% /run
/dev/mapper/vgubuntu-root   78G   11G   63G  15% /
tmpfs                      7.8G     0  7.8G   0% /dev/shm
tmpfs                      5.0M  4.0K  5.0M   1% /run/lock
/dev/sda2                  512M  5.3M  507M   2% /boot/efi
tmpfs                      1.6G  2.4M  1.6G   1% /run/user/1000