linux 查看磁盘分区

本文介绍了如何在Linux系统中使用fdisk命令查看和管理磁盘分区。fdisk是一个用于创建和修改分区表的菜单驱动程序,支持GPT、MBR、Sun、SGI和BSD等类型。通过输入'fdisk -l'可以列出所有可用的磁盘文件名,方便进一步操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

fdisk

NAME
fdisk - manipulate disk partition table

SYNOPSIS
fdisk [-uc] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device

   fdisk -l [-u] [device...]

   fdisk -s partition...

   fdisk -v

   fdisk -h

DESCRIPTION
fdisk (in the first form of invocation) is a menu-driven program for creation and manipulation of partition tables. It under‐
stands GPT (experimental for now), MBR, Sun, SGI and BSD partition tables.

   fdisk does not use DOS-compatible mode and cylinders as display units by default.  The  old  deprecated  DOS  behavior  can  be
   enabled with the '-c=dos -u=cylinders' command-line options.

   Hard  disks can be divided into one or more logical disks called partitions.  This division is recorded in the partition table,
   found in sector 0 of the disk.  (In the BSD world one talks about `disk slices' and a `disklabel'.)

   Linux needs at least one partition, namely for its root file system.  It can use swap files and/or  swap  partitions,  but  the
   latter  are more efficient.  So, usually one will want a second Linux partition dedicated as swap partition.  On Intel-compati‐
   ble hardware, the BIOS that boots the system can often only access the first 1024 cylinders of the disk.  For this reason  peo‐
   ple with large disks often create a third partition, just a few MB large, typically mounted on /boot, to store the kernel image
   and a few auxiliary files needed at boot time, so as to make sure that this stuff is accessible to the BIOS.  There may be rea‐
   sons of security, ease of administration and backup, or testing, to use more than the minimum number of partitions.

DEVICES
The device is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk. Old systems without libata (a
library used inside the Linux kernel to support ATA host controllers and devices) make a difference between IDE and SCSI disks.
In such cases the device name will be /dev/hd* (IDE) or /dev/sd* (SCSI).

由于每个人的环境不一样,我们可以先用
df 这个命令找出可用的磁盘文件名,然后再用fdisk查阅

下面举个例子
在这里插入图片描述在这里插入图片描述不想这么复杂 直接输入命令
fdisk -l
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值