|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk); E% R/ W4 R( ?+ M; v8 r
or: fdisk /dev/sdc (for the third SCSI disk); E4 A2 `" u/ K) \/ _+ R
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
/ Z. U# F7 a& n. c or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices) R. |- J5 _& b; V9 j& }, {6 ^. |
...: h4 K9 u2 r7 \( c1 ]
- df -k8 |9 d& s+ C* O; p0 O$ ^* s
- df -lh7 W3 p" c" W0 p! L1 X
- 查看有几块硬盘:fdisk -l% a9 z( T% F- T& q- y
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! n) q; m" \: V1 |; {. U% V
/dev/sda3 3723848 705968 2828716 20% /4 ^+ R c3 z9 K% f0 c2 j/ w6 o
/dev/sda1 101089 9274 86596 10% /boot
$ [1 K: O) h% I* ^ none 14520 0 14520 0% /dev/shm1 ?9 E) z# T3 O) D" }8 l
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用$ [% H, T+ l+ D# d; ^% v
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel) v3 l0 o# y ?8 D7 Q: G
Building a new DOS disklabel. Changes will remain in memory only,
: z* h5 G3 j4 k P! f8 T until you decide to write them. After that, of course, the previous9 `- u9 O! v+ F4 l8 j. E P3 }
content won't be recoverable.5 T8 {( o/ n/ s: G% j& f
The number of cylinders for this disk is set to 8322.) R0 E8 ]" \4 L" r- v; _
There is nothing wrong with that, but this is larger than 1024,
( e9 V5 K# E% C3 Y. D and could in certain setups cause problems with:% n+ L6 b* K; Y: T8 y
1) software that runs at boot time (e.g., old versions of LILO)
4 L. H1 i: S4 W' T- T 2) booting and partitioning software from other OSs
( ?, m) {* U# O3 v, E+ K& d (e.g., DOS FDISK, OS/2 FDISK)% z8 b- r9 Q" m* F7 p' g5 U! p; l
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)3 ^8 L. J0 a |
Command (m for help): p. }! }3 j6 d8 @. J- f
Disk /dev/hda: 4294 MB, 4294967296 bytes
( [" o ^$ `+ S1 o! X- v0 s 16 heads, 63 sectors/track, 8322 cylinders8 E, I) h" Z) E' u# v. s
Units = cylinders of 1008 * 512 = 516096 bytes6 v% @. N5 n( o( A
Device Boot Start End Blocks Id System
: F, `% R% @" s7 J' E Command (m for help): m
; w. P/ x# v$ S p, N Command action" E8 ^0 q3 @5 q6 {+ Z( `2 B$ u% ^
a toggle a bootable flag
( v1 G& {& I3 A! ^2 V b edit bsd disklabel
) `0 d8 F" p: H* z' ] T c toggle the dos compatibility flag
, ^6 u, p+ U4 U5 ]+ c d delete a partition# C$ G5 X/ @0 N: Y ?2 P1 e
l list known partition types- J( C5 K0 i# P- k/ B
m print this menu' N7 y& V( i3 c1 v. }) m& d
n add a new partition! E+ _6 W- F3 Z! M1 b4 A& o# t
o create a new empty DOS partition table
! w; u; G% e8 _! _# q& v$ {" G p print the partition table
# A7 s: `. H+ C: Y p; ~1 }/ y1 e q quit without saving changes
7 O1 O) i& {, [- Y s create a new empty Sun disklabel
H: l2 u8 j2 g t change a partition's system id
0 h0 d$ z4 D$ E2 s+ M+ }. P& e u change display/entry units
3 Z2 {" O4 |2 L( M1 j v verify the partition table
9 M8 m2 g5 D& e w write table to disk and exit6 }" H) Z% T4 a
x extra functionality (experts only)! O8 A& E" T4 w" R# }6 m: ]
Command (m for help): n
& Z# b9 }; R1 b9 `! \' j: ^7 a0 k Command action, R# `- |' R. H" R# H
e extended! R7 h2 s1 b; i8 Y# v8 _
p primary partition (1-4)
: t% x# R% X: b2 W, w( D& h p! w, m3 Z; r; f% W% n. {7 o4 m3 K# j
Partition number (1-4): 1
7 I4 h/ P5 l- W First cylinder (1-8322, default 1):
, K4 B1 ?2 S! H& S+ H) L8 s Using default value 1
" G+ M. }5 n: V; n w6 w+ ] Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
, d# P3 |/ N! S& M2 j C4 [$ X Command (m for help): p
- u0 z, d% ?" S1 G1 z Disk /dev/hda: 4294 MB, 4294967296 bytes
: t5 x1 ]: J; ]7 ~8 j 16 heads, 63 sectors/track, 8322 cylinders
5 b( Z( d: [& F6 p4 p+ i Units = cylinders of 1008 * 512 = 516096 bytes
; A- ~4 w( Z% f Device Boot Start End Blocks Id System8 Y4 L$ W8 z- @' K
/dev/hda1 1 1000 503968+ 83 Linux
' D+ s+ C) W# c% P7 e: g n( W Command (m for help): w( }, ^" ?# q4 ? C' _3 |( f( ^
The partition table has been altered!
: T7 P3 F, x9 G; p$ E2 l" p Calling ioctl() to re-read partition table.
+ ]7 d% n* ?3 l0 D! o4 ~- y0 W' U9 x; R Syncing disks.$ k5 E- a5 ]% R* `
//格式化新分区
0 t. O- U* M1 d# imke2fs 1.32 (09-Nov-2002)
1 {+ g! ~* Z. t Filesystem label=
% k$ r3 [5 ~, g( W% [/ E1 m OS type: Linux
" j/ U& C* ^7 A* U; } Block size=1024 (log=0)
7 k% T- P# W6 e' o Fragment size=1024 (log=0)
+ ^; } f) W$ A, R: {) U! u( }5 d 126480 inodes, 503968 blocks) c# \ y8 Z+ a6 n' H
25198 blocks (5.00%) reserved for the super user- f* w/ Y& t0 L. J
First data block=1- ]( X4 H# B2 ]/ B2 t& \
62 block groups8 G \1 v3 W& l
8192 blocks per group, 8192 fragments per group
: }0 U8 t0 ?2 Q& u o: T( g 2040 inodes per group* h0 O# `; O# V
Superblock backups stored on blocks: / t, j' `! `- L) E. |6 d2 W! W( ^
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
* O( G" P# Y/ N. k Writing inode tables: done " N, H4 Q: r0 m( g+ [5 }. m! c# u
Creating journal (8192 blocks): done
/ P5 N0 U& `- O9 q6 t Writing superblocks and filesystem accounting information: done
) J+ D: a G& V( ? This filesystem will be automatically checked every 30 mounts or8 H% i; _1 |! {# E
180 days, whichever comes first. Use tune2fs -c or -i to override.
( I! N2 j/ r# `# o6 G文件系统 1K-块 已用 可用 已用% 挂载点- `4 g, R% N# H, U( A M+ ~* h& l
/dev/sda3 3723848 705992 2828692 20% /
& f5 e1 I0 b q$ x, D /dev/sda1 101089 9274 86596 10% /boot9 N' u) [5 l9 {6 ]
none 14520 0 14520 0% /dev/shm
1 n6 _8 Q0 ~2 `. J7 q% L6 S //挂上新分区
/ p1 J2 ?6 i4 M q5 Q7 f- mount /dev/hda1 /home, W; ?! n1 u% D2 F
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点* ?& W* O+ g* d0 r3 @
/dev/sda3 3723848 705992 2828692 20% /) l r9 o7 q1 i+ r# z" E
/dev/sda1 101089 9274 86596 10% /boot6 j: R! f9 a3 s: I! Q, e8 \
none 14520 0 14520 0% /dev/shm( ~) H/ K2 d- L2 j+ v
/dev/hda1 488006 8239 454569 2% /home( c# T. [. c* y7 [; x; u7 c3 k% Y
- L( Y2 h1 C4 K9 |
自动挂载: h9 A* Z4 a9 \& W6 X: c
- vi /etc/fstab
! p0 `( t' v" ^7 \) N+ X" W
3 n5 g" E" k9 q0 R% J8 R; w, C' p- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0 ?+ V+ L- w$ d$ n6 p' S8 u5 M
- : Q3 K2 D1 v. U( s: P; N& _. r( t f
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:* V$ N' G6 M0 T4 l* a) [! t
- mount /dev/sdb5 /mnt/ljp1& h7 O) {0 f9 l: J
0 f5 r% }( ?3 x- P8 \- mount /dev/sdb6 /mnt/ljp2
复制代码
9 w' z0 ? ^, ?- j( Y; u0 D& | n$ p. A5 V7 H- U
' S: D6 f/ t$ ~5 n4 k) v |
|