|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)# {0 b# V8 r4 t3 }$ J6 R- b0 r
or: fdisk /dev/sdc (for the third SCSI disk)
4 P0 _+ @' E( d; |. v or: fdisk /dev/eda (for the first PS/2 ESDI drive)
1 d$ W! B$ P) q) k/ f' J+ ^% d or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
3 u v2 ]7 ^& Q" _8 i& z X% v" [ ...7 j& W- A% l. A1 v* X) G) n
- df -k* B1 q4 W" K6 i8 _! h: T
- df -lh% m( `1 ^3 o+ {# F
- 查看有几块硬盘:fdisk -l+ U0 O2 {! m5 y: n" B
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点- j8 Q; J0 I0 p, H; b
/dev/sda3 3723848 705968 2828716 20% /
0 s, X( {5 j' B8 L- a) _" n. t /dev/sda1 101089 9274 86596 10% /boot/ U/ O1 b6 u( w( ~0 E! j
none 14520 0 14520 0% /dev/shm
/ v6 v1 j1 _2 k% ? 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
1 g r2 w2 G( h/ g4 I# p0 SDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) p$ v( e' ^9 G0 g
Building a new DOS disklabel. Changes will remain in memory only,
6 b2 t2 g/ K' x# M until you decide to write them. After that, of course, the previous. R; a2 k' e7 q! E# q
content won't be recoverable.0 W+ d1 H! K% A8 y; B
The number of cylinders for this disk is set to 8322.
5 s# X+ R) ?4 |/ C, L There is nothing wrong with that, but this is larger than 1024,
" q! V1 z: i4 p0 @# x7 l6 q4 @; e; x and could in certain setups cause problems with:
# F R- I0 v/ T( V4 [8 B- r 1) software that runs at boot time (e.g., old versions of LILO)8 E t. `3 y4 E
2) booting and partitioning software from other OSs
6 h% V& s) @1 k. P (e.g., DOS FDISK, OS/2 FDISK)* O+ L6 g8 D3 y0 | q; L" B
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)2 s, c1 }1 A' D
Command (m for help): p
6 W w7 ]2 {2 p0 \3 U Disk /dev/hda: 4294 MB, 4294967296 bytes+ k% d) k" F9 Q2 U) @* g( ~
16 heads, 63 sectors/track, 8322 cylinders
& v `$ p8 B0 I# x ~7 ` v, n Units = cylinders of 1008 * 512 = 516096 bytes
: e9 x, }3 e8 Z8 B Device Boot Start End Blocks Id System
8 Q& [$ }# u: O9 A& w4 W! U z Command (m for help): m
; k2 w+ e0 v b3 U8 Z4 e: C' V Command action
& |$ z3 d2 m) N5 E/ g a toggle a bootable flag3 x4 H9 [ v3 L: W7 X
b edit bsd disklabel- r) ^* L/ s7 C) y0 m# h, D% u
c toggle the dos compatibility flag7 p0 @& V( P+ S' D+ Z
d delete a partition) c& H& I9 f! ]( k) L9 X/ R* _
l list known partition types
& m. z0 h: k: n/ s4 I1 {! v m print this menu6 ^+ ~) O$ b( i8 l0 k
n add a new partition
) ]0 ?% m( X B# w7 i: h( G o create a new empty DOS partition table) ~* w6 E0 f L9 k
p print the partition table/ C g! ]! W* H. c \
q quit without saving changes/ r9 H5 @& [2 t* a5 T) B$ c/ X- u
s create a new empty Sun disklabel
; l* p: o' _+ G: h4 |- V9 q3 e t change a partition's system id k/ ?# {8 y, W+ A4 R
u change display/entry units
1 w3 ~; \7 i, R8 }* s& f! }: O v verify the partition table
H8 O0 r( F! V+ k: O1 h3 k1 K' S% m w write table to disk and exit
8 K: P) r! j# v% P8 _3 r x extra functionality (experts only)
* U/ Z2 P! R; o$ ]" S Command (m for help): n; o. E0 x# @8 L: E7 E }4 h
Command action
0 P# P4 u5 Y) X; @/ G/ k e extended
. P3 S0 w1 n' i! l: V9 o# N% C p primary partition (1-4)4 R# A/ X ?0 P) y8 P# Q
p3 v) Y5 u O+ c7 M4 _1 m% e
Partition number (1-4): 18 T$ p: c2 A, V" H. u
First cylinder (1-8322, default 1): ) N; v% j, [' B% _! P0 t" w& ]
Using default value 1" z9 U9 w7 R: M& Q1 O) }9 }
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G" C6 P' b1 U5 s U5 R" `
Command (m for help): p0 d6 ^6 s! t4 q& c9 X' A, u- l3 e
Disk /dev/hda: 4294 MB, 4294967296 bytes$ e n+ \5 q" W5 N+ P
16 heads, 63 sectors/track, 8322 cylinders2 W- b/ A- w' \8 Q0 ?1 x* R0 Q
Units = cylinders of 1008 * 512 = 516096 bytes' B7 S) D* q6 ^3 k
Device Boot Start End Blocks Id System7 O* q8 p0 C5 F o, v/ U& V: }' `
/dev/hda1 1 1000 503968+ 83 Linux' M( ^+ o, ^- j6 {4 b6 E
Command (m for help): w
: u% t# T& J7 W E) U2 i0 x9 } The partition table has been altered!
4 O9 L, R+ K1 I4 ]4 d1 H Calling ioctl() to re-read partition table.! m8 e' ?( @! P% V, I/ f2 W- J
Syncing disks.
. z8 M) o( q4 ]: [ //格式化新分区
2 f7 R+ R G- B. Imke2fs 1.32 (09-Nov-2002)9 a) n- c3 g5 V" n. z
Filesystem label=5 ?* |' }( |& F. @# y
OS type: Linux1 |5 N4 A [$ v& U/ }' g& }* e% b
Block size=1024 (log=0)
9 f' D. \& e0 P; k6 O; l ^0 Y, c5 | Fragment size=1024 (log=0)2 D9 D5 ]; o6 U
126480 inodes, 503968 blocks
. [5 }7 n* s8 v5 M& V7 D 25198 blocks (5.00%) reserved for the super user( H) f! e8 m( z- Z9 C2 O
First data block=1
0 S2 J: d$ M/ I- N- a. F. o- Y' r 62 block groups1 F7 J' X& O. J$ {
8192 blocks per group, 8192 fragments per group
' c8 W" y& ^' v b1 b 2040 inodes per group
0 z" D$ }2 @: o/ U, n Superblock backups stored on blocks:
4 X3 k' C4 _" `9 A+ ? 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
) c1 u8 [# u% R! [ Writing inode tables: done
; S& b4 q! f3 D3 B0 U7 Y. ] Creating journal (8192 blocks): done: S3 R5 v' x1 S/ A* G0 B
Writing superblocks and filesystem accounting information: done# K& @! o' \/ W; }4 i$ _( g
This filesystem will be automatically checked every 30 mounts or
" J, d$ m7 z; L+ N V0 H1 y 180 days, whichever comes first. Use tune2fs -c or -i to override.
! Z% C5 h: |; m# M; C1 E文件系统 1K-块 已用 可用 已用% 挂载点
& M0 Y, N7 f) l' K' k9 C+ _1 J /dev/sda3 3723848 705992 2828692 20% /
4 p% P' `: P. o. [8 \, s /dev/sda1 101089 9274 86596 10% /boot- M6 u: P9 ~4 G% D0 u; M
none 14520 0 14520 0% /dev/shm
- L6 J1 a* x8 z1 a //挂上新分区
0 Z3 M' o( b P9 p- mount /dev/hda1 /home
9 o) a* f6 Q% t7 N& ^1 Q - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点' r/ N6 z- u- \. A6 l8 R' K1 [
/dev/sda3 3723848 705992 2828692 20% /0 n, ^% z& a0 h% c3 u6 w, n: |
/dev/sda1 101089 9274 86596 10% /boot
1 q+ p2 E" ~1 o- w3 q: R: J none 14520 0 14520 0% /dev/shm+ x8 `# l \ w
/dev/hda1 488006 8239 454569 2% /home9 O! Y; Y0 k0 i0 }. r1 X: G% t- s6 i
( y& g- t$ K" F$ |1 `自动挂载:8 j7 r! G) P5 M
- vi /etc/fstab
2 d8 W& _2 W1 P4 P+ Y2 M& h2 M3 \ - ; F2 B( A( S3 c+ j3 x* v
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0% g$ g! Y" P$ \$ [0 U7 G' L
- ; O7 X. v5 b6 V. u B! I9 G8 `7 h/ U
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
. e) r9 ?; X- C" [- mount /dev/sdb5 /mnt/ljp1
$ B9 c' G$ N* e5 ~4 T
! R$ U* c# S. Q$ j k: J$ q- mount /dev/sdb6 /mnt/ljp2
复制代码 8 m; t/ }% v3 L4 I }
7 g5 X9 G5 @; l
1 c( H* |4 ~; }- Q |
|