LINUX扩展根目录磁盘空间(LINUX LVM )

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LINUX扩展根目录磁盘空间(LINUX LVM )相关的知识,希望对你有一定的参考价值。


linux扩展根目录磁盘空间(linux lvm )



扩展目标分区前提:

扩展的分区必须要是linux lvm卷如下截图(分区/dev/sda1不可以扩展,分区/dev/sda2可以扩展)

技术分享

提示:决定linux lvm的因素是磁盘第一次分区时候选择的分区格式决定的。如下图列出了linux下支持的分区格式

技术分享

SSH Secure Shell 3.2.9 (Build 283)

Copyright (c) 2000-2003 SSH Communications Security Corp - http://www.ssh.com/

This copy of SSH Secure Shell is a non-commercial version.

This version does not include PKI and PKCS #11 functionality.

Last login: Fri Dec 18 15:51:53 2015 from 192.168.19.1

1.查看当前磁盘空间

[[email protected] ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]# fdisk -l

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot   Start      End  Sectors  Size Id Type

/dev/sda1  *       2048  1026047  1024000  500M 83 Linux

/dev/sda2       1026048 41943039 40916992 19.5G 8e Linux LVM

Disk /dev/mapper/fedora-swap: 2 GiB, 2147483648 bytes, 4194304 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disk /dev/mapper/fedora-root: 17.5 GiB, 18798870528 bytes, 36716544 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

[[email protected] ~]# pvdisplay

--- Physical volume ---

PV Name               /dev/sda2

VG Name               fedora

PV Size               19.51 GiB / not usable 3.00 MiB

Allocatable           yes (but full)

PE Size               4.00 MiB

Total PE              4994

Free PE               0

Allocated PE          4994

PV UUID               WX9LBx-nFSo-mVyM-3INs-T04v-lKg4-kXFiKk

[[email protected] ~]# pvcreate /dev/sd

Device /dev/sd not found (or ignored by filtering).

[[email protected] ~]# pvcreate /dev/sd*

Device /dev/sda not found (or ignored by filtering).

Can‘t open /dev/sda1 exclusively.  Mounted filesystem?

Can‘t initialize physical volume "/dev/sda2" of volume group "fedora" without -ff

[[email protected] ~]# pvcreate /dev/sdb

Device /dev/sdb not found (or ignored by filtering).

[[email protected] ~]# pvdisplay /dev/sda2

--- Physical volume ---

PV Name               /dev/sda2

VG Name               fedora

PV Size               19.51 GiB / not usable 3.00 MiB

Allocatable           yes (but full)

PE Size               4.00 MiB

Total PE              4994

Free PE               0

Allocated PE          4994

PV UUID               WX9LBx-nFSo-mVyM-3INs-T04v-lKg4-kXFiKk

[[email protected] ~]# pvdisplay /dev/sda3

Failed to find device for physical volume "/dev/sda3".

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]# fdisk -l

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot   Start      End  Sectors  Size Id Type

/dev/sda1  *       2048  1026047  1024000  500M 83 Linux

/dev/sda2       1026048 41943039 40916992 19.5G 8e Linux LVM

Disk /dev/mapper/fedora-swap: 2 GiB, 2147483648 bytes, 4194304 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disk /dev/mapper/fedora-root: 17.5 GiB, 18798870528 bytes, 36716544 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

[[email protected] ~]# vgextend fedora /dev/sda2

Physical volume ‘/dev/sda2‘ is already in volume group ‘fedora‘

Unable to add physical volume ‘/dev/sda2‘ to volume group ‘fedora‘.

(这里要先添加磁盘分区)

技术分享

2.创建磁盘分区

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

Welcome to fdisk (util-linux 2.26.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): m

Help:

DOS (MBR)

a   toggle a bootable flag

b   edit nested BSD disklabel

c   toggle the dos compatibility flag

Generic

d   delete a partition

l   list known partition types

n   add a new partition

