fdisk disk partition, format and automatically mount the boot

First, the pre-state disk partitions View

]# fdisk -l

Disk /dev/vda:107.4 GB, 107374182400 bytes, sectors 209 715 200
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x000b4a3a

设备 Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux
/dev/vda2 1026048 209715199 104344576 8e Linux LVM

Disk /dev/vdb:214.7 GB, 214748364800 bytes, sectors 419 430 400
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte

Two, fdisk formatted disk / sev / sdb is a disk

] # Fdisk / dev / vdb
Welcome fdisk (util-linux 2.23.2).

Change will stay in memory until you decide to write the changes to disk.
Please think twice before using the write command.

Device does not contain a recognized partition table
using the disk identifier 0x8a058557 create a new DOS disk label.

命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (input m to get help): n-
the Partition type:
P Primary (Primary 0, 0 Extended, Free. 4)
E Extended
the Select (default P):
the Using Response P default
partition number (1-4, default 1):
Starting fan region (2048-419430399 defaults to 2048):
the default value 2048
Last sector, sector + or + size {K, M, G} (2048-419430399, default 419 430 399):
the default value 419 430 399
zone 1 Linux has been set to the type, size to 200 GiB

Command (input m to get help): p

Disk /dev/vdb:214.7 GB, 214748364800 bytes, sectors 419 430 400
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x8a058557

设备 Boot Start End Blocks Id System
/dev/vdb1 2048 419430399 209714176 83 Linux

Command (input m to get help): W
of The Partition Table Altered has been!

Calling ioctl () to re-read partition table.
Syncing disks.

Third, the state of the disk partitions View

]# fdisk -l

Disk /dev/vda:107.4 GB, 107374182400 bytes, sectors 209 715 200
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x000b4a3a

设备 Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux
/dev/vda2 1026048 209715199 104344576 8e Linux LVM

Disk /dev/vdb:214.7 GB, 214748364800 bytes, sectors 419 430 400
Units = sectors of 1 * 512 = 512 bytes
sector size (logical / physical): 512 byte / 512 byte
I / O size (minimum / best): 512 byte / 512 byte
disk label type: DOS
disk identifier: 0x8a058557

设备 Boot Start End Blocks Id System
/dev/vdb1 2048 419430399 209714176 83 Linux

Fourth, the disk is formatted as ext4 file format disk

] # Mkfs.ext4 / dev / vdb1
the mke2fs 1.42.9 (-On Dec-28, 2013)
file system label =
the OS type: the Linux
block size = 4096 (log = 2)
block size = 4096 (log = 2)
Stride = 0 blocks, blocks 0 Stripe width =
13.1072 million of inodes, 52,428,544 blocks
2621427 blocks (5.00%) The Super User Reserved for
a first data block 0 =
the Maximum filesystem blocks = 2199912448
1600 block Groups
32768 blocks per Group, 32768 Group fragments per
8192 of inodes per Group
of Superblock Backups Stored ON Blocks:
32768, 98304, 163840, 229376, 294 912, 819200, 884 736, 1,605,632, 2,654,208,
4096000, 7962624, 11,239,424, 20480000, 23,887,872

Allocating group tables: completed
is being written inode table: complete
Creating journal (32768 blocks): complete
Writing superblocks and filesystem accounting information: complete

V. mount / dev / vdb1 under / data

]# cd /

/]# mkdir data

/]# mount /dev/vdb1 /data

] # Df -h
file system capacity has been available with a mount point%
/ dev / Mapper / 6.0G Cl 92G-86G the root. 7% /
devtmpfs 16G 16G 0 0% / dev
tmpfs 16G 16G. 1% 84K / dev / SHM
16G 16G. 1% 9.3M tmpfs / RUN
tmpfs 16G 16G 0 0% / SYS / FS / a cgroup
/ dev / 303M 40% Vdal 497m 195m / Boot
tmpfs 3.2G 3.2G. 1% 16K / RUN / User / 989
tmpfs 3.2G 0 0% 3.2G / RUN / User / 0
/ dev / 187g. 1% vdb1 197G 61M / Data

Sixth, set the boot automatically mount

]# blkid /dev/vdb1
/dev/vdb1: UUID="bc972244-2f68-4ba9-af62-6f257c8d2d4a" TYPE="ext4"

] # Vi / etc / fstab (Description: edit the file / etc / fstab, at one line end of the file "UUID = bc972244-2f68-4ba9-af62-6f257c8d2d4a / data ext4 defaults 0 0")

Seven restart, view automatically mount successful
] # reboot

] #
] #
] #
] #
] # DF -H
file system capacity has been available with a mount point%
/ dev / Mapper / 6.0G Cl 92G-86G the root. 7% /
devtmpfs 16G 16G 0 0% / dev
tmpfs 16G 16G. 1% 84K / dev / SHM
tmpfs 9.3M 16G 16G. 1% / RUN
tmpfs 16G 16G 0 0% / SYS / FS / a cgroup
/ dev / 187g. 1% vdb1 197G 61M / Data
/ dev / 303M 40% Vdal 497m 195m / Boot
tmpfs 3.2G 3.2G. 1% 16K / RUN / User / 989
tmpfs 3.2G 3.2G 0 0% / RUN / User / 0

Guess you like

Origin blog.51cto.com/7136516/2461827