1、使用df查看磁盘占用
df -l 只显示本地文件系统
df -h 方便阅读方式显示
df -T 文件系统类型
2、使用fdisk查看分区表
[root@localhost /]# fdisk -l
Disk /dev/sda: 136.4 GB, 136365211648 bytes
255 heads, 63 sectors/track, 16578 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: 0x000258c3
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 16579 132654080 8e Linux LVM
Disk /dev/sdb: 136.4 GB, 136365211648 bytes
255 heads, 63 sectors/track, 16578 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: 0x3defdea9
Device Boot Start End Blocks Id System
/dev/sdb1 1 16578 133162753+ 83 Linux
Disk /dev/sdc: 2190.4 GB, 2190433320960 bytes
255 heads, 63 sectors/track, 266305 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: 0x00000000
Disk /dev/mapper/vg_centosparent-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00000000
Disk /dev/mapper/vg_centosparent-lv_swap: 19.0 GB, 18975031296 bytes
255 heads, 63 sectors/track, 2306 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: 0x00000000
Disk /dev/mapper/vg_centosparent-lv_home: 63.2 GB, 63174606848 bytes
255 heads, 63 sectors/track, 7680 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: 0x00000000
3、对sdc进行操作
[root@localhost /]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xbe496c2d.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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): 在这里按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 注:l是列出分区类型,以供我们设置相应分区的类型;
m print this menu 注:m 是列出帮助信息;
n add a new partition 注:添加一个分区;
o create a new empty DOS partition table
p print the partition table 注:p列出分区表;
q quit without saving changes 注:不保存退出;
s create a new empty Sun disklabel
t change a partition's system id 注:t 改变分区类型;
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): p
Disk /dev/sdc: 2190.4 GB, 2190433320960 bytes
255 heads, 63 sectors/track, 266305 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: 0xbe496c2d
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-266305, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-266305, default 266305):
Using default value 266305
Command (m for help): p
Disk /dev/sdc: 2190.4 GB, 2190433320960 bytes
255 heads, 63 sectors/track, 266305 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: 0xbe496c2d
Device Boot Start End Blocks Id System
/dev/sdc1 1 266305 2139094881 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost /]# fdisk -l /dev/sdc
Disk /dev/sdc: 2190.4 GB, 2190433320960 bytes
255 heads, 63 sectors/track, 266305 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: 0xbe496c2d
Device Boot Start End Blocks Id System
/dev/sdc1 1 266305 2139094881 83 Linux
[root@localhost /]# mkfs
mkfs mkfs.ext2 mkfs.ext4 mkfs.msdos
mkfs.cramfs mkfs.ext3 mkfs.ext4dev mkfs.vfat
[root@localhost /]# mkfs.ext4 /dev/sdc1 格式化成ext4格式
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
133693440 inodes, 534773720 blocks
26738686 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
16320 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: done
完成
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost /]# done
-bash: syntax error near unexpected token `done'
4、重新查看分区表
[root@localhost /]# fdisk -l
Disk /dev/sda: 136.4 GB, 136365211648 bytes
255 heads, 63 sectors/track, 16578 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: 0x000258c3
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 16579 132654080 8e Linux LVM
Disk /dev/sdb: 136.4 GB, 136365211648 bytes
255 heads, 63 sectors/track, 16578 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: 0x3defdea9
Device Boot Start End Blocks Id System
/dev/sdb1 1 16578 133162753+ 83 Linux
Disk /dev/sdc: 2190.4 GB, 2190433320960 bytes
255 heads, 63 sectors/track, 266305 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: 0xbe496c2d
Device Boot Start End Blocks Id System
/dev/sdc1 1 266305 2139094881 83 Linux
Disk /dev/mapper/vg_centosparent-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 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: 0x00000000
Disk /dev/mapper/vg_centosparent-lv_swap: 19.0 GB, 18975031296 bytes
255 heads, 63 sectors/track, 2306 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: 0x00000000
Disk /dev/mapper/vg_centosparent-lv_home: 63.2 GB, 63174606848 bytes
255 heads, 63 sectors/track, 7680 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: 0x00000000
5、新建目录然后挂载
mkdir TestFiles
mount /dev/sdc1 /TestFiles/
6、设置成开机启动自动挂载
vi /etc/fstab
添加一行
/dev/sdc1 /TestFiles ext4 defaults 1 2
收工