linux建分区以cylinder,cylinder是什么意思,linux fdisk 分区last cylinder是什么意思

Linux系统由于数据累计增长、前期存储规划不合理等诸多因素,出现存储不够用的情况时,此时就需要扩展逻辑分区或添加新的逻辑分区。下面介绍一下通过使用fdsik添加新的逻辑分区。

首先使用df命令检查文件系统的磁盘空间占用情况

[[email protected]~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup00-sda3

30G 2.4G 26G 9% /

/dev/sda1 99M 23M 71M 25% /boot

tmpfs 4.0G 0 4.0G 0% /dev/shm

You have new mail in /var/spool/mail/root

然后使用fdisk -l查看分区表信息

[[email protected]~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 5221 41833260 8e Linux LVM

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/dm-0: 32.3 GB, 32346472448 bytes

255 heads, 63 sectors/track, 3932 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 10.4 GB, 10468982784 bytes

255 heads, 63 sectors/track, 1272 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

fdisk命令参数介绍

p、打印分区表。

n、新建一个新分区。

d、删除一个分区。

m、输出菜单

q、退出不保存。

w、把分区写进分区表,保存并退出。

[[email protected]~]# fdisk /dev/sdb

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

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

The number of cylinders for this disk is set to 2610.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

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

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

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 or +size or +sizeM or +sizeK (1-2610, default 2610):

Using default value 2610

Command (m for help): p

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 2610 20964793+ 83 Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[[email protected]~]# fdisk -l /dev/sdb

Disk /dev/sdb: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 2610 20964793+ 83 Linux

使用 mkfs.ext4 命令格式化磁盘成格式化成ext4各式的文件系统。

[[email protected]~]# mkfs.ext4 /dev/sdb1

mke4fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

1310720 inodes, 5241198 blocks

262059 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

160 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

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or

180 days, whichever comes first. Use tune4fs -c or -i to override.

系统启动时自动挂载/dev/sdb1,编辑/etc/fstab文件,指定挂载目录为/u02

[[email protected]~]# vi /etc/fstab

/dev/VolGroup00/sda3 / ext3 defaults 1 1

/dev/sdb1 /u02 ext4 defaults 1 2

LABEL=/boot /boot ext3 defaults 1 2

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

/dev/VolGroup00/sda4 swap swap defaults 0 0

~

[[email protected]~]# cd /

[[email protected]/]# mkdir u02

[[email protected]/]# mount -a

[[email protected]/]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup00-sda3

30G 2.4G 26G 9% /

/dev/sda1 99M 23M 71M 25% /boot

tmpfs 4.0G 0 4.0G 0% /dev/shm

/dev/sdb1 20G 172M 19G 1% /u02

[[email protected]/]#

下面来看看虚拟上Linux的添加新的逻辑分区的步骤,其实操作是一样的,只是顺带介绍一下虚拟机如何添加硬盘

[[email protected]_server ~]# fdisk -l

Disk /dev/sda: 584.6 GB, 584646328320 bytes

255 heads, 63 sectors/track, 71079 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 19441 156151808 83 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 19441 44937 204796672 83 Linux

Partition 2 does not end on cylinder boundary.

/dev/sda3 44937 57685 102398336 83 Linux

Partition 3 does not end on cylinder boundary.

/dev/sda4 57685 71080 107595584 5 Extended

Partition 4 does not end on cylinder boundary.

/dev/sda5 57685 70433 102398336 83 Linux

/dev/sda6 70433 70949 4144768 82 Linux swap

/dev/sda7 70949 71080 1052288 83 Linux

Disk /dev/sdb: 146.1 GB, 146156158976 bytes

2 heads, 24 sectors/track, 5947109 cylinders

Units = cylinders of 48 * 512 = 24576 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 3 5947064 142729472 83 Linux

[[email protected]_server ~]#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值