园区vm新机器添加挂载硬盘:
vm 硬件已添加硬盘,未格式化;
1、 root@test:~# fdisk -l 查看
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 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 identifier: 0x0005ffb6
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 83884031 41691137 5 Extended
/dev/sda5 501760 83884031 41691136 8e Linux LVM
Disk /dev/sdb: 536.9 GB, 536870912000 bytes 大硬盘未分区
255 heads, 63 sectors/track, 65270 cylinders, total 1048576000 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/sdb doesn't contain a valid partition table
Disk /dev/mapper/ubuntu14--vg-root: 38.4 GB, 38394658816 bytes
255 heads, 63 sectors/track, 4667 cylinders, total 74989568 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/mapper/ubuntu14--vg-root doesn't contain a valid partition table
Disk /dev/mapper/ubuntu14--vg-swap_1: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders, total 8388608 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/mapper/ubuntu14--vg-swap_1 doesn't contain a valid partition table
root@-o:~#
2、进行分区
root@test-github01wangxiniu-542-ubu1404-v-o:~# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf7a74664.
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): p 查看硬盘
Disk /dev/sdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders, total 1048576000 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: 0xf7a74664
Device Boot Start End Blocks Id System 查看硬盘未分区
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-1048575999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1048575999, default 1048575999): 回车
Using default value 1048575999
Command (m for help): p
Disk /dev/sdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders, total 1048576000 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: 0xf7a74664
Device Boot Start End Blocks Id System
/dev/sdb1 2048 1048575999 524286976 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3、 进行格式化 ext4
root@-o:~# mkfs.ext4 -E lazy_itable_init=1 /dev/sda1
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
32768000 inodes, 131071744 blocks
6553587 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
4000 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done 回车
Writing superblocks and filesystem accounting information: done
创建挂载目录
root@o:~# mkdir /data
root@04-v-o:~# echo "/dev/sda1 /data ext4 defaults,noatime,nodiratime 0 0 ">> /etc/fstab 重启中 自动挂载
echo "/dev/vdb1 /var/log/docker ext4 defaults,noatime,nodiratime 0 0" >> /etc/fstab
mkfs -t ext4 /dev/vdb1
root@-v-o:~# mount -a 自动挂载
root@t-v-o:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu14--vg-root 36G 1.6G 32G 5% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 396M 516K 395M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda1 236M 36M 188M 16% /boot
/dev/sdb1 493G 70M 467G 1% /data
root@v-o:~# reboot 重启