p   print the partition table

t   change a partition type

v   verify the partition table

Misc

m   print this menu

u   change display/entry units

x   extra functionality (experts only)

Script

I   load disk layout from sfdisk script file

O   dump disk layout to sfdisk script file

Save & Exit

w   write table to disk and exit

q   quit without saving changes

Create a new label

g   create a new empty GPT partition table

G   create a new empty SGI (IRIX) partition table

o   create a new empty DOS partition table

s   create a new empty Sun partition table

Command (m for help): n

Partition type

p   primary (2 primary, 0 extended, 2 free)

e   extended (container for logical partitions)

Select (default p): p

Partition number (3,4, default 3): 3

First sector (41943040-62914559, default 41943040):

Last sector, +sectors or +size{K,M,G,T,P} (41943040-62914559, default 62914559):

Created a new partition 3 of type ‘Linux‘ and of size 10 GiB.

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Re-reading the partition table failed.: 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).

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

3./dev/sda3即是新创建的磁盘

[[email protected] ~]# fdisk -l

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot    Start      End  Sectors  Size Id Type

/dev/sda1  *        2048  1026047  1024000  500M 83 Linux

/dev/sda2        1026048 41943039 40916992 19.5G 8e Linux LVM

/dev/sda3       41943040 62914559 20971520   10G 83 Linux

Disk /dev/mapper/fedora-swap: 2 GiB, 2147483648 bytes, 4194304 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disk /dev/mapper/fedora-root: 17.5 GiB, 18798870528 bytes, 36716544 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

4.把/dev/sda3更改成linux lvm卷(便于加入linux lvm然后空间加入根分区)

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

Welcome to fdisk (util-linux 2.26.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n

To create more partitions, first replace a primary with an extended partition.

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot    Start      End  Sectors  Size Id Type

/dev/sda1  *        2048  1026047  1024000  500M 83 Linux

/dev/sda2        1026048 41943039 40916992 19.5G 8e Linux LVM

/dev/sda3       41943040 62914559 20971520   10G 83 Linux

Command (m for help): 3

3: unknown command

Command (m for help):

Command (m for help): m

Help:

DOS (MBR)

a   toggle a bootable flag

b   edit nested BSD disklabel

c   toggle the dos compatibility flag

Generic

d   delete a partition

l   list known partition types

n   add a new partition

p   print the partition table

t   change a partition type

v   verify the partition table

Misc

m   print this menu

u   change display/entry units

x   extra functionality (experts only)

Script

I   load disk layout from sfdisk script file

O   dump disk layout to sfdisk script file

Save & Exit

w   write table to disk and exit

q   quit without saving changes

Create a new label

g   create a new empty GPT partition table

G   create a new empty SGI (IRIX) partition table

o   create a new empty DOS partition table

s   create a new empty Sun partition table

Command (m for help): n

To create more partitions, first replace a primary with an extended partition.

Command (m for help): t

Partition number (1-3, default 3): 3

Partition type (type L to list all types): 8e

Changed type of partition ‘Linux‘ to ‘Linux LVM‘.

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Re-reading the partition table failed.: 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).

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

5./dev/sda3已经成功更改为linux lvm卷

[[email protected] ~]# fdisk -l

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot    Start      End  Sectors  Size Id Type

/dev/sda1  *        2048  1026047  1024000  500M 83 Linux

/dev/sda2        1026048 41943039 40916992 19.5G 8e Linux LVM

/dev/sda3       41943040 62914559 20971520   10G 8e Linux LVM

Disk /dev/mapper/fedora-swap: 2 GiB, 2147483648 bytes, 4194304 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disk /dev/mapper/fedora-root: 17.5 GiB, 18798870528 bytes, 36716544 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

[[email protected] ~]# df -T

Filesystem              Type     1K-blocks    Used Available Use% Mounted on

devtmpfs                devtmpfs    124256       0    124256   0% /dev

