1. View the space you want to mount
1[Email protected] ~]# fdisk-L2 3Disk/dev/vda:42.9GB,42949672960bytes4 255Heads theSectors/track,5221Cylinders5Units = Cylinders of16065* +=8225280bytes6Sector size (logical/physical): +Bytes/ +bytes7I/O size (minimum/optimal): +Bytes/ +bytes8Disk identifier:0x000531569 Ten Device Boot Start End Blocks Id System One/DEV/VDA1 *1 5222 41942016 theLinux A -DISK/DEV/VDB:107.4GB,107374182400bytes - -Heads theSectors/track,208050Cylinders theUnits = Cylinders of1008* +=516096bytes -Sector size (logical/physical): +Bytes/ +bytes -I/O size (minimum/optimal): +Bytes/ +bytes -Disk identifier:0x00000000
2. Adding partitions
1[Email protected] ~]# fdisk/dev/VDB2 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel3Building a new DOS disklabel with disk identifier0x65cce73f.4Changes'll remaininchMemory only,untilYou decide toWritethem.5After that, of course, the previous content won't be recoverable.6 7Warning:invalid Flag0x0000of partition Table4would be corrected byW(rite)8 9Warning:dos-compatible mode is deprecated. It's strongly recommended toTenSwitch off the mode command'C') and change display units to OneSectors (Command'u'). A -Command (M forHelp ): N - Command Action the e Extended -P Primary partition (1-4) - 1 -Invalid Partition number forType '1' + Command Action - e Extended +P Primary partition (1-4) A P atPartition Number (1-4):1 -First Cylinder (1-208050, default1): -Using Default Value1 -Last cylinder, +cylinders or +size{k,m,g} (1-208050, default208050): -Using Default Value208050 - inCommand (M forHelp ): Wq -The partition table has been altered! to +Calling IOCTL () to re-read partition table. -Syncing disks.
FDISK corresponding partition successively input n, p, 1, Wq
3. View current partition status
1[Email protected] ~]# fdisk-L2 3Disk/dev/vda:42.9GB,42949672960bytes4 255Heads theSectors/track,5221Cylinders5Units = Cylinders of16065* +=8225280bytes6Sector size (logical/physical): +Bytes/ +bytes7I/O size (minimum/optimal): +Bytes/ +bytes8Disk identifier:0x000531569 Ten Device Boot Start End Blocks Id System One/DEV/VDA1 *1 5222 41942016 theLinux A -DISK/DEV/VDB:107.4GB,107374182400bytes - -Heads theSectors/track,208050Cylinders theUnits = Cylinders of1008* +=516096bytes -Sector size (logical/physical): +Bytes/ +bytes -I/O size (minimum/optimal): +Bytes/ +bytes -Disk identifier:0x65cce73f + - Device Boot Start End Blocks Id System +/dev/vdb11 208050 104857168+ theLinux
4. Formatting partitions
1[Email protected] ~]# mkfs.ext3/dev/VDB12Mke2fs1.41. A( --may- .)3Filesystem label=4 OS Type:linux5Block size=4096(log=2)6Fragment size=4096(log=2)7Stride=0blocks, Stripe width=0blocks8 6553600Inodes,26214292blocks9 1310714Blocks (5.00%) reserved forThe Super UserTenFirst Data block=0 OneMaximum filesystem blocks=4294967296 A -Blockgroups - 32768Blocks per group,32768fragments per group - 8192inodes per group the superblock backups stored on blocks: - 32768,98304,163840,229376,294912,819200,884736,1605632,2654208, - 4096000,7962624,11239424,20480000,23887872 - +Writing inode tables: Done -Creating Journal (32768Blocks): Done +Writing Superblocks and filesystem accounting Information: Done A atThis filesystem'll be automatically checked every toMounts or - theDays, whichever comes first. Use Tune2fs-c or-i to override.
5. Mount the hard drive
1 #创建要挂载的目录2 mkdir/Data3 4 #挂载分区5 Mount/dev/vdb1/data/6 7 #写入分区信息8 Echo "/dev/vdb1/data ext3 defaults 0 0">>/etc/Fstab9 Ten #查看分许信息 One Cat/etc/fstab
Linux Operations notes-Cloud server data disk mount