【LINUX学习】磁盘分割之新建与删除

简介: 磁盘分割[root@localhost /]# fdisk -l --列出系统所有的装置的partition都列出来Disk /dev/sda: 4294 MB, 4294967296 bytes255 heads, 63 sectors/tr...
磁盘分割
[ root@localhost /]# fdisk -l --列出系统所有的装置的partition都列出来
Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         522     4088542+  83  Linux

Disk /dev/sdb: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         131     1052226   82  Linux swap / Solaris

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
---也可以指定设备,
[root@localhost /]# fdisk -l /dev/sdc
Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         131     1052226   82  Linux swap / Solaris
[root@localhost /]# fdisk -l /dev/sda
Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         522     4088542+  83  Linux
---创建一个主分区,如果使用默认值,会在建立第一个分区时就将整个磁盘使用完。
[root@localhost /]# fdisk /dev/sdd
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): =直接按enter键默认391
Using default value 391
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1         391     3140676   83  Linux

Command (m for help): n --继续添加
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
No free sectors available--- 没有可用空间了!
--删除刚才建立的那个分区。
Command (m for help): d
Selected partition 1
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
--新建分区
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391): +50M
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1           7       56196   83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (8-391, default 8): 
Using default value 8
Last cylinder or +size or +sizeM or +sizeK (8-391, default 391): +2^H
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1           7       56196   83  Linux
/dev/sdd2               8          10       24097+  83  Linux
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1           7       56196   83  Linux
/dev/sdd2               8          10       24097+  83  Linux
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (11-391, default 11): 
Using default value 11
Last cylinder or +size or +sizeM or +sizeK (11-391, default 391): 
Using default value 391
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1           7       56196   83  Linux
/dev/sdd2               8          10       24097+  83  Linux
/dev/sdd3              11         391     3060382+  83  Linux
--删除第三个分区
Command (m for help): d
Partition number (1-4): 3
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1           7       56196   83  Linux
/dev/sdd2               8          10       24097+  83  Linux
--删除第二个分区
Command (m for help): d
Partition number (1-4): 2 
Command (m for help):m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition  删除一个分区
   l   list known partition types
   m   print this menu
   n   add a new partition 新增一个分区
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes 不保存,离开
   s   create a new empty Sun disklabel 
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit 写入并保存
   x   extra functionality (experts only)
Command (m for help): d
Selected partition 1   --只有一个分区,系统帮我们选择
Command (m for help): p
Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): q
[root@localhost /]# 
目录
相关文章
|
5月前
|
IDE Linux 开发工具
Linux 实操篇-Linux 磁盘分区、挂载
Linux 实操篇-Linux 磁盘分区、挂载
75 0
|
4月前
|
算法 Linux 数据库
【Linux】磁盘分区与挂载和配额管理
【Linux】磁盘分区与挂载和配额管理
70 0
【Linux】磁盘分区与挂载和配额管理
|
9月前
|
Linux
7.3 【Linux】磁盘的分区、格式化、检验与挂载
7.3 【Linux】磁盘的分区、格式化、检验与挂载
128 0
|
10月前
|
存储 IDE Linux
Linux系统磁盘分区及挂载 - fdisk
Linux系统磁盘分区及挂载 - fdisk
245 0
|
存储 Linux Windows
手把手教你Linux磁盘分区与文件挂载(二)
手把手教你Linux磁盘分区与文件挂载
255 0
手把手教你Linux磁盘分区与文件挂载(二)
|
存储 Linux 开发工具
手把手教你Linux磁盘分区与文件挂载(一)
手把手教你Linux磁盘分区与文件挂载
167 0
手把手教你Linux磁盘分区与文件挂载(一)
|
IDE Linux 开发工具
【实操篇】Linux的磁盘分区和挂载
1.Linux无论有几个分区,还是分给哪个目录去使用。它归根结底也就只有一个根目录,它是一个独立并且唯一的文件结构,它其中的每个分区共同构成整个文件系统的一部分。 2.Linux采用了“载入”的处理方法,它的文件系统包含了一整套的文件和目录,将一个分区通过挂载(mount)的方式和一个目录联系在一起,也可以通过卸载(umount)的方式将分区与其联系的目录分开。并且载入的分区将会使它的存储空间在与它挂载的一个目录下获得。
341 0
【实操篇】Linux的磁盘分区和挂载
|
IDE Linux 开发工具
Linux 系统如何实现磁盘分区及挂载
最多支持四个主分区。 系统只能安装在主分区。 扩展分区要占一个主分区。 MBR 最大支持 2 TB,但拥有最好的兼容性。
134 0
|
IDE Linux 编译器
Linux:磁盘分区,挂载(含实例)
Linux:磁盘分区,挂载(含实例)
184 0
Linux:磁盘分区,挂载(含实例)
|
IDE Unix Linux
linux中的tar打包、压缩多个文件、磁盘查看和分区类、du查看文件和目录占用的磁盘空间、df查看磁盘空间使用情况、lsblk查看设备挂载情况、fdisk分区、mount/umount挂载/卸载、设置开机自动挂载
tar [选项] XXX.tar.gz 将要打包进去的内容 (功能描述:打包目录,压缩后的 文件格式.tar.gz)du 目录/文件 (功能描述:显示目录下每个子目录的磁盘使用情况)du: disk usage 磁盘占用情况。详细的请看我之前发的博客。linux常用命令下。linux常用命令中。linux常用命令上。...............对于Linux用户来讲,不论有几个分区,分别分给哪一个目录使用,它总归就是一个根 目录、一个独立且唯一的文件结构。Linux中每个分区都是用来组成整个文件系统的一部分,它在用一种叫做“挂载”的处理 方法,它整个文件系统中包含了一整套的文件和目录,并将一
294 1
linux中的tar打包、压缩多个文件、磁盘查看和分区类、du查看文件和目录占用的磁盘空间、df查看磁盘空间使用情况、lsblk查看设备挂载情况、fdisk分区、mount/umount挂载/卸载、设置开机自动挂载