您的位置:首页 > 其它

ubuntu 增加硬盘分区

2016-08-17 11:00 323 查看
#fdisk -l 查看磁盘信息

Disk /dev/vda: 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: 0x0004a2cd

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 41940991 20969472 83 Linux

Disk /dev/vdb: 4296 MB, 4296015872 bytes

16 heads, 63 sectors/track, 8324 cylinders, total 8390656 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

Device Boot Start End Blocks Id System

/dev/vdb1 63 8390655 4195296+ 82 Linux swap / Solaris

Disk /dev/vdc: 214.7 GB, 214748364800 bytes

16 heads, 63 sectors/track, 416101 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/vdc doesn't contain a valid partition table

# fdisk /dev/vdc 添加硬盘

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x4c58cda0.

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): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

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 (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-419430399, default 2048): 回车

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399):
回车

Using default value 419430399

Command (m for help): w 保存

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

# fdisk -l 查看磁盘信息

Disk /dev/vda: 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: 0x0004a2cd

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 41940991 20969472 83 Linux

Disk /dev/vdb: 4296 MB, 4296015872 bytes

16 heads, 63 sectors/track, 8324 cylinders, total 8390656 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

Device Boot Start End Blocks Id System

/dev/vdb1 63 8390655 4195296+ 82 Linux swap / Solaris

Disk /dev/vdc: 214.7 GB, 214748364800 bytes

10 heads, 25 sectors/track, 1677721 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: 0x4c58cda0

Device Boot Start End Blocks Id System

/dev/vdc1 2048 419430399 209714176 83 Linux

# mkfs -t ext4 /dev/sdc1 #格式化磁盘

mke2fs 1.42.9 (4-Feb-2014)

Could not stat /dev/sdc1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?

root@JSSH2ZABBIX0132003:~# mkfs -t ext4 /dev/vdc1

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

# mkdir /data 创建data目录

#mount /dev/vdc1 /data 挂载磁盘

#vi /etc/fstab 编辑文件 开机自动加载

/dev/vdc1 /data ext4 defaults, 0 1

# df -h 查看分区信息

Filesystem Size Used Avail Use% Mounted on

/dev/vda1 20G 11G 8.6G 54% /

none 4.0K 0 4.0K 0% /sys/fs/cgroup

udev 2.0G 4.0K 2.0G 1% /dev

tmpfs 396M 440K 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/vdc1 197G 60M 187G 1% /data
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: