Filesystem vergößern im Ubuntu + fdisk + VMware ESX

1. im Disk vergrößern

~# 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: 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 / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0009e9ef

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          32      248832   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              32        1306    10233857    5  Extended

/dev/sda4            1306        3263    15725311+  83  Linux

/dev/sda5              32        1306    10233856   8e  Linux LVM

 

Command (m for help): d

Partition number (1-5): 4

 

Command (m for help): p 

 

Disk /dev/sda: 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 / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0009e9ef

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          32      248832   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              32        1306    10233857    5  Extended

/dev/sda5              32        1306    10233856   8e  Linux LVM

 

Command (m for help): n

Command action

   l   logical (5 or over)

   p   primary partition (1-4)

p

Partition number (1-4): 4

First cylinder (1306-6527, default 1306): 

Using default value 1306

Last cylinder, +cylinders or +size{K,M,G} (1306-6527, default 6527): 

Using default value 6527

 

Command (m for help): p

 

Disk /dev/sda: 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 / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0009e9ef

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          32      248832   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              32        1306    10233857    5  Extended

/dev/sda4            1306        6527    41943391+  83  Linux

/dev/sda5              32        1306    10233856   8e  Linux LVM

 

Command (m for help): 

 

Command (m for help): Command (m for help): 

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: Device or resource busy.

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.

~# reboot

:~# pvresize /dev/sda4
  Physical volume "/dev/sda4" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
 
~# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sda5
  VG Name               root_vg
  PV Size               9.76 GiB / not usable 2.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              2498
  Free PE               593
  Allocated PE          1905
  PV UUID               0Wduj4-JJpL-Z47g-uBPW-FoiY-VKar-Ij9zZa
   
  --- Physical volume ---
  PV Name               /dev/sda4
  VG Name               data_vg
  PV Size               40.00 GiB / not usable 32.50 KiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              10240
  Free PE               7680
  Allocated PE          2560
  PV UUID               Yhx1aL-mi6J-UkeQ-Tvcs-329Y-USpk-WSpgIg
   
 
:~# lvresize -L +10G /dev/mapper/data_vg-data_lv
:~# resize2fs /dev/data_vg/data_lv