天天看點

lvm linux根目錄擴容,vmware下linux非LVM管理的根目錄擴容經曆

因為根目錄會包含很多系統應用運作的配置等,肯定不能直接解除安裝,是以要采用一種既不破壞資料,又能擴容的方法:

1.關機

2.設定->擴充磁盤容量

3.開機

[[email protected] ~]#df -hT-T 檔案系統Filesystem     Type    Size  Used Avail Use% Mounted on/dev/sda2ext418G15G  2.6G85%/tmpfs          tmpfs   491M  148K  491M   1% /dev/shm

/dev/sda1      ext4    291M   34M  242M  13% /boot

[[email protected] ~]#fdisk -l

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          39      307200   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda239        2358    1863168083Linux非LVM

[[email protected] ~]#fdisk /dev/sda

d删除分區

2删除/dev/sda2

n新增

p主分區

2新增/dev/sda2

回車預設

回車預設

w儲存

[[email protected] ~]#reboot

因為是ext4格式,用resize2fs

[root@localhost ~]#resize2fs /dev/sda2resize2fs 1.41.12 (17-May-2010)

Filesystem at /dev/sda2 is mounted on /; on-line resizing required

old desc_blocks = 2, new_desc_blocks = 3

Performing an on-line resize of /dev/sda2 to 10407364 (4k) blocks.

The filesystem on /dev/sda2 is now 10407364 blocks long.

[[email protected] ~]#df -hTFilesystem     Type    Size  Used Avail Use% Mounted on

/dev/sda2      ext4     40G   15G   24G38%/

tmpfs          tmpfs   491M   80K  491M   1% /dev/shm

/dev/sda1      ext4    291M   34M  242M  13% /boot

.host:/        vmhgfs  921G  171G  751G  19% /mnt/hgfs

[r[email protected] ~]#lsblkNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sr0     11:0    1 1024M  0 rom

sda      8:0    0   40G  0 disk

├─sda1   8:1    0  300M  0 part /boot

└─sda2   8:2    039.7G0 part /

由于sda2挂載在根目錄下,sda2是最後一個分區,是以新增的空間跟sda2是連續的,在最後選擇start和end的時候,就能連接配接上,這也是成功的一個條件