I. View a newly added disk
[root@localhost/]# fdisk-l
disk/dev/sda:53.7 GB, 53687091200 bytes, 104.8576 million sectors
Units = Sector of 1 * the bytes
sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
disk label type: dos
disk identifier: 0X0009F1D1
device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 Linux
/dev/sda2 1026048 5253119 2113536 Linux swap/solaris
/dev/sda3 5253120 104857599 49802240 Linux
disk/dev/sdb:21.5 GB, 21474836480 bytes, 41,943,040 sectors
Units = Sector of 1 * 5 Bytes
sector size (logical/Physical): 512 Bytes/512 bytes
I/o size (min/best): 512 Bytes/512 bytes
disk label type: dos
disk identifier: 0x12f9141b
device Boot Start end Blocks Id System
/dev/sdb1 2048 10487807 5242880 Linux
two. Disk partitioning
[Root@localhost/]# Fdisk/dev/sdb welcome the use of Fdisk (Util-linux 2.23.2).
The changes will remain in memory until you decide to write the changes to disk.
Please think twice before using the Write command. Command (input m get help): N (n to create partition) Partition Type:p Primary (1 primary, 0 extended, 3 free) (p primary partition) E extended (e is extended partition) Select (default p): P Partition code (2-4, default 2): 2 Start Sector (10487808-41943039, default 10487808): will use default Value 10487808 last sector, + sector or +size{k,m,g} (10487808-41943039, default is 41943039): +5g (size of partition) partition 2 is set to Linux type, size to 5 GiB command (input m get help): W (w Save settings) 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 is used at the next reboot or after you run Partprobe (8) or KPARTX (8) is synchronizing the disk.
Three. Disk format
[Root@localhost/]# partprobe/dev/sdb2 (Refresh partition table)
[root@localhost/]# mke2fs/dev/sdb2 mke2fs 1.42.9
(28- Dec-2013)
file System label =
OS type:linux
block size =4096 (log=2) chunking
size =4096 (log=2)
stride=0 blocks, stripe Width=0 blocks 327680 inodes 1310720 blocks-65536 blocks
(5.00%) reserved for the super User
first block of data =0
maximum filesystem blocks=1342177280 block
groups 32768 blocks/
group, 32768 fragments per group
8 Inodes per group
superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736
allocating Group tables: Completing the
inode table being written: completing
Four. Create a directory and mount the partition
[Root@localhost/]# mkdir/soft
[root@localhost/]# Mount/dev/sdb2/soft
Five. Set the boot self mount
[Root@localhost/]# vim/etc/fstab
/dev/sdb2 /soft xfs defaults 0 0
Six. View Mount
[root@localhost/]# df-ht
file system type capacity used available% mount point
/dev/sda3 xfs 48G 3.7G 44G 8%/
devtmpfs devtmpfs 906M 0 906M 0%/dev
tmpfs tmpfs 914M 80K 914M 1%/dev/shm
tmpfs tmpfs 914M 8.9M 905M 1%/run
tmpfs tmpfs 914M 0 914M 0%/sys/fs/cgroup
/dev/sda1 xfs 497M 116M 382M 24%/boot /dev/sdb1 ext2 5.0G 11M 4.7G 1%/dvd
/dev/sdb2 ext2 5.0G 10M 4.7G 1%/soft
The above is a small series for everyone to bring the Linux disk partition combat case (must see article) all content, I hope that we support cloud Habitat Community ~