1:查看分区情况:df -h

admin@iZwz92c0zpe8t65qe996ckZ:/$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 983M 983M % /dev
tmpfs 201M 24M 177M % /run
/dev/vda1 40G .3G 28G % /
tmpfs 1001M 1001M % /dev/shm
tmpfs 5.0M .0K 5.0M % /run/lock
tmpfs 1001M 1001M % /sys/fs/cgroup
tmpfs 201M 201M % /run/user/

2:查看某一个目录挂载在哪一个分区下面:df -h 目录

admin@iZwz92c0zpe8t65qe996ckZ:/$ df -h /srv/
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G .3G 28G % /

3:给磁盘进行分区:sudo fdisk /dev/vda

admin@iZwz92c0zpe8t65qe996ckZ:/$ sudo fdisk /dev/vda

Welcome to fdisk (util-linux 2.27.).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): m

使用m查看命令的使用方法

  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):

命令p打印分区情况:

Command (m for help): p
Disk /dev/vda: GiB, bytes, sectors
Units: sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disklabel type: dos
Disk identifier: 0xd6804155 Device Boot Start End Sectors Size Id Type
/dev/vda1 * 40G Linux

d 删除分区

命令n 添加分区:

Command (m for help): d
Selected partition
Partition has been deleted. Command (m for help): n
Partition type
p primary ( primary, extended, free)
e extended (container for logical partitions)
Select (default p):

添加分区

Select (default p): p
Partition number (-, default ):
First sector (-, default ):
Last sector, +sectors or +size{K,M,G,T,P} (-, default ): Created a new partition of type 'Linux' and of size 19.1 GiB. Command (m for help): p
Disk /dev/vda: GiB, bytes, sectors
Units: sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disklabel type: dos
Disk identifier: 0xd6804155 Device Boot Start End Sectors Size Id Type
/dev/vda1 .1G Linux

再添加一个分区:

Using default response p.
Partition number (-, default ):
First sector (-, default ):
Last sector, +sectors or +size{K,M,G,T,P} (-, default ): Created a new partition of type 'Linux' and of size 20.9 GiB. Command (m for help): p
Disk /dev/vda: GiB, bytes, sectors
Units: sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disklabel type: dos
Disk identifier: 0xd6804155 Device Boot Start End Sectors Size Id Type
/dev/vda1 .1G Linux
/dev/vda2 .9G Linux

使用命令w保存修改

命令q是修改失效,上面修改没用

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() or kpartx().

执行 partprobe

admin@iZwz92c0zpe8t65qe996ckZ:~$ partprobe

提示 /dev/vda2不存在

执行:sudo mknod /dev/vda2 b 8 4     http://blog.itpub.net/28874898/viewspace-774249/

admin@iZwz92c0zpe8t65qe996ckZ:~$ sudo mknod  /dev/vda2  b
sudo: unable to resolve host iZwz92c0zpe8t65qe996ckZ
admin@iZwz92c0zpe8t65qe996ckZ:~$ ll /dev/vda*
brw-rw---- root disk , Oct : /dev/vda
brw-rw---- root disk , Oct : /dev/vda1
brw-r--r-- root root , Oct : /dev/vda2

3:卸载磁盘挂载:

admin@iZwz92c0zpe8t65qe996ckZ:/$ sudo umount /dev/vda
sudo: unable to resolve host iZwz92c0zpe8t65qe996ckZ
umount: /dev/vda: not mounted

4:阿里云安装完系统之后,只有一个分区,想要变成多个分区?

可以先缩小分区的容量,然后用多余的容量去再分区。

