磁盘linux 命令,linux下磁盘操作命令

查看系统的磁盘信息:

fdisk -l

[root@localhost home]# fdisk -l

Disk /dev/hda: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 13 104391 83 Linux

/dev/hda2 14 979 7759395 83 Linux

/dev/hda3 980 1044 522112+ 82 Linux swap

Disk /dev/hdb: 2147 MB, 2147483648 bytes

16 heads, 63 sectors/track, 4161 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System

/dev/hdb1 * 1 200 100768+ 83 Linux

/dev/hdb2 201 3100 1461600 83 Linux

/dev/hdb3 3101 4161 534744 82 Linux swap

[root@localhost home]#

分区:

fdisk

[root@localhost home]# fdisk /dev/hdb

The number of cylinders for this disk is set to 4161.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

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

创建文件系统:

mke2fs

交换分区格式化:

mkswap

[root@localhost home]# mkswap -v /dev/hdb3

mkswap: warning: truncating swap area to 133890kB

Setting up swapspace version 0, size = 133885 kB

设置标签:

e2label

Usage: e2label device [newlabel]

查看文件系统信息:

df

[root@localhost home]# df

Filesystem 1K-块 已用 可用 已用%挂载点/dev/hda2 7637400 5721608 1527824 79% /

/dev/hda1 101086 13881 81986 15% /boot

none 127960 0 127960 0% /dev/shm

df -k

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda1             30969568   4897800  24498608  17% /

udev                   7171796       184   7171612   1% /dev

/dev/sda3             93635848  11353556  77525848  13% /home

/dev/sdb1            141122196  12011668 121941928   9% /home1

/dev/sdc1            863558712  92742284 726950144  12% /oradata

/dev/sr1                711508    711508         0 100% /media/SLES10SP_001

查看挂载信息:

mount

[root@localhost home]# mount

/dev/hda2 on / type ext3 (rw)

none on /proc type proc (rw)

none on /sys type sysfs (rw)

none on /dev/pts type devpts (rw,gid=5,mode=620)

usbdevfs on /proc/bus/usb type usbdevfs (rw)

/dev/hda1 on /boot type ext3 (rw)

none on /dev/shm type tmpfs (rw)

/dev/hdc on /mnt/cdrom type subfs (ro,fs=udf:iso9660,iocharset=cp936,umask=0)

/dev/fd0 on /mnt/floppy type subfs (rw,sync,fs=floppyfss,iocharset=cp936,codepag

e=936,umask=0)

挂载分区:

mount设备 挂载点

[root@localhost home]# mount /dev/hdb2 /mnt/new

[root@localhost home]# mount -t iso9660 /dev/hdc /mnt/cdrom #挂载光盘

启动时自动挂载:

配置/etc/fstab文件:

/dev/hdb2 /mnt/new ext3 default 0 0

/dev/hdc /mnt/cdrom iso9660 default 0 0

查看块设备的属性:

Blkid

[root@localhost boot]# blkid

/dev/sda2: LABEL="SWAP-sda2" TYPE="swap"

/dev/sda1: LABEL="/" UUID="2dcedbd7-eb1a-4d04-88f7-f32175b27e98" SEC_TYPE="ext2" TYPE="ext3"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值