ubuntu下安装linux分区大小,增加安装Ubuntu的分区大小?

SSH到系统,切换到root并运行cfdisk#cfdisk

1d26a79420e3af6ed734fa85a059d201.png

52f433cdc5e5fd529147c77837b6b6fb.png

28d69e1e0b19a08f923e9e1b6bb1c1bb.png

b6981896ce43fd2c66d91bf3d1a0ceed.png

8a20d381cf733576ef0263d5053d4939.png

4fd955da64c07cbcd25ef6825fad0dfc.png

4c550043ecedcd4a851824bede7f46fd.png

7ca6b9d7291df89e162513a69a522012.png

0e2d02ac630401783580fd070482d3e0.png

f8ebec40df681a29cb0a2e814f92652d.png

d79181624149545d698948eb1a9dfff0.png

退出cfdisk后

# fdisk -l /dev/sda

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 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: 0xc8b647ff

Device Boot Start End Sectors Size Id Type

/dev/sda1 * 2048 999423 997376 487M 83 Linux

/dev/sda2 1001470 16775167 15773698 7.5G 5 Extended

/dev/sda3 16775168 41943039 25167872 12G 8e Linux LVM (***** See new partition /dev/sda3*****)

/dev/sda5 1001472 16775167 15773696 7.5G 8e Linux LVM

在下一步之前重新启动系统(否则您可能会获得Device

/dev/sda3 not found (or ignored by filtering))

# shutdown now -r

初始化新卷

# pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created

获取要扩展的卷的名称

# vgdisplay

--- Volume group ---

VG Name linuxetc1-vg (***** this is vg i'm extending*****)

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 7.52 GiB

PE Size 4.00 MiB

Total PE 1925

Alloc PE / Size 1925 / 7.52 GiB

Free PE / Size 0 / 0

...

扩展卷组

# vgextend linuxetc1-vg /dev/sda3

Volume group "linuxetc1-vg" successfully extended

扩展根目录

# lvextend -l+100%FREE /dev/linuxetc1-vg/root

Size of logical volume linuxetc1-vg/root changed from 6.52 GiB (1669 extents) to 18.52 GiB (4741 extents).

Logical volume root successfully resized.

Or if you only wanted to give 5 more GB to root

# lvextend -L +5g /dev/linuxetc1-vg/root

获取下一步的文件系统名称

# df -h

Filesystem Size Used Avail Use% Mounted on

udev 477M 0 477M 0% /dev

tmpfs 100M 4.6M 95M 5% /run

/dev/mapper/linuxetc1--vg-root 6.3G 2.5G 3.5G 42% / (***** this line*****)

tmpfs 497M 0 497M 0% /dev/shm

tmpfs 5.0M 0 5.0M 0% /run/lock

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

/dev/sda1 472M 105M 343M 24% /boot

tmpfs 100M 0 100M 0% /run/user/1000

扩展文件系统

# resize2fs /dev/mapper/linuxetc1--vg-root

resize2fs 1.42.13 (17-May-2015)

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

old_desc_blocks = 1, new_desc_blocks = 2

The filesystem on /dev/mapper/linuxetc1--vg-root is now 4854784 (4k) blocks long.

看到增加的尺寸

# df -h

Filesystem Size Used Avail Use% Mounted on

udev 477M 0 477M 0% /dev

tmpfs 100M 4.6M 95M 5% /run

/dev/mapper/linuxetc1--vg-root 19G 2.5G 15G 15% / (***** this line*****)

tmpfs 497M 0 497M 0% /dev/shm

tmpfs 5.0M 0 5.0M 0% /run/lock

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

/dev/sda1 472M 105M 343M 24% /boot

tmpfs 100M 0 100M 0% /run/user/1000

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值