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. cygwin设置NDK环境变量ANDROID_NDK_ROOT

    cygwin安装目录下的“home/当前用户名”的.bash_profile下以UltraEdit(Unix方式)或者eclipse打开,最后添加一句: ANDROID_NDK_ROOT=/cygdr ...

  2. 《转》python学习(11)-表达式和语句

    转自 http://www.cnblogs.com/BeginMan/p/3164600.html 一.Python语句 if语句.else语句.elif语句.条件表达式.while语句.for语句. ...

  3. 【python3】 django2.0 加载css 、js 、img 等静态文件

    python : 3.6.4 django : 2.0 1 文件目录  /var/www/mysite 2 nginx配置: server { listen ; #暴露给外部访问的端口 server_ ...

  4. 金蝶KIS问题解决汇总

    1.帐套结转时,提示t_subsys插入重复键 解决: I.删除索引  alter table t_subsys drop constraint pk_subsys  II.t_rp_initial表 ...

  5. jQuery属性操作(二)

    挂载到$上的几个属性操作方法分析,发现属性操作用到了sizzle封装的方法 attr: function( elem, name, value ) {        var hooks, ret,   ...

  6. jQuery事件处理(四)

    看了几天,决定整理一下jQuery事件处理的整体设计思路 1.通过add方法给选中的元素注册事件处理程序(通过缓存系统将事件储存到cache,而不是绑定到元素上) a.在存储之前,会为事件处理程序增加 ...

  7. jenkins 集成redmine

    安装 可以使用jenkins的插件管理页面进行安装,也可以使用其id(redmine)在镜像中进行安装并重启镜像即可. 插件安装确认 重新启动后确认此插件已经安装完毕  设定内容 系统管理 -> ...

  8. Asp.Net MVC大型项目实践整合 NHibernate与Json序列化

    通过NHibernate我们多表查询是实现了 但由于查询出来的集合中的对象“不是平的”,如何在送到UI绑定成了问题.ExtJs UI组件的数据绑定支持多种格式,如简单数组,Json,Xml.在本项目中 ...

  9. vue--父组件主动获取子组件的方法

    父组件主动获取子组件的方法和属性 第一步:调用自组件的时候,给自组建定义一个Header <v-header ref='headerInfo'></v-header> 第二步: ...

  10. opengl学习笔记(五):组合变换,绘制一个简单的太阳系

    创建太阳系模型 描述的程序绘制一个简单的太阳系,其中有一颗行星和一颗太阳,用同一个函数绘制.需要使用glRotate*()函数让这颗行星绕太阳旋转,并且绕自身的轴旋转.还需要使用glTranslate ...