Disk mounting in Linux and disk mounting in Linux
The company's hard disk is not enough. A new storage needs to be mounted to the current system. I won't talk about the previous steps. O & M is all done. It is nothing more than a set of hardware and networks. Here I will only talk about how to mount it in Linux after it is assigned to me.
The procedure is as follows:
1. Check whether the resource has been allocated.
[Root @ localhost home] # fdisk-l Disk/dev/sda: 64.4 GB, 64424509440 bytes, 125829120 slice Units = slice of 1*512 = 512 bytes slice size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal ): 512 bytes/512 bytes disk tag type: dos disk identifier: 0x000a47ad device Boot Start End Blocks Id System/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 125829119 62401536 8e Linux LVM Disk/dev/sdb: 1649.3 GB, 1649267441664 bytes, 3221225472 slice Units = slice of 1*512 = 512 bytes slice size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal ): 512 bytes/512 bytes
2. A disk is found in the/dev/sdb path. Run the fdisk command to create a partition.
[root@localhost home]# fdisk /dev/sdb
The fdisk command is as follows:
Command (enter m for help ): m command operation a toggle a bootable flag B edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
3. Create a partition first (because I want to store large database files, the logic is all one partition)
Command (enter m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p ): using default response p Partition Number (1-4, default value: 1): Start sector (2048-3221225471, default value: 2048): The default value is 2048 Last sector, + sector or + size {K, M, G} (2048-3221225471, 3221225471 by default): Set Partition 1 to Linux by default, and set the size to 3221225471 TiB.
4. Last Save the partition
Command (enter m for help): wThe partition table has been altered! Calling ioctl () to re-read partition table. The disk is being synchronized.
5. Run the fdisk-l command to check whether there are partitions.
Disk/dev/sdb: 1649.3 GB, 1649267441664 bytes, 3221225472 slice Units = sector of 1*512 = 512 bytes slice size (logical/physical ): 512 bytes/512 bytes I/O size (minimum/optimum): 512 bytes/512 bytes disk tag type: dos disk identifier: 0xe0bc0098 device Boot Start End Blocks Id System/dev/sdb1 2048 3221225471 1610611712 83 Linux
6. format the partition and create a file system.
[root@localhost home]# mkfs.xfs -f /dev/sdsda sda1 sda2 sdb sdb1 [root@localhost home]# mkfs.xfs -f /dev/sdb1meta-data=/dev/sdb1 isize=256 agcount=4, agsize=100663232 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0data = bsize=4096 blocks=402652928, imaxpct=5 = sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=0log =internal log bsize=4096 blocks=196607, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0
7. In this way, the file system is ready, and you can select a mount point to mount it. I mounted it to/home/data /.
[root@localhost home]# mount /dev/sdb1 /home/data/
8. Check whether the mounting is successful.
[Root @ localhost home] # df-TH/home/data/file system type capacity in use available % mount point/dev/sdb1 xfs 1.7 T 34 M 1.7 T 1%/home/ data
9. modify the system configuration and add the following lines to/etc/fstab to enable automatic mounting after the system is started. Otherwise, it may fall.
/dev/sdb1 /home/data xfs defaults 0 0