|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)" z# z3 v( @1 |5 K3 ^
or: fdisk /dev/sdc (for the third SCSI disk)
, ^0 e. `# H. i- I! e$ J or: fdisk /dev/eda (for the first PS/2 ESDI drive)) i0 T6 `/ w& P/ R% Z/ _; K7 x) P
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
5 x' O; j- Q3 X0 M9 X# k ...1 ] w( w5 V8 a- V' Y0 `
- df -k6 ^5 z f% [# p: B
- df -lh
& \/ _& R0 E' c# U7 u! y* @8 ?, o - 查看有几块硬盘:fdisk -l; K0 l1 O% V+ U. p6 X: |, l0 t
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点% D, w/ Q; z, @* Z! `
/dev/sda3 3723848 705968 2828716 20% /
* [ e4 p! U3 w/ w S6 L0 D /dev/sda1 101089 9274 86596 10% /boot0 X5 O! g) _4 g
none 14520 0 14520 0% /dev/shm$ o- C$ @ {6 p h2 F
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
8 ?. c9 |8 c( Q: dDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) v" l0 F1 `6 {2 \/ _/ p, I ?: ~
Building a new DOS disklabel. Changes will remain in memory only,
+ m2 G, I1 r" W# y) }* Q. e until you decide to write them. After that, of course, the previous/ f" V: E# P7 k; s+ k6 W: }
content won't be recoverable.
: ]( h% F4 @: \( L1 O The number of cylinders for this disk is set to 8322. G7 Y0 k% X2 M( j& r0 Y& f) S
There is nothing wrong with that, but this is larger than 1024,: P1 {. |) ~+ n# T$ r
and could in certain setups cause problems with:' e" [. n. ?6 B
1) software that runs at boot time (e.g., old versions of LILO)' ^4 {3 O2 S+ C8 K8 X; L6 b6 y: t
2) booting and partitioning software from other OSs% |( Y+ U1 T I' l- V
(e.g., DOS FDISK, OS/2 FDISK)4 u4 G9 ]2 n2 B, e3 p* ^
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
3 `5 v5 d; i) N8 p1 w0 C Command (m for help): p: Y" F+ N i: ^
Disk /dev/hda: 4294 MB, 4294967296 bytes; ?7 {1 T/ f3 O$ _1 r' X( I2 e
16 heads, 63 sectors/track, 8322 cylinders$ @& Q" ?# _7 o$ }: d6 y9 D+ D0 G
Units = cylinders of 1008 * 512 = 516096 bytes
2 V* A7 c) v7 d; A. m* M Device Boot Start End Blocks Id System
2 D2 X! u" M* ^+ I$ R' l$ U Command (m for help): m
; X) U/ i0 o$ s( l5 _ P8 w5 }( }" G Command action( b2 F9 \4 S. C
a toggle a bootable flag
( X- ]/ h5 ?# \) j b edit bsd disklabel" g( b' X6 C$ M \
c toggle the dos compatibility flag
! Q* m1 T7 \, T$ m8 ~; n ] F d delete a partition
5 J1 t8 h9 H9 q) @/ u) e l list known partition types
, V2 P% g) N+ E1 |) p m print this menu" Q5 e! M X! a, b4 J: s5 I
n add a new partition' q& X/ D5 v$ }, w1 J# [6 r
o create a new empty DOS partition table
7 c p2 `, K, b+ Z+ P4 \8 |2 `% u p print the partition table
# K4 t: H, q; L) U; } q quit without saving changes
. t; Q3 n+ ~4 k, J- y* W9 a s create a new empty Sun disklabel- Z3 k9 k- n6 G5 p; c: j( q
t change a partition's system id: x# c7 A) g& h2 F
u change display/entry units
$ @; e" q9 q0 O( d2 I: \6 c v verify the partition table! B1 ~1 y" a& r6 h1 C; l
w write table to disk and exit8 h& t1 N [. t$ J5 S
x extra functionality (experts only)8 e& ?: N( A3 I9 \
Command (m for help): n7 @, Z. ^% j8 v, r1 u
Command action( h2 b/ F) @4 k d
e extended
, C+ p$ x3 _5 U3 R p primary partition (1-4)
. R5 y# x' w7 |+ p p
1 v+ Y2 }5 X7 M' P# V$ ]* W Partition number (1-4): 1
f D2 A3 N. U# |3 L2 P First cylinder (1-8322, default 1):
) s, L; d0 Y6 H+ \ Using default value 1' S/ `- e* c* q. G: ^: N
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G+ C, H* F, C8 @ ?
Command (m for help): p y) W& ]4 I. i" K2 L
Disk /dev/hda: 4294 MB, 4294967296 bytes
- |( a# x1 I4 l1 Q# T 16 heads, 63 sectors/track, 8322 cylinders
$ S& U' [4 v# f0 N1 ]# p Units = cylinders of 1008 * 512 = 516096 bytes
+ Y' K' T& @$ U# u& C9 g Device Boot Start End Blocks Id System
" U; r' a! f8 N, f, s8 E4 O /dev/hda1 1 1000 503968+ 83 Linux
# g* t" X$ P0 ^- S! `- a' S Command (m for help): w
. K" M% v6 `3 G4 x- i, c1 ~8 \3 } The partition table has been altered!
4 U9 ~5 ^8 w8 X' v5 ^9 M Calling ioctl() to re-read partition table.
+ U) h6 b( a5 e% Q' j: s& B9 z; a Syncing disks.
. Y/ R7 m$ K4 U1 i' ~: i //格式化新分区2 E( ]3 @" S$ y+ k& V* q6 T3 K( d* B
mke2fs 1.32 (09-Nov-2002)
' m/ v$ `) D2 G Filesystem label=
' y1 K" H2 @3 S OS type: Linux4 }9 M1 o, J( P( T* I
Block size=1024 (log=0)
% L ?1 E9 t. W Fragment size=1024 (log=0)
2 r! q9 D& h3 T5 q' } N 126480 inodes, 503968 blocks
9 s% A# ~* m7 c6 e 25198 blocks (5.00%) reserved for the super user
1 a9 ]6 ?' J2 |& ?: |7 ` First data block=1
' ^! o3 J" }) v2 h: t, L$ _ 62 block groups
1 [" B6 b$ `( B 8192 blocks per group, 8192 fragments per group
5 M+ o v( @1 Y$ A5 B 2040 inodes per group( j$ p k% ^% \7 y2 |' X h
Superblock backups stored on blocks:
; O7 M! \) W* h6 M0 G 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
+ o- t/ `- t3 w$ q& { Writing inode tables: done
6 Q' _1 A) B4 w/ |; Z5 j2 [ Creating journal (8192 blocks): done
; n7 N, I# L h' h Writing superblocks and filesystem accounting information: done
. O# w& \1 n6 E2 \# u This filesystem will be automatically checked every 30 mounts or
1 s7 c7 x$ [/ b: F( f; X 180 days, whichever comes first. Use tune2fs -c or -i to override.
! t. i2 S9 `- s/ B0 S3 k2 E6 e, k文件系统 1K-块 已用 可用 已用% 挂载点) ?3 V1 x6 W+ Z5 g+ [5 y! L; H% y6 m
/dev/sda3 3723848 705992 2828692 20% /
' ]% Y* a6 [* y( D/ Q0 K' c/ n /dev/sda1 101089 9274 86596 10% /boot7 A' {/ b! D7 d' s% _
none 14520 0 14520 0% /dev/shm
3 k/ n; G/ X$ |2 F# q: Y7 Q //挂上新分区
: F- z% S: f3 b- mount /dev/hda1 /home
: N+ G! g$ i/ t. }' f) l7 z1 w - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) i+ s2 Q1 Z& g. ?- s5 q/ p /dev/sda3 3723848 705992 2828692 20% /+ I) k3 J/ g' B" g( D' y7 R
/dev/sda1 101089 9274 86596 10% /boot
* E I) F0 Q5 c9 c9 {, s none 14520 0 14520 0% /dev/shm I8 h1 j/ H' S6 e
/dev/hda1 488006 8239 454569 2% /home. A+ t5 q z+ v' W
0 B8 E. ]9 K2 y9 b- A自动挂载:( m; U) r' n6 A( a
- vi /etc/fstab
) w9 I: `/ G* N6 A. K/ ]! P* S - % G+ v4 W: d. ~6 K0 a
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
& a/ G; a& x C$ j( {: m4 S - ' Q2 ~3 m0 q) c2 O# [ C$ N0 M0 v
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: D* ]3 z" T8 Z* q, h9 K$ s- g
- mount /dev/sdb5 /mnt/ljp1- d! N% [" \. @, }! x
2 `* _( k& m8 j8 _' z- mount /dev/sdb6 /mnt/ljp2
复制代码
9 I2 P$ ?0 t& \. e/ g5 W+ D1 ^/ Y# h
}% K2 d- j2 ?) i; o9 w) f/ B |
|