tmpfs                   tmpfs       133964       0    133964   0% /dev/shm

tmpfs                   tmpfs       133964     948    133016   1% /run

tmpfs                   tmpfs       133964       0    133964   0% /sys/fs/cgroup

/dev/mapper/fedora-root ext4      17938864 5447232  11557336  33% /

tmpfs                   tmpfs       133964       8    133956   1% /tmp

/dev/sda1               ext4        487652  101297    356659  23% /boot

tmpfs                   tmpfs        26796       0     26796   0% /run/user/0

[[email protected] ~]# df -TH

Filesystem              Type      Size  Used Avail Use% Mounted on

devtmpfs                devtmpfs  128M     0  128M   0% /dev

tmpfs                   tmpfs     138M     0  138M   0% /dev/shm

tmpfs                   tmpfs     138M  971k  137M   1% /run

tmpfs                   tmpfs     138M     0  138M   0% /sys/fs/cgroup

/dev/mapper/fedora-root ext4       19G  5.6G   12G  33% /

tmpfs                   tmpfs     138M  8.2k  138M   1% /tmp

/dev/sda1               ext4      500M  104M  366M  23% /boot

tmpfs                   tmpfs      28M     0   28M   0% /run/user/0

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  948K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]# fdisk -l

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot    Start      End  Sectors  Size Id Type

/dev/sda1  *        2048  1026047  1024000  500M 83 Linux

/dev/sda2        1026048 41943039 40916992 19.5G 8e Linux LVM

/dev/sda3       41943040 62914559 20971520   10G 8e Linux LVM

Disk /dev/mapper/fedora-swap: 2 GiB, 2147483648 bytes, 4194304 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disk /dev/mapper/fedora-root: 17.5 GiB, 18798870528 bytes, 36716544 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

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

Welcome to fdisk (util-linux 2.26.2).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): p

Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

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

Disklabel type: dos

Disk identifier: 0x494832b4

Device     Boot    Start      End  Sectors  Size Id Type

/dev/sda1  *        2048  1026047  1024000  500M 83 Linux

/dev/sda2        1026048 41943039 40916992 19.5G 8e Linux LVM

/dev/sda3       41943040 62914559 20971520   10G 8e Linux LVM

Command (m for help): q

[[email protected] ~]# df -T

Filesystem              Type     1K-blocks    Used Available Use% Mounted on

devtmpfs                devtmpfs    124256       0    124256   0% /dev

tmpfs                   tmpfs       133964       0    133964   0% /dev/shm

tmpfs                   tmpfs       133964     948    133016   1% /run

tmpfs                   tmpfs       133964       0    133964   0% /sys/fs/cgroup

/dev/mapper/fedora-root ext4      17938864 5447232  11557336  33% /

tmpfs                   tmpfs       133964       8    133956   1% /tmp

/dev/sda1               ext4        487652  101297    356659  23% /boot

tmpfs                   tmpfs        26796       0     26796   0% /run/user/0

6.刷新分区

[[email protected] ~]# partprobe

7.格式化/dev/sda3为 ext4格式

[[email protected] ~]# mkfs.ext4 /dev/sda3

mke2fs 1.42.12 (29-Aug-2014)

Creating filesystem with 2621440 4k blocks and 655360 inodes

Filesystem UUID: e9cdabd2-d211-4b20-ad89-176c845d56c5

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  952K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]# lvs

LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

root fedora -wi-ao---- 17.51g

swap fedora -wi-ao----  2.00g

8.创建  Physical volume                            

[[email protected] ~]# pvcreate /dev/sda3

WARNING: ext4 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y

Wiping ext4 signature on /dev/sda3.

Physical volume "/dev/sda3" successfully created

9.把/dev/sda3加入 fedora 组(系统根分区默认组)

[[email protected] ~]# vgextend fedora /dev/sda3

Volume group "fedora" successfully extended

[[email protected] ~]# vgdisplay

--- Volume group ---

VG Name               fedora

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               29.50 GiB

