1.查看分区挂载状态
tianyangtax@iZ25tc8mln7Z:~$ df -lh Filesystem Size Used Avail Use% Mounted on udev 3.9G 4.0K 3.9G 1% /dev tmpfs 799M 392K 799M 1% /run /dev/xvda1 20G 2.0G 17G 11% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 3.9G 0 3.9G 0% /run/shm none 100M 0 100M 0% /run/user
2.查看硬盘状态
tianyangtax@iZ25tc8mln7Z:/$ sudo fdisk -l Disk /dev/xvda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x000da36d Device Boot Start End Blocks Id System /dev/xvda1 * 2048 41940991 20969472 83 Linux Disk /dev/xvdb: 214.7 GB, 214748364800 bytes 255 heads, 63 sectors/track, 26108 cylinders, total 419430400 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 identifier: 0x00000000 Disk /dev/xvdb doesn't contain a valid partition table
3.硬盘分区
tianyangtax@iZ25tc8mln7Z:/$ sudo fdisk /dev/xvdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x5c4c4e94. 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 Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-419430399, default 2048): Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): Using default value 419430399 Command (m for help): wq The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
4.重新查看硬盘状态,可以发现 /dev/xvdb1 分区已经建立
tianyangtax@iZ25tc8mln7Z:/$ sudo fdisk -l Disk /dev/xvda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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 identifier: 0x000da36d Device Boot Start End Blocks Id System /dev/xvda1 * 2048 41940991 20969472 83 Linux Disk /dev/xvdb: 214.7 GB, 214748364800 bytes 86 heads, 25 sectors/track, 195083 cylinders, total 419430400 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 identifier: 0x5c4c4e94 Device Boot Start End Blocks Id System /dev/xvdb1 2048 419430399 209714176 83 Linux
5.格式化分区
tianyangtax@iZ25tc8mln7Z:/$ sudo mkfs.ext4 /dev/xvdb1 mke2fs 1.42.9 (4-Feb-2014) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 13107200 inodes, 52428544 blocks 2621427 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 1600 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
6.查看分区UUID
tianyangtax@iZ25tc8mln7Z:/$ sudo blkid /dev/xvda1: UUID="af414ad8-9936-46cd-b074-528854656fcd" TYPE="ext4" /dev/xvdb1: UUID="4d1d7add-8b92-4eb9-9c18-d81ef2b339d7" TYPE="ext4"
7.编辑 /etc/fstab 挂载数据分区至 /mnt
tianyangtax@iZ25tc8mln7Z:/$ sudo vim /etc/fstab tianyangtax@iZ25tc8mln7Z:/$ sudo cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # #UUID=af414ad8-9936-46cd-b074-528854656fcd / ext4 errors=remount-ro 0 1 # /mnt was on /dev/xvdb1 by royakon at 2016-01-11 20:43 UUID=4d1d7add-8b92-4eb9-9c18-d81ef2b339d7 /mnt ext4 defaults 0 0
8.重启后重新查看分区状态,可见数据云盘挂载成功.
tianyangtax@iZ25tc8mln7Z:~$ df -lh Filesystem Size Used Avail Use% Mounted on udev 3.9G 4.0K 3.9G 1% /dev tmpfs 799M 392K 799M 1% /run /dev/xvda1 20G 2.0G 17G 11% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 3.9G 0 3.9G 0% /run/shm none 100M 0 100M 0% /run/user /dev/xvdb1 197G 60M 187G 1% /mnt
Categories: ubuntu