阿里雲CentOS資料盤掛載
阿新 • • 發佈:2022-03-30
1. df -h
[root@iZuf66gcq71y5hlfv02w6aZ ~]# yum install -y parted [root@iZuf66gcq71y5hlfv02w6aZ ~]# yum install -y e2fsprogs
[root@iZuf66gcq71y5hlfv02w6aZ ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs3.9G 652K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 3.4G 35G 9% / tmpfs 783M 0 783M 0% /run/user/0 [root@iZuf66gcq71y5hlfv02w6aZ ~]# fdisk -l Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000c7bcb Device Boot Start End Blocks Id System /dev/vda1 * 2048 83886046 41941999+ 83 Linux Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units= sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes [root@iZuf66gcq71y5hlfv02w6aZ ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x5181edbf. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-209715199, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): Using default value 209715199 Partition 1 of type Linux and of size 100 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@iZuf66gcq71y5hlfv02w6aZ ~]# fdisk -lu /dev/vdb Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x5181edbf Device Boot Start End Blocks Id System /dev/vdb1 2048 209715199 104856576 83 Linux [root@iZuf66gcq71y5hlfv02w6aZ ~]# mkfs -t ext4 /dev/vdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 6553600 inodes, 26214144 blocks 1310707 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2174746624 800 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 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done [root@iZuf66gcq71y5hlfv02w6aZ ~]# mkfs -t xfs /dev/vdb1 mkfs.xfs: /dev/vdb1 appears to contain an existing filesystem (ext4). mkfs.xfs: Use the -f option to force overwrite. [root@iZuf66gcq71y5hlfv02w6aZ ~]# cp /etc/fstab /etc/fstab.bak [root@iZuf66gcq71y5hlfv02w6aZ ~]# echo `blkid /dev/vdb1 | awk '{print $2}' | sed 's/\"//g'` /mnt ext4 defaults 0 0 >> /etc/fstab [root@iZuf66gcq71y5hlfv02w6aZ ~]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Tue Feb 8 06:52:06 2022 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=42616xxxxxxxxxxxxxxxxxxxxxxxxxd9e935 / ext4 defaults 1 1 UUID=5d371xxxxxxxxxxxxxxxxxxxxxxxxxx12055 /mnt ext4 defaults 0 0 [root@iZuf66gcq71y5hlfv02w6aZ ~]# mount -a [root@iZuf66gcq71y5hlfv02w6aZ ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 692K 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/vda1 40G 3.4G 35G 9% / tmpfs 783M 0 783M 0% /run/user/0 /dev/vdb1 99G 61M 94G 1% /mnt [root@iZuf66gcq71y5hlfv02w6aZ ~]#
https://help.aliyun.com/document_detail/25426.html#section-wq3-ius-0f0