|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk). _4 F3 A; d6 Z' s* g
or: fdisk /dev/sdc (for the third SCSI disk)
! n# c3 L4 q0 b or: fdisk /dev/eda (for the first PS/2 ESDI drive)+ H* W5 J. m( @" O
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
) Z4 v3 u8 Q7 K' Q" f% \ ...
& d/ S% ]' U/ |- df -k& J/ t& V2 J& M& M: i
- df -lh
6 J- z a$ X" i - 查看有几块硬盘:fdisk -l
) ]9 D' L% i* K% l% e0 @
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点& Q1 Z- U8 J$ h# ~/ g
/dev/sda3 3723848 705968 2828716 20% /
$ I `$ j4 T' v& R /dev/sda1 101089 9274 86596 10% /boot
6 g, i- O# ~1 a1 x none 14520 0 14520 0% /dev/shm) Q/ G+ F( t. x- Q* V# n6 o
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用$ N' k8 Y4 i( a0 T1 o' f+ l
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel, K3 P, n j- n, N; H/ h
Building a new DOS disklabel. Changes will remain in memory only,
6 [, c: D; j, X5 c1 ~ until you decide to write them. After that, of course, the previous
* ]3 Y& v+ M/ L/ l5 e5 v0 U3 L" |: @ content won't be recoverable.
+ t7 s7 z, v2 j' l The number of cylinders for this disk is set to 8322.3 x) K& }$ C: U X
There is nothing wrong with that, but this is larger than 1024,
" n# e& I0 _% [; M; r( r; { and could in certain setups cause problems with:
- @1 l. h9 I5 y* d% X0 D 1) software that runs at boot time (e.g., old versions of LILO)7 k. Z. ]' t, S ~, q) b. C1 e
2) booting and partitioning software from other OSs
4 {+ a" X' s3 u9 C; w (e.g., DOS FDISK, OS/2 FDISK)
% A- `( O2 G, e1 e* z, ] Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ q q8 E% ^5 D3 D. p4 C) m Command (m for help): p9 d2 {0 Q$ k0 T( g- {' H! T' |
Disk /dev/hda: 4294 MB, 4294967296 bytes
3 ]+ B4 J( Q. ?; o% ` 16 heads, 63 sectors/track, 8322 cylinders( d# N0 G) m* y
Units = cylinders of 1008 * 512 = 516096 bytes
. {; y) g, ?" G1 E c s' Q Device Boot Start End Blocks Id System, A# b" S; n3 p, F- t3 d" z& C; \
Command (m for help): m. t7 ~6 j' |/ z7 n
Command action
6 {$ D+ T+ M. h0 {8 | a toggle a bootable flag
F% _2 c- L2 K b edit bsd disklabel* v* g) ?* ~2 d J
c toggle the dos compatibility flag
, W& V2 I& p+ s% ^: O+ C( a d delete a partition
$ k9 c9 e, G$ o' H3 B. S; K l list known partition types/ y; ?! ^- O% e, d4 a! ^( J2 j
m print this menu
: z* M1 P. W1 s a* m5 b n add a new partition5 [/ o* K9 G$ D( {) `/ V
o create a new empty DOS partition table
! b% l9 s {( @! u* e" M p print the partition table0 L7 C9 ]" O6 C U' L# N
q quit without saving changes
, f2 n' O2 d3 [. I: v, J Z s create a new empty Sun disklabel/ Y( Z6 _" Z( T$ C. J8 i
t change a partition's system id/ n- q* m; P* W& q/ Q
u change display/entry units
1 _3 }& Z# P+ h/ o0 }( H v verify the partition table
5 Z: [- U+ N4 [( r; z8 q1 t1 t6 I) P w write table to disk and exit
5 \3 r) Z* K( A x extra functionality (experts only)
, t7 s& _8 Q& o2 V0 L Command (m for help): n
, q4 I% P" {( `8 n4 n1 P3 m9 _6 J, W6 ^ Command action
; h' d1 U/ h, ], X4 I# K e extended+ t2 l @, W4 f: w( F, {
p primary partition (1-4). z4 R* J5 ^2 [- W
p4 ]3 |6 @+ g0 j9 S% k' _
Partition number (1-4): 1- e1 L; a9 _1 X5 @/ O
First cylinder (1-8322, default 1):
3 U* K3 t" T1 a- t3 W Using default value 1
& V& n# z7 K8 ` Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
3 G' F ~1 S# I: o6 z, z Command (m for help): p
. z! v1 \0 @: u( p1 z Disk /dev/hda: 4294 MB, 4294967296 bytes+ a( _1 Q/ R; O7 @6 y: w* D
16 heads, 63 sectors/track, 8322 cylinders
* R% `' F' o% ?1 T) y) m Units = cylinders of 1008 * 512 = 516096 bytes
- d$ S. W2 p+ K1 e) d3 s. S0 I Device Boot Start End Blocks Id System% `0 S4 d9 a; N5 L) `. h
/dev/hda1 1 1000 503968+ 83 Linux, T& F# c, I- a! B
Command (m for help): w
- s l$ w, ]4 {# v/ v9 b The partition table has been altered!
- D$ F2 ~( n0 M Calling ioctl() to re-read partition table.# T b7 @+ `& C' s4 \3 ]
Syncing disks.
$ n, ^; R- C: t: V: N# R //格式化新分区
; j* |# ^ F2 Kmke2fs 1.32 (09-Nov-2002)
4 {6 o5 x. ^0 |% ^! e) r Filesystem label=
; `2 h) R; R0 B2 P OS type: Linux
8 X8 F7 ^; _- Y0 _ Block size=1024 (log=0): R/ n* P: q ~
Fragment size=1024 (log=0)
2 ~) N, u+ U# j Z; N* d* u( x 126480 inodes, 503968 blocks
( ~8 e5 g3 v0 ]4 S* ]9 c/ O 25198 blocks (5.00%) reserved for the super user* g, } K+ s0 A! x3 V2 g. k
First data block=13 ]7 X. q4 ]: m( O1 |
62 block groups3 r- X8 \! `; G. d
8192 blocks per group, 8192 fragments per group2 p& s2 O# ^7 ^ X: D
2040 inodes per group4 C& x: k5 M7 }. |
Superblock backups stored on blocks: - K3 U/ ~7 o; q$ R; H
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
3 Z' k. g7 s) n9 K1 K Writing inode tables: done
+ ^4 A2 S2 F: Q% Y3 d+ j3 Y' |1 j Creating journal (8192 blocks): done5 B; \# i/ Y& m6 [
Writing superblocks and filesystem accounting information: done
, l0 G3 `! U& y: p3 e# o. Y This filesystem will be automatically checked every 30 mounts or
# P8 ^! V1 \7 V2 T 180 days, whichever comes first. Use tune2fs -c or -i to override.
3 ]' V' c+ i3 X- M8 h0 j文件系统 1K-块 已用 可用 已用% 挂载点6 k( r1 t& I% w4 Y
/dev/sda3 3723848 705992 2828692 20% /$ e* V- t: q7 ^0 E! h
/dev/sda1 101089 9274 86596 10% /boot2 S# s6 a d+ K% i
none 14520 0 14520 0% /dev/shm
- z# z( R6 q* ?0 ]* d. i l //挂上新分区
/ c4 Y% {9 v+ r, J9 C7 S- mount /dev/hda1 /home
6 t) [( z! _4 g. g+ i' k - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 @/ A( I8 ?; {6 q2 d$ ~ /dev/sda3 3723848 705992 2828692 20% /( D: \; O6 c" I/ V1 d! f- T
/dev/sda1 101089 9274 86596 10% /boot" p& o' |+ d5 k) l9 Z3 a. B
none 14520 0 14520 0% /dev/shm
2 E! R' F7 L/ y7 b8 d /dev/hda1 488006 8239 454569 2% /home
4 @2 d7 H, q# D+ q+ g. ^8 }' ]- a$ @
自动挂载:
* T6 x- D" U6 \# a3 @& f* g% |- vi /etc/fstab
* h/ Q$ m$ E; ] F
* M5 L% \; Q+ m6 j4 L; d! [3 L3 w5 A: Q- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 04 N) Z; H2 U- C+ j0 E
- : s! u# n5 }; x: U( i2 g
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
3 d: R+ P% {7 R# _$ Q- mount /dev/sdb5 /mnt/ljp1( l4 v) N, L( z% o3 a( ~
, }) A( V" m9 K F# A6 E- mount /dev/sdb6 /mnt/ljp2
复制代码
7 S$ y' u: q9 {4 l1 u" U
% Z5 X3 n4 ?4 H$ C4 l
7 \$ p) a( M1 _& v2 h6 \7 _) R |
|