Linux 扩大虚拟磁盘

本文介绍了在Linux系统中如何进行磁盘管理,包括使用fdisk创建新分区,查看分区信息,安装gparted进行分区格式化,以及通过编辑fstab文件实现分区的永久挂载。通过这些步骤,你可以有效地调整和管理Linux系统的磁盘容量。
摘要由CSDN通过智能技术生成

一、Linux关机,调节磁盘容量

在这里插入图片描述

二、新建分区

1. 新建分区

# fdisk /dev/sda

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


命令(输入 m 获取帮助): 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
   F   list free unpartitioned space
   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
   i   print information about a partition

  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


命令(输入 m 获取帮助)# 依次输入:
m #进入帮助引导模式

n #新增分区

p #指定新分区为基本分区
...
w #保存并执行刚才的分区操作

#reboot #重启

2. 查看新增分区

#fdisk -l

三、安装分区管理工具

#sudo apt-get install gparted

打开工具,格式化分区。

四、永久挂载分区配置

修改配置文件,系统启动自动挂载。

#vim /etc/fstab

添加

/dev/sda3   /home/Tmp ext4   defaults           0      1

/dev/sda3 —新建的分区

五、查看挂载

挂载成成功后可以查看挂载情况

#df -lhT

l 表示列出
h 表示使用可读性更好的方式打印磁盘大小
T 表示列出文件类型

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值