为什么80%的码农都做不了架构师?>>>
涉及到的命令:fdisk/mkfs/mount
列出当前磁盘
[root@vity ~]# fdisk -lDisk /dev/vda: 21.5 GB, 21474836480 bytes 16 heads, 63 sectors/track, 41610 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0001cd0bDevice Boot Start End Blocks Id System /dev/vda1 * 3 409 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/vda2 409 8731 4194304 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary. /dev/vda3 8731 41611 16571392 83 Linux Partition 3 does not end on cylinder boundary.Disk /dev/vdb: 21.5 GB, 21474836480 bytes 16 heads, 63 sectors/track, 41610 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
分区&格式化磁盘
[root@vity ~]# fdisk /dev/vdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xd3b0c3e7. 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 toswitch off the mode (command 'c') and change display units tosectors (command 'u').Command (m for help): n Command actione extendedp primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-41610, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-41610, default 41610): Using default value 41610Command (m for help): w The partition table has been altered!Calling ioctl() to re-read partition table. Syncing disks.[root@vity ~]# mkfs -t ext4 -c /dev/vdb1 mke2fs 1.41.12 (17-May-2010) 文件系统标签= 操作系统:Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 1310720 inodes, 5242852 blocks 262142 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=4294967296 160 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, 4096000Checking for bad blocks (read-only test): 完成 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成This filesystem will be automatically checked every 20 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
挂载磁盘
[root@vity ~]# mkdir /data [root@vity ~]# mount -t ext4 /dev/vdb1 /data [root@vity ~]# df -l Filesystem 1K-blocks Used Available Use% Mounted on LABEL=cec-rootfs 16311208 3611268 11871372 24% / tmpfs 8165992 224 8165768 1% /dev/shm /dev/vda1 198337 52425 135672 28% /boot /dev/vdb1 20642316 176064 19417684 1% /data [root@vity ~]# echo "/dev/vdb1 /data ext4 defaults 0 0" >> /etc/fstab
此文只做记录,非教程。