PE Size               4.00 MiB

Total PE              7553

Alloc PE / Size       4994 / 19.51 GiB

Free  PE / Size       2559 / 10.00 GiB

VG UUID               fsrCEu-vQgr-a0Xx-hiDy-S1QR-pW9Q-2ROFlQ

 10.根分区扩展空间7.69G (命令出错)

[[email protected] ~]# lvextend -L +7.96G /dev/VolGroup00/LogVol00 /dev/sda3

Volume group "VolGroup00" not found

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  952K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

 11.根分区扩展空间10G (出错,可供扩展的空间不足)

[[email protected] ~]# lvextend -L +10G /dev/mapper/fedora-root /dev/sda3

Insufficient free space: 2560 extents needed, but only 2559 available

 12.根分区扩展空间9.8G (成功)

[[email protected] ~]# lvextend -L +9.8G /dev/mapper/fedora-root /dev/sda3

Rounding size to boundary between physical extents: 9.80 GiB

Size of logical volume fedora/root changed from 17.51 GiB (4482 extents) to 27.31 GiB (6991 extents).

Logical volume root successfully resized

[[email protected] ~]# vim /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sat Jul  4 17:58:53 2015

#

# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/fedora-root /       ext4    usrquota,grpquota       0       1

UUID=94aed458-ec42-4303-a893-c6effa398adc /boot                   ext4    defaults        1 2

/dev/mapper/fedora-swap swap                    swap    defaults        0 0

~

~

~

~

[[email protected] ~]#

[[email protected] ~]#

[[email protected] ~]# e2fsck -f /dev/mapper/fedora-root

e2fsck 1.42.12 (29-Aug-2014)

/dev/mapper/fedora-root is mounted.

e2fsck: Cannot continue, aborting.

[[email protected] ~]# e2fsck -f /dev/mapper/fedora

e2fsck 1.42.12 (29-Aug-2014)

e2fsck: No such file or directory while trying to open /dev/mapper/fedora

Possibly non-existent device?

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  952K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   18G  5.2G   12G  33% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

13.文件系统重定义分区大小

[[email protected] ~]# resize2fs /dev/mapper/fedora-root

resize2fs 1.42.12 (29-Aug-2014)

Filesystem at /dev/mapper/fedora-root is mounted on /; on-line resizing required

old_desc_blocks = 2, new_desc_blocks = 2

The filesystem on /dev/mapper/fedora-root is now 7158784 (4k) blocks long.

14.查看磁盘根目录空间已经成功扩展(18G变为27G)

[[email protected] ~]# df -lh

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 122M     0  122M   0% /dev

tmpfs                    131M     0  131M   0% /dev/shm

tmpfs                    131M  952K  130M   1% /run

tmpfs                    131M     0  131M   0% /sys/fs/cgroup

/dev/mapper/fedora-root   27G  5.2G   21G  21% /

tmpfs                    131M  8.0K  131M   1% /tmp

/dev/sda1                477M   99M  349M  23% /boot

tmpfs                     27M     0   27M   0% /run/user/0

[[email protected] ~]#

15.LINUX lvm 卷 根分区扩展结束


文章标题:linux扩展根目录磁盘空间(linux lvm )

永久链接:http://www.xishui139.com/archives/702


本文出自 “xishui139” 博客,请务必保留此出处http://xishui139.blog.51cto.com/4961842/1738010

以上是关于LINUX扩展根目录磁盘空间(LINUX LVM )的主要内容,如果未能解决你的问题,请参考以下文章

linux 简单记录7--使用 RAID 与 LVM 磁盘阵列技术(使用LVM扩展磁盘空间)

LVM创建逻辑卷,实现单个目录挂载多个磁盘

给linux虚拟机硬盘扩容(LVM分区)

Linux centosVMware 命令 lvm磁盘故障小案例

Linux入门之磁盘管理LVM逻辑卷的使用

linux 根分区LVM扩容