查看磁盘
# 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