ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux下磁盘分区的案例

linux下磁盘分区的案例

原创 Linux操作系统 作者:shiyihai 时间:2007-10-18 16:39:17 0 删除 编辑

下面是一个linux下磁盘分区的案例,这里只贴出来其中的操作过程,供大家学习!

[root@portal3115 ~]# fdisk -l
bash: fdisk: command not found
[root@portal3115 ~]# /sbin/fdisk -l

[@more@]

Disk /dev/cciss/c0d0: 291.3 GB, 291331192320 bytes
255 heads, 63 sectors/track, 35419 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 13 104391 83 Linux
/dev/cciss/c0d0p2 14 267 2040255 82 Linux swap
/dev/cciss/c0d0p3 268 5379 41062140 83 Linux
/dev/cciss/c0d0p4 5380 35419 241296300 5 Extended
/dev/cciss/c0d0p5 5380 7989 20964793+ 83 Linux
/dev/cciss/c0d0p6 7990 9294 10482381 83 Linux
/dev/cciss/c0d0p7 9295 15374 48837568+ 83 Linux
/dev/cciss/c0d0p8 15375 21600 50010313+ 83 Linux
/dev/cciss/c0d0p9 21601 26734 41238823+ 83 Linux
/dev/cciss/c0d0p10 26735 29343 20956761 83 Linux

Disk /dev/sda: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 19581 157284351 5 Extended
[root@portal3115 ~]#
[root@portal3115 ~]# /sbin/fdisk /dev/sda

The number of cylinders for this disk is set to 19581.
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)

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):
[root@portal3115 ~]# /sbin/fdisk -l

Disk /dev/cciss/c0d0: 291.3 GB, 291331192320 bytes
255 heads, 63 sectors/track, 35419 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 13 104391 83 Linux
/dev/cciss/c0d0p2 14 267 2040255 82 Linux swap
/dev/cciss/c0d0p3 268 5379 41062140 83 Linux
/dev/cciss/c0d0p4 5380 35419 241296300 5 Extended
/dev/cciss/c0d0p5 5380 7989 20964793+ 83 Linux
/dev/cciss/c0d0p6 7990 9294 10482381 83 Linux
/dev/cciss/c0d0p7 9295 15374 48837568+ 83 Linux
/dev/cciss/c0d0p8 15375 21600 50010313+ 83 Linux
/dev/cciss/c0d0p9 21601 26734 41238823+ 83 Linux
/dev/cciss/c0d0p10 26735 29343 20956761 83 Linux

Disk /dev/sda: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 19581 157284351 5 Extended
[root@portal3115 ~]# /sbin/fdisk /dev/sda

The number of cylinders for this disk is set to 19581.
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)

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
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 1
Partition 1 is already defined. Delete it before re-adding it.

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 2
No free sectors available

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 3
No free sectors available

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 4
No free sectors available

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1-19581, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19581, default 19581): +51200M

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/sda: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 19581 157284351 5 Extended
/dev/sda5 1 6226 50010282 83 Linux

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (6227-19581, default 6227):
Using default value 6227
Last cylinder or +size or +sizeM or +sizeK (6227-19581, default 19581): +51200M

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/sda: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 19581 157284351 5 Extended
/dev/sda5 1 6226 50010282 83 Linux
/dev/sda6 6227 12452 50010313+ 83 Linux

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (12453-19581, default 12453):
Using default value 12453
Last cylinder or +size or +sizeM or +sizeK (12453-19581, default 19581): +51200M

Command (m for help): p

Disk /dev/sda: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 19581 157284351 5 Extended
/dev/sda5 1 6226 50010282 83 Linux
/dev/sda6 6227 12452 50010313+ 83 Linux
/dev/sda7 12453 18678 50010313+ 83 Linux

[root@portal3115 ~]# mkfs.ext3 /dev/sda5
bash: mkfs.ext3: command not found
[root@portal3115 ~]# /sbin/mk
mkbootdisk mke2fs mkfs.cramfs mkfs.ext3 mkfs.vfat mkswap
mkdosfs mkfs mkfs.ext2 mkfs.msdos mkinitrd mkzonedb
[root@portal3115 ~]# /sbin/mkfs.ext3 /dev/sda5
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
6258688 inodes, 12502570 blocks
625128 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=12582912
382 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Writing inode tables: done
Creating journal (8192 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 tune2fs -c or -i to override.
[root@portal3115 ~]#
[root@portal3115 /]# mkdir sda1
[root@portal3115 /]# mkdir sda2
[root@portal3115 /]# mkdir sda3
mount /dev/sda5 /sda1/ora10g
mount /dev/sda6 /sda2/ora10g
mount /dev/sda7 /sda3/ora10g
umount /dev/sda5 /sda1
umount /dev/sda6 /sda2
umount -fl /dev/sda7 /sda3
注意:这里是umount而不是unmount,带参数fl强制卸载。
vi /etc/fstab
chown -R bocbi.dba /sda1/ora10g
chown -R bocbi.dba /sda2/ora10g
chown -R bocbi.dba /sda3/ora10g

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/38542/viewspace-977455/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    235
  • 访问量
    1667394