|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
; ^ e' Z5 @6 K: T2 r or: fdisk /dev/sdc (for the third SCSI disk)
+ X. Z1 ?; z) g& I; C or: fdisk /dev/eda (for the first PS/2 ESDI drive)* T' u% r% U9 G* M) ]. M/ U& q; K1 j
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
{5 K* H* @2 f- r ...$ x: n7 V+ z, s' C4 a" s! S8 D
- df -k
9 q @( ~" S" Q# Y, `5 G8 i - df -lh* M1 e8 z3 h# m4 w- r: x" Z
- 查看有几块硬盘:fdisk -l8 Q1 w ]" O5 M, [8 \- w7 E/ v
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- j8 m0 f& s+ n/ ` /dev/sda3 3723848 705968 2828716 20% /
4 Q4 r* l& P% ~! ^2 O) a /dev/sda1 101089 9274 86596 10% /boot- [9 j9 V/ o9 }8 E5 E( h# j
none 14520 0 14520 0% /dev/shm
0 ]. s& S: t* x% b 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
! H) r5 {8 y2 F8 H" gDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel1 ? i. L$ h# A8 M' r2 J; T
Building a new DOS disklabel. Changes will remain in memory only,+ o* f6 ]" r$ T8 {; g! r# d; p
until you decide to write them. After that, of course, the previous- A4 D6 h6 S; ~, X% n
content won't be recoverable.2 \. d- _1 g$ ~& T! i; z6 f
The number of cylinders for this disk is set to 8322.
* z8 b7 @( Q+ q/ T There is nothing wrong with that, but this is larger than 1024,
0 l2 D, R9 u% H5 a+ I- r and could in certain setups cause problems with:
/ {" X7 c+ D z" {* d* { 1) software that runs at boot time (e.g., old versions of LILO)- t& {" i* o+ s |
2) booting and partitioning software from other OSs7 k5 C2 F, |( U2 V
(e.g., DOS FDISK, OS/2 FDISK)
/ z" x0 C& E" |, o Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)4 O) i% V+ I k4 V
Command (m for help): p
! d2 G2 `3 [" q+ B6 r& j: J Disk /dev/hda: 4294 MB, 4294967296 bytes
; q" O, j0 y; [ 16 heads, 63 sectors/track, 8322 cylinders% b2 |# Z1 b# I& E
Units = cylinders of 1008 * 512 = 516096 bytes
# z2 |4 \% w2 y3 B Device Boot Start End Blocks Id System# b0 j0 b8 P. {6 H ?5 Y
Command (m for help): m8 Z, G* U; d# |" `# i
Command action
8 ?0 L4 \3 p$ ?6 g+ K a toggle a bootable flag
$ x8 R g* ^/ k1 t: x9 `1 q b edit bsd disklabel' V7 A3 y9 \9 j0 _4 m7 k
c toggle the dos compatibility flag0 G: M. P/ t1 t
d delete a partition# i; K/ Z4 p. U1 S3 W
l list known partition types
& Q. } R: R+ w" t m print this menu- K/ G$ [; N8 e8 f2 x q8 ^: `
n add a new partition
# U0 X, Q( J' Q; k# C o create a new empty DOS partition table7 B/ j5 d8 L; Z4 [7 T! I O/ M
p print the partition table
+ G) ?% M8 F$ d4 @2 ~; _3 Y q quit without saving changes0 M0 E ~. b2 \; B" f3 P
s create a new empty Sun disklabel
* e. j, y; m1 x5 r t change a partition's system id
- K6 X4 J( W" V# \. f2 D/ @ u change display/entry units
I+ H8 J; Q7 A S" ^9 a2 B v verify the partition table4 N9 n7 a3 m- Y; ]5 ~
w write table to disk and exit7 b; a5 g" ~5 `* ?! k) d3 e* f1 X
x extra functionality (experts only)
$ Z9 p' d- C5 v6 R( r$ T! R- I- E Command (m for help): n
4 A" s4 c; c) ?' q Command action
3 m/ o5 Y, e. Y4 A* ?& o& Q. R e extended# _; P- s& C5 `2 W7 E
p primary partition (1-4)- e5 P# g( K5 j3 ?; |& J6 t
p- g1 x7 _8 @: S) G# n, C# S# I$ g2 @
Partition number (1-4): 18 g9 T. N0 U1 s0 ~( V
First cylinder (1-8322, default 1):
. j8 [1 P3 @1 ]$ s Using default value 1& G3 V3 {. f5 H! N3 Q1 j
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G" \4 n4 F% l- }$ \
Command (m for help): p
' g, s. F1 q+ B3 s6 I( d9 I8 U7 @ Disk /dev/hda: 4294 MB, 4294967296 bytes6 j$ Q: Z1 v8 U/ j t+ [
16 heads, 63 sectors/track, 8322 cylinders0 S- l; s& T7 s7 B' C
Units = cylinders of 1008 * 512 = 516096 bytes
7 W) q6 F) i+ u t) P Device Boot Start End Blocks Id System* K6 B+ G( |+ h9 r* y/ X( ?+ {/ o0 f2 v1 q
/dev/hda1 1 1000 503968+ 83 Linux
0 g% T2 d. ~% s0 x! F- ]! {! C% B- S: O Command (m for help): w
5 g$ K p5 ?+ y l The partition table has been altered!
) c8 j) ^$ A1 [& \) ~' I0 s3 d Calling ioctl() to re-read partition table./ j2 \3 w2 R3 x* v8 K4 d$ X8 q8 u
Syncing disks.; S1 R( S- @/ Z4 j" {) u5 s9 G
//格式化新分区
4 \, T+ A: y" I4 |1 X4 @8 {mke2fs 1.32 (09-Nov-2002)( G- g8 d, E& B( i8 I" D
Filesystem label=
; ^/ s! z+ p9 w3 a OS type: Linux4 E& J9 \2 u( D+ {( e
Block size=1024 (log=0). W# {1 S' ^2 x5 U, {4 t9 w
Fragment size=1024 (log=0)
8 N' k# L2 q6 v ] 126480 inodes, 503968 blocks
4 X' D' l, [3 q; R( @0 D 25198 blocks (5.00%) reserved for the super user3 k' x' [7 {6 U* |2 g+ S4 s6 V
First data block=1, E! S0 F! a& |) d4 _8 h
62 block groups
5 q \7 x& Z; P. p2 ^ 8192 blocks per group, 8192 fragments per group
$ j2 O' i& P5 m6 t, R, D$ C 2040 inodes per group
8 A6 Y% i9 c5 r$ j# y. D# h7 A Superblock backups stored on blocks:
0 l& g2 r/ l ?$ k8 U8 y. l 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014096 N* ?# |& g( Y% v5 C* K1 u
Writing inode tables: done 0 W d; a4 i) t
Creating journal (8192 blocks): done$ \% ~8 F/ ^8 y4 A* `$ F
Writing superblocks and filesystem accounting information: done3 O" M# [' d& ?; ?; h5 X
This filesystem will be automatically checked every 30 mounts or z z8 d# B5 u! {" L' W
180 days, whichever comes first. Use tune2fs -c or -i to override.
. s: _9 |, ]+ r6 ^: o文件系统 1K-块 已用 可用 已用% 挂载点7 W8 ^3 ^7 g E
/dev/sda3 3723848 705992 2828692 20% // X2 Z/ i w2 t* }
/dev/sda1 101089 9274 86596 10% /boot5 [) @$ f8 E! A! {' q& S* [
none 14520 0 14520 0% /dev/shm
& q; x1 F/ G% N" ?! y7 Q //挂上新分区/ f$ D- O" s+ ]- q# i
- mount /dev/hda1 /home% v7 f7 p' e& h- D5 |8 H
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
2 ^0 S+ E$ O" \$ b5 N/ O /dev/sda3 3723848 705992 2828692 20% // e) X0 ^8 G) A
/dev/sda1 101089 9274 86596 10% /boot
, i) O3 V9 w$ A* d9 `. f( N none 14520 0 14520 0% /dev/shm- g$ n! D& B: u9 K% m
/dev/hda1 488006 8239 454569 2% /home4 T' V9 Q( B2 j7 l" s8 e: a
$ J' v( e9 q& i! W) _+ y# N; z9 d
自动挂载:# N' g3 N5 M( d; c+ `
- vi /etc/fstab
8 {9 C7 n5 r" X% s2 [/ ] G - 0 \3 b5 U7 h4 ^# d
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
1 d* h1 j; C9 Z* ^ Y - $ z8 L# T( U* D `7 K' S
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:# ^2 ^( H; m) U. \2 a0 W' P
- mount /dev/sdb5 /mnt/ljp1; S6 Y* w4 N% ^, Q! E6 H
- $ H5 N" E6 i: |) l
- mount /dev/sdb6 /mnt/ljp2
复制代码 4 p1 O3 S! W% U/ E7 Q, r
0 x" |) I, z* o( X
7 h) M! S5 ~7 ? S |
|