linux建分区以cylinder,Linux添加新硬盘,fdisk新建分区

fdisk新建分区:[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x000e7df7

Device Boot      Start         End      Blocks  Id  System

/dev/sda1  *           1         511    4096000   83  Linux

Partition 1 does not end on cylinderboundary.

/dev/sda2             511        1020    4096000   83  Linux

Partition 2 does not end on cylinderboundary.

/dev/sda3            1020        1275    2048000   82  Linux swap / Solaris

/dev/sda4            1275        2611   10730496    5  Extended

/dev/sda5            1276        2611   10729472   83  Linux

Disk /dev/sdb: 21.5GB, 21474836480 bytes

255 heads, 63sectors/track, 2610 cylinders

Units = cylinders of16065 * 512 = 8225280 bytes

Sector size(logical/physical): 512 bytes / 512 bytes

I/O size(minimum/optimal): 512 bytes / 512 bytes

Disk identifier:0x00000000

[root@localhost ~]# fdisk /dev/sdb 开始分区

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

Building a new DOS disklabel with diskidentifier 0x6811b6b9.

Changes will remain in memory only, untilyou decide to write them.

After that, of course, the previous contentwon't be recoverable.

Warning: invalid flag 0x0000 of partitiontable 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated.It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').

Command (m for help): m #查看帮助

Command action

a   toggle a bootable flag

b   edit bsd disklabel

c   toggle the dos compatibilityflag

d   delete a partition

l   list known partition types

m   print this menu

n   add a new partition #添加一个新分区

o   create a new empty DOSpartition table

p   print the partition table #查看当前分区情况

q   quit without saving changes

s   create a new empty Sundisklabel

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 (expertsonly)

Command (m for help): n #添加一个新分区

Command action

e   extended

p   primary partition (1-4)

p #主分区

Partition number (1-4): 1 #分区号

First cylinder (1-2610, default 1): 1 #柱面

Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +4G #分配大小(不以柱面方式)

Command (m for help): p #查看一下

Disk /dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x6811b6b9

Device Boot      Start         End      Blocks  Id  System

/dev/sdb1               1         523    4200966   83  Linux成功!

Command (m for help): n #继续添加分区

Command action

e   extended

p   primary partition (1-4)

e #扩展分区

Partition number (1-4): 2 #分区号

First cylinder (524-2610, default 524): #默认起始柱面-回车

Using default value 524

Last cylinder, +cylinders or +size{K,M,G}(524-2610, default 2610): #默认结束柱面-回车

Using default value 2610

Command (m for help): p #查看一下

Disk /dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x6811b6b9

Device Boot      Start         End      Blocks  Id  System

/dev/sdb1               1         523    4200966   83  Linux

/dev/sdb2             524        2610   16763827+   5  Extended #扩展分区成功!

Command (m for help): n #继续分逻辑分区

Command action

l   logical (5 or over)

p   primary partition (1-4)

l #选逻辑分区

First cylinder (524-2610, default 524): #默认起始柱面-回车

Using default value 524

Last cylinder, +cylinders or +size{K,M,G}(524-2610, default 2610): #默认结束柱面-回车

Using default value 2610

Command (m for help): p #查看一下

Disk /dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x6811b6b9

Device Boot      Start         End      Blocks  Id  System

/dev/sdb1               1         523    4200966   83  Linux

/dev/sdb2             524        2610   16763827+   5  Extended

/dev/sdb5             524        2610   16763796   83  Linux #成功!

Command (m for help): w #保存

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]# partprobe #重新读取分区表信息

[root@localhost ~]# mkfs -t ext4 /dev/sdb1 #格式化

[root@localhost ~]# mkdir /disk1 /disk5 #创建两个挂载点

[root@localhost ~]# mount /dev/sdb1 /disk1 #挂载

[root@localhost ~]# mount /dev/sdb5 /disk5 #挂载

开机自动挂载:[root@localhost ~]# dumpe2fs /dev/sdb1 #查看分区UUID

dumpe2fs 1.41.12 (17-May-2010)

Filesystem volume name:   

Last mounted on:          

Filesystem UUID:          968fc705-506d-4977-a469-32be93467a97

[root@localhost ~]# dumpe2fs /dev/sdb5 |more

dumpe2fs 1.41.12 (17-May-2010)

Filesystem volume name:   

Last mounted on:          

Filesystem UUID:          987dd564-5d12-4d0b-9706-c5bdf860e927

#

# /etc/fstab

# Created by anaconda on Wed Jan  6 23:44:24 2016

#

# Accessible filesystems, by reference, aremaintained under '/dev/disk'

# See man pages fstab(5), findfs(8),mount(8) and/or blkid(8) for more info

[root@localhost ~]# vim /etc/fstab

#

UUID=b943e84c-2d74-4098-85ed-096353ff1815/             ext4   defaults        1 1

UUID=4f4b30ad-e3e4-45c3-bb60-6f6c0dd8cd62/boot         ext4    defaults        1 2

UUID=41c2e8a6-10f0-4a10-b1a8-fe8db32ce708/home         ext4   defaults        1 2

UUID=289dd6bc-687b-48e9-9d10-e34aa360228fswap         swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

UUID=968fc705-506d-4977-a469-32be93467a97/disk1        ext4    defaults        12

/dev/sdb5               /disk5                        ext4    defaults        1 2

[root@localhost ~]# mount –a #测试一下,所有分区按照配置文件/etc/fstab 重新挂载一次

/etc/fstab

文件错误时修复:[root@localhost ~]# mount -o remount,rw / #重新将/挂载成读写权限,只用于

/etc/fstab

文件错误修复时。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值