前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux磁盘管理

linux磁盘管理

作者头像
零月
发布2018-04-25 14:39:06
7.3K0
发布2018-04-25 14:39:06
举报
文章被收录于专栏:从零开始的linux

查看磁盘

# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0007187a

Device Boot Start End Blocks Id System

/dev/sda1 * 1 26 204800 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 26 1301 10240000 83 Linux

/dev/sda3 1301 1562 2097152 82 Linux swap / Solaris

查看磁盘使用率

# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda2 9.5G 1.2G 7.9G 14% /

tmpfs 491M 0 491M 0% /dev/shm

/dev/sda1 190M 27M 154M 15% /boot

/dev/sr0 3.6G 3.6G 0 100% /mnt

分区

# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Selected partition 4

First cylinder (1562-2610, default 1562):

Using default value 1562

Last cylinder, +cylinders or +size{K,M,G} (1562-2610, default 2610): +1G

Command (m for help): p

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0007187a

Device Boot Start End Blocks Id System

/dev/sda1 * 1 26 204800 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 26 1301 10240000 83 Linux

/dev/sda3 1301 1562 2097152 82 Linux swap / Solaris

/dev/sda4 1562 1693 1056046+ 83 Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 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(8) or kpartx(8)

Syncing disks.

获取分区

# partx -a /dev/sda

BLKPG: Device or resource busy

error adding partition 1

BLKPG: Device or resource busy

error adding partition 2

BLKPG: Device or resource busy

error adding partition 3

[root@node01 ~]# partx -a /dev/sda

BLKPG: Device or resource busy

error adding partition 1

BLKPG: Device or resource busy

error adding partition 2

BLKPG: Device or resource busy

error adding partition 3

BLKPG: Device or resource busy

error adding partition 4

查看设备

# ll /dev/sda

sda sda1 sda2 sda3 sda4

创建目录

# mkdir /data

挂载目录

# mount /dev/sda4 /data/

查看目录(已经挂载)

# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/sda2 9.5G 1.2G 7.9G 14% /

tmpfs 491M 0 491M 0% /dev/shm

/dev/sda1 190M 27M 154M 15% /boot

/dev/sr0 3.6G 3.6G 0 100% /mnt

/dev/sda4 984M 1.3M 931M 1% /data

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2017-04-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始的linux 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档