The steps are as follows:
1. See if you have assigned
[Email protected] home]# fdisk-L Disk/DEV/SDA:64.4 GB,64424509440 bytes,125829120Sector units = Sector of1 *512 =512Bytes sector size (logical/Physical):512 Bytes/512byte I/O size (min/Best):512 Bytes/512BYTE disk label type: DOS disk identifier:0x000a47adDevice Boot Start End Blocks Id system/dev/sda1 *20481026047 512000 83 linux/dev/sda2 1026048 125829119 62401536 8e Linux LVM disk/dev/sdb:1649.3 GB, 1649267441664 bytes, 3221225472 sector units = Sector of 1 * 512 = 512 bytes sector size ( Logical/Physical): 512 byte i/ O size (Min/Best): 512 bytes
2, found a disk, the path is/DEV/SDB. Then use the FDISK command to create the partition
[Email protected] home]# Fdisk/dev/sdb
The Fdisk command is as follows:
Command (input m for help): M command operation a toggle a bootable flag B edit BSD Disklabel c toggle the DOS compatibility flag D de Lete a partition G create anew empty GPT partition table G Create an IRIX (SGI) partition table l list known partition types M PR int This menu n add a new partition o create a new empty DOS partition table P print the Parti tion table Q Quit without saving changes s create a new empty Sun disklabel t change a partition's Syste M ID u change display/Entry units v Verify the partition Table W write table to disk and exit X extra functionality ( Experts only)
3, then create a new partition (I am here because I want to store a large database file, so the logic is all a partition)
Command (enter M for help): Npartition Type:p Primary (0 primary,0 Extended,4Free) e Extendedselect (Default P): Using default1-4, default 1 2048- 3221225471, default is 2048): Default value will be used 2048last sector, + sector or +size{k,m,g} (2048-3221225471, default = 3221225471 3221225471 partition 1 set to Linux type, size set to 1.5 TiB
4. Last Save partition
Command (enter M for help): Wthe partition table has been altered! calling IOCTL () to re-read partition table. Synchronizing disks.
5, using the fdisk-l command to view, has been partitioned
disk/dev/sdb:1649.3 GB, 1649267441664 bytes, 3221225472 sector units = Sector of 1 * 512 = 512 bytes sector size (logical/Physical): 512 bytes/512 512 bytes/5120xe0bc0098 device Boot Start End Blocks Id SYSTEM/DEV/SDB1 2048 3221225471 1610611712 83 Linux
6. After the partition is built, the partition should be formatted and the file system will be established.
[Email protected] home]# mkfs.xfs-f/dev/SDSDA sda1 sda2 SDB sdb1 [[email protected] home]# mkfs.xfs-f/dev/SDB1META-DATA=/DEV/SDB1 isize=Agcount=4, agsize=100663232Blks = sectsz=Attr=2, projid32bit=1 = crc=0 finobt=0data = bsize=4096 blocks=402652928, imaxpct=5 = Sunit=0 swidth=0< Span style= "color: #000000;" > blksnaming =version 2 bsize=4096 Ascii-ci=0 ftype=0log =4096 blocks=196607, Version=2 = Sectsz=512 sunit=0 Blks, Lazy-count=1realtime =none extsz=4096 blocks=0, Rtextents=0
7, so the file system is built, and then select a mount point to hang on it, I hung up under the/home/data/
[Email protected] home]# mount/dev/sdb1/home/data/
8. Check if the mount is successful
[[email protected] home]# df-th/home/data/ file system type capacity used available% mount point/dev/sdb1 xfs 1.7T 34M 1.7T 1%/home/data
9, modify the system configuration add the following line to/etc/fstab, let the system automatically mount after startup, otherwise it may fall
/DEV/SDB1 /home/data xfs defaults 0 0
Linux under disk partitioning, mounting