jiangtie 2019-11-03
大于2T分区
Linux-GCAPP1:/ # parted /dev/sdb GNU Parted 2.3 Using /dev/sdb Welcome to GNU Parted! Type ‘help‘ to view a list of commands. (parted) mklabel gpt (parted) print Model: DGC VRAID (scsi) Disk /dev/sdb: 2199GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags (parted) mkpart primary 0 2199GB Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? Ignore (parted) print Model: DGC VRAID (scsi) Disk /dev/sdb: 2199GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 17.4kB 2199GB 2199GB primary (parted) quit Information: You may need to update /etc/fstab. linux-GCAPP1:/ # ll /dev |grep sdb brw-rw---- 1 root disk 8, 16 Jan 6 17:58 sdb brw-rw---- 1 root disk 8, 17 Jan 6 17:58 sdb1 linux-GCAPP1:/ # mkfs.ext3 /dev/sdb1
小于2T分区
linux-GCAPP1:~ # fdisk /dev/sdc Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x6353d1d5. 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) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4, default 1): Using default value 1 First sector (2048-1677721599, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-1677721599, default 1677721599): Using default value 1677721599 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. linux-GCAPP1:~ # ll /dev |grep sdc brw-rw---- 1 root disk 8, 32 Jan 6 18:04 sdc brw-rw---- 1 root disk 8, 33 Jan 6 18:04 sdc1 linux-GCAPP1:~ # mkfs.ext3 /dev/sdc1 mke2fs 1.41.9 (22-Aug-2009) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 52428800 inodes, 209714944 blocks 10485747 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 6400 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, 71663616, 78675968, 102400000 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 32 mounts or
实战中的应用
1、空间的划分(在A机器上操作) ①确认存储设备: 通过fdisk –l可以查看,服务器硬件工程师会提供设备的命名如:/dev/sddlmaa ②分区: 存储空间在2T以下使用fdisk,2T以上使用parted sjck-1:~ # parted /dev/sddlmaa GNU Parted 2.3 Using /dev/sddlmaa Welcome to GNU Parted! Type ‘help‘ to view a list of commands. (parted) mklabel gpt Warning: The existing disk label on /dev/sddlmaa will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) mkpart primary 0 204800 Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? Ignore (parted) mkpart primary 204800 3276800 (parted) mkpart primary 3276800 5324800 (parted) quit mkfs.ext3 /dev/sddlmaa1 mkfs.ext3 /dev/sddlmaa2 mkfs.ext3 /dev/sddlmaa3 ③重启A机器 ④创建目录/mysqldb 、/dbdata、/dbdatabk mkdir /mysqldb mkdir /dbdata mkdir /dbdatabk ⑤磁盘挂载 mount /dev/sddlmaa1 /mysqldb mount /dev/sddlmaa2 /dbdata mount /dev/sddlmaa3 /dbdatabk 查看挂载情况:df –h /dev/sddlmaa1 188G 799M 178G 1% /mysqldb /dev/sddlmaa2 2.8T 253G 2.4T 10% /dbdata /dev/sddlmaa3 1.9T 7.5G 1.8T 1% /dbdatabk ⑥卸载存储挂载 umount /mysqldb umount /dbdata umount /dbdatabk 查看挂载是否卸载:df –h 不会出现挂载信息 2、B机器设置 ①创建目录/mysqldb 、/dbdata、/dbdatabk mkdir /mysqldb mkdir /dbdata mkdir /dbdatabk ②磁盘挂载 mount /dev/sddlmaa1 /mysqldb mount /dev/sddlmaa2 /dbdata mount /dev/sddlmaa3 /dbdatabk 查看挂载情况:df –h /dev/sddlmaa1 188G 799M 178G 1% /mysqldb /dev/sddlmaa2 2.8T 253G 2.4T 10% /dbdata /dev/sddlmaa3 1.9T 7.5G 1.8T 1% /dbdatabk ③卸载存储挂载 umount /mysqldb umount /dbdata umount /dbdatabk 查看挂载是否卸载:df –h 不会出现挂载信息