ubuntu 磁盘分区的更多相关文章

  1. ubuntu磁盘分区和挂载

  2. 安装Linux系统的磁盘分区

    ●CentOS磁盘分区 分区顺序: "/"分区(逻辑) -> "/boot"分区(主分区) -> "swap"分区(逻辑) -& ...

  3. 双系统Ubuntu无法访问windows磁盘分区解决方法

    为了更好的体验各种操作系统,在电脑中安装双系统是很好的选择,但在使用中难免会遇到这样或那样的问题. 最近总是遇到Ubuntu系统下无法访问windows磁盘分区问题,看了系统日志发现是挂载磁盘出问题了 ...

  4. 【Linux探索之旅】第一部分第四课:磁盘分区,并完成Ubuntu安装

    内容简介 1.第一部分第四课:磁盘分区,并完成Ubuntu安装 2.第一部分第五课预告:Unity桌面,人生若只如初见 磁盘分区 上一课我们正式开始安装Ubuntu了,但是到了分区的那一步,小编却戛然 ...

  5. Ubuntu访问window下的磁盘分区出现“Error mounting /dev/sda5 at/media”错误的解决方法

    我装ubuntu之前,电脑上安装了windows 10,为了装ubuntu,在window 10下的磁盘工具分配了30G的磁盘空间.安装完Ubuntu之后,访问window 10的磁盘分区出现“Err ...

  6. ubuntu系统分区方案

    一.各文件及文件夹的定义 /bin:bin是binary(二进制)的缩写.存放必要的命令 存放增加的用户程序. /bin分区,存放标准系统实用程序./boot:这里存放的是启动LINUX时使用的一些核 ...

  7. Linux 磁盘与磁盘分区

    Linux 系统中所有的硬件设备都是通过文件的方式来表现和使用的,我们将这些文件称为设备文件,硬盘对应的设备文件一般被称为块设备文件.本文介绍磁盘设备在 Linux 系统中的表示方法以及如何创建磁盘分 ...

  8. 磁盘分区(20G升50G)

      不多说,直接上干货! 本博文的主要内容有 .磁盘分区的概述 .常用的磁盘管理工具    ./下分5G,给/home扩容    .系统自带的fdisk和parted这两款工具 .磁盘空间管理 前言 ...

  9. Linux磁盘分区UUID的获取及其UUID的作用

    注:UUID-Universally Unique IDentifiers全局唯一标识符 一.Linux磁盘分区UUID的获取方法 1.[san@localhost ~]$ ls -l /dev/di ...

随机推荐

  1. WP8.1学习系列(第十七章)——交互UX之输入和反馈模式

    如果你将 Windows 应用商店应用设计为触摸交互,则可免费获取对触摸板.鼠标.笔和键盘交互的支持.你的用户可以从一种输入法切换到另一种,而不会丧失应用体验的感觉.将键盘插入平板电脑?没问题.你的应 ...

  2. c++ auto 理解

    for (auto i : b) Fuck(i); 是 for (auto bitch = std::begin(b); bitch != std::end(b); bitch++) { auto t ...

  3. DataTable进行排序Asc升序,Desc降序

    DataTable dt = new DataTable(); DataView dv = dt.DefaultView; dv.Sort = "XXX Asc"; dt=dv.T ...

  4. Android开发进阶从小工到专家之性能优化

  5. sysbench 压力测试工具

    一.sysbench压力测试工具简介: sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有MySQL. ...

  6. Apache Server Status详解

    Apache的日志如果靠分析日志或者查看服务器进程来监视Apache运行状态的话,比较繁冗.不过在Apache 1.3.2及以后的版本中就自带一个查看Apache状态的功能模块server-statu ...

  7. 供安全工程师实用的SOC模型

    一.背景 如今,安全概念满天飞,什么安全运营中心(SOC).威胁情报(TI).态势感知等等不一而足,这些概念及其背后代表的安全思想都很好,不过很多产品为了迎合国内的工作汇报都做成了很多Dashboar ...

  8. zabbix配置server,proxy,agent架构

    author: headsen  chen date:2018-10-30  19:49:50 环境: centos 6.8_x86_64 zabbix-server: 192.168.1.130 z ...

  9. Unity笔记 英保通 Unity新的动画系统Mecanim

    Mecanim动画系统是Unity独一无二.强大灵活的人物动画系统.该系统赋予您的人类和非人类人物令人难以置信的自然流畅的动作,使它们栩栩如生.游戏中角色设计提高到了新的层次,在处理人类动画角色中可以 ...

  10. C++ Error: error LNK2019: unresolved external symbol

    在某工程中新添加了文件x.cu与x.hpp,实现了一些功能,最后编译整个工程的时候就出现了这个问题: error LNK2019: unresolved external symbol 这是链接错误, ...