|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
& X6 G/ F* X7 P3 D. V or: fdisk /dev/sdc (for the third SCSI disk)
8 Q9 V: O j6 ~1 y& J3 x or: fdisk /dev/eda (for the first PS/2 ESDI drive)
; s* a* ^$ u4 ^# l or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)) M) q& Z. L$ x5 P" n# x% z
...9 l5 W' l9 A. y6 p! M7 B
- df -k
1 B v$ B$ h7 i% H+ D% r7 b - df -lh
7 |2 @' {& ^' s3 n; g2 p1 S - 查看有几块硬盘:fdisk -l; s# b ^- j+ y; }: R- I+ B/ ?4 g* c
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
: h0 B+ l2 ~ f /dev/sda3 3723848 705968 2828716 20% /- q: Y8 H$ L! N( T8 i
/dev/sda1 101089 9274 86596 10% /boot$ `$ B7 X# E. v4 C- y( [ K$ C
none 14520 0 14520 0% /dev/shm
- Y( g" l/ m1 { 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
4 z0 V2 l! @' l7 O7 F7 D2 ^Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel- a+ M; f' N6 p. S& r" W0 J
Building a new DOS disklabel. Changes will remain in memory only,
( q; i+ W2 m& z+ x5 g$ w; o/ W9 z8 G until you decide to write them. After that, of course, the previous( P" b9 l' n7 l. ?2 D1 c
content won't be recoverable.
1 ?% `9 b* V8 X i The number of cylinders for this disk is set to 8322." G+ E/ R/ [0 [* F; U+ C5 c
There is nothing wrong with that, but this is larger than 1024,7 p( y: d6 W* U
and could in certain setups cause problems with:+ Y" ] Y; M. h, X7 U% O
1) software that runs at boot time (e.g., old versions of LILO)# r; T: W* W' D4 L' d3 Z
2) booting and partitioning software from other OSs
; Z( j. C& _: I* J% U" q1 H4 C (e.g., DOS FDISK, OS/2 FDISK)5 p8 k' [5 u- u; _3 E* R+ {
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) l `) r* L5 r* {$ f
Command (m for help): p; g* K9 l3 U+ v5 f/ Q
Disk /dev/hda: 4294 MB, 4294967296 bytes) O5 f2 m! h/ L" z7 T) p9 N, s1 F
16 heads, 63 sectors/track, 8322 cylinders: X- K1 W5 }3 C; O3 @
Units = cylinders of 1008 * 512 = 516096 bytes P1 L0 x5 F0 W* E) _: o5 K
Device Boot Start End Blocks Id System! ~$ _: B( s( ?1 x5 Y. |7 W
Command (m for help): m
o2 D5 J# D- w! m2 p/ ^ Command action
4 O& a) I0 }4 K$ @ a toggle a bootable flag) D; g* |& |$ L7 V: \- } B& v
b edit bsd disklabel
& i5 ]- A$ R. w0 ]5 M A, j c toggle the dos compatibility flag1 d$ K0 C1 { O" f) @, Y7 d
d delete a partition
: W& Z. y f; i" a- s5 { l list known partition types: i5 [; Q: A1 y6 u5 K& X- C' S( X
m print this menu
3 N _8 g. j6 G' z* p n add a new partition
, F7 S# H' `: d& N o create a new empty DOS partition table
) e% S" W( N2 w8 f p print the partition table" n/ ?0 i7 b. Q# A( n9 p6 W
q quit without saving changes8 |& Z+ ~! E1 i
s create a new empty Sun disklabel+ r1 B) g+ d" o! _
t change a partition's system id
7 K8 c. n' y3 d! r: J' i% @ u change display/entry units
1 f- g- l. I- u2 v. l# ~ v verify the partition table
) i6 N x$ }3 t# b w write table to disk and exit6 n# r' L( N+ @4 ^' J9 D) J) t5 e
x extra functionality (experts only)
2 ~( r1 [) i# k; \* `4 ] Command (m for help): n0 Q7 p$ w& q% T' o- r R
Command action* m7 F0 h( _# d. L
e extended
/ @, Q5 v; F& u B( M0 h0 T& W p primary partition (1-4)
; z6 t, R& ?" e4 j" K" N3 b p# x* @) a w/ t8 k
Partition number (1-4): 12 v! m* C" m0 Q- `4 j* K/ T. S
First cylinder (1-8322, default 1):
( }) w7 J6 Z1 Z( y7 w9 G Using default value 1
- c! C ? ~/ a: ?, P6 y& \ Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G5 e* t i r4 F! O2 v( @" k- u4 W
Command (m for help): p
0 c. d. C: J+ q Disk /dev/hda: 4294 MB, 4294967296 bytes
. V! G5 i# H* U5 B; r w 16 heads, 63 sectors/track, 8322 cylinders+ E: E' M7 o" d# Q4 k( X, K2 n, b
Units = cylinders of 1008 * 512 = 516096 bytes
$ b& j& k5 M; c+ S& C Device Boot Start End Blocks Id System
4 T* C! ]! u6 {! S /dev/hda1 1 1000 503968+ 83 Linux
, p1 ^0 `* Z9 E2 @2 z2 L Command (m for help): w5 h# s4 a$ i" b9 x. l3 v+ N
The partition table has been altered!* K$ J. t* K' k/ o3 O6 c
Calling ioctl() to re-read partition table.+ p6 V8 p/ n- @
Syncing disks.- Z) Q: ~; g3 o0 O: n3 Y5 R& r
//格式化新分区
5 Q! N" m' y% }2 h7 k; Gmke2fs 1.32 (09-Nov-2002)
& v& ^ I2 k6 D2 Y, Q8 W Filesystem label=
+ G) z9 \* ]9 ~. U$ I OS type: Linux" j' w8 ?* E* Q7 n* h
Block size=1024 (log=0) d) l- v" [8 d5 d
Fragment size=1024 (log=0); ?% m& u& u+ R. v0 y! i; |) ?: f+ g1 p
126480 inodes, 503968 blocks
8 ?; M/ D2 Q* V+ k. P$ y9 P 25198 blocks (5.00%) reserved for the super user$ J; l* ^+ W4 S6 [$ L
First data block=1/ l1 v; B3 z/ z& R9 I- ~! ~6 a
62 block groups
# w* T) C* M. y# a( A 8192 blocks per group, 8192 fragments per group/ u# ~/ t1 K# G1 f5 i
2040 inodes per group
& ?2 w) r8 y( @8 R Superblock backups stored on blocks: 4 l6 Y" z: u8 F ?7 v D5 |
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014096 |" v/ i. K. ~9 P9 I4 B, [
Writing inode tables: done % ?: }- c" a& d3 `9 E3 w
Creating journal (8192 blocks): done' D9 k. \: W% p B9 l% Q- z. w
Writing superblocks and filesystem accounting information: done/ S' I6 [) b5 y, c! \
This filesystem will be automatically checked every 30 mounts or! X) c/ J3 D8 m3 G1 D+ x# J
180 days, whichever comes first. Use tune2fs -c or -i to override.. \% H# e" ]) w+ d# H
文件系统 1K-块 已用 可用 已用% 挂载点3 p1 \$ ]% R* E; n7 i1 \2 f/ \3 ^
/dev/sda3 3723848 705992 2828692 20% /
?0 ~( a. `2 g0 }# Q /dev/sda1 101089 9274 86596 10% /boot
0 C8 m E; Z: G% ? none 14520 0 14520 0% /dev/shm
5 S3 S% P8 H; e- M' a //挂上新分区
7 @, f! y; {6 v* Y' L- mount /dev/hda1 /home( Y! ^# f( m7 y- M, p. Z/ T
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 r/ ~7 G: R3 p
/dev/sda3 3723848 705992 2828692 20% /& Y5 a! {+ x" i# m' A- m9 O
/dev/sda1 101089 9274 86596 10% /boot
^$ }. P" A H* l6 e* G none 14520 0 14520 0% /dev/shm( M+ V0 @; ]3 Y2 e$ }1 O4 Y7 C
/dev/hda1 488006 8239 454569 2% /home" ?/ b/ u3 A4 \% Q' W
- E7 p2 x# _* T0 p- K2 R
自动挂载:1 s7 C+ g% K4 v4 e: G% c: d
- vi /etc/fstab
+ V. z" A& O! F - ' U" t: |0 |! C$ }$ o. Y
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0% H) B5 C) T, e4 X6 j) l& Z
- , T2 D7 v* ?$ _
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: B$ o2 j7 |# M4 x# g
- mount /dev/sdb5 /mnt/ljp1- k1 C: k5 F( n1 D5 k r
- : {$ p* e B* O8 _4 }
- mount /dev/sdb6 /mnt/ljp2
复制代码 . }# d! ^' {8 Q( H! O {# i' v- t
7 _( Z* v5 U( X3 d6 k2 g; J
+ {( N: z7 E% e4 P$ ]
|
|