|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)" F' k& o; C3 L& N
or: fdisk /dev/sdc (for the third SCSI disk)
8 W' @7 q x* K7 X/ Z) F or: fdisk /dev/eda (for the first PS/2 ESDI drive)
+ S+ e3 s$ I0 R1 o5 h3 l9 C7 } or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)) e" t& D, Q: t3 I# p; a, s( [
...& _/ ]3 d% U' k8 h8 w
- df -k2 a, b3 i' |! \
- df -lh
# O; D5 m5 U3 o) l - 查看有几块硬盘:fdisk -l
' l2 ^9 `0 I6 [. U/ p' q
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! C2 }) e R" D4 a" @( O& T /dev/sda3 3723848 705968 2828716 20% /( n4 w. I* v) t; g, z7 A
/dev/sda1 101089 9274 86596 10% /boot+ O9 q. `* k: W. |( G% t
none 14520 0 14520 0% /dev/shm
( L6 J8 d& o! }# t8 R0 b 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
" z9 V; w! T: Y* cDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
h/ O' w+ w$ {8 y+ z4 W8 z Building a new DOS disklabel. Changes will remain in memory only,8 q$ _0 f9 e* Y8 b$ ~( Q
until you decide to write them. After that, of course, the previous
: ^7 Q+ ?) U1 M* n! Q W1 w content won't be recoverable. ~2 U7 A4 G1 D. Q+ @- H! q
The number of cylinders for this disk is set to 8322.
; K# }/ b1 B( M9 w" e6 a1 u There is nothing wrong with that, but this is larger than 1024,
) s. g0 _4 Q. C) ]3 p and could in certain setups cause problems with:
* Z' C, J6 l' `+ L z& | 1) software that runs at boot time (e.g., old versions of LILO)' ^, U) v5 G6 G; R, ~
2) booting and partitioning software from other OSs. K# ^1 }. u! `# j
(e.g., DOS FDISK, OS/2 FDISK)
! I4 r; N4 z1 c3 M7 ]% ` Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
; E3 R9 G; g) _" S5 F+ y Command (m for help): p8 ^8 m4 b" h2 v2 V7 F. B5 o, b
Disk /dev/hda: 4294 MB, 4294967296 bytes
+ `. r# f( _' p 16 heads, 63 sectors/track, 8322 cylinders" v: x; I' e. @2 w9 t A
Units = cylinders of 1008 * 512 = 516096 bytes- X$ }' q) P# F! `5 o
Device Boot Start End Blocks Id System4 h- t2 I$ k' ?% c- B4 j
Command (m for help): m
6 s3 f& S! }2 d% W9 v6 t/ S! s Command action+ h. h, o0 C6 A7 e" I* A; M
a toggle a bootable flag! M Y* e; [( B5 d8 g# u
b edit bsd disklabel z( A1 \* j, k H
c toggle the dos compatibility flag
1 }6 J, w4 f" o/ N d delete a partition. F- g1 p) n) W+ ]* A
l list known partition types
: `6 I0 m( u& X6 h m print this menu& }+ |# X2 n: O: K
n add a new partition
: D: J4 W/ }9 f o create a new empty DOS partition table
6 J( Z5 ?- u# O5 D. p9 K; X p print the partition table
9 q1 x* P: [3 x" L4 b1 |/ C q quit without saving changes
; @0 p/ R' Z. M s create a new empty Sun disklabel
3 G6 U0 s" p, |, h1 ]+ V" i1 ~% \ t change a partition's system id* f# E2 e& f3 I: A/ W8 s: \4 E
u change display/entry units
. F$ S( z, M' \$ e0 \& R v verify the partition table
3 ^# h" v, a# e$ v& s w write table to disk and exit
( b& j( w: n9 g! m x extra functionality (experts only)
& m5 W) y/ ^5 k& d9 d: n% Z5 E Command (m for help): n& J+ ?5 D1 |" Y) j( i4 i% B$ X
Command action* t4 }+ Y* L5 t% A2 |5 e( c
e extended+ E+ e2 g0 D- @7 M
p primary partition (1-4)
/ h- O' F3 i: k; r p
! E0 e( Q }* F7 O! W, s8 c6 T Partition number (1-4): 1
8 }8 M+ h7 W0 @, |+ o First cylinder (1-8322, default 1):
2 T+ X) o: ?) E' X Using default value 1
- ~6 `/ Y. O8 o4 c: u5 }: s! r) Z Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
$ V& {4 f6 w: u! O7 G8 ]8 [- i8 s Command (m for help): p, t# p A( J) b% g
Disk /dev/hda: 4294 MB, 4294967296 bytes+ U$ n6 z) D& h1 D/ r
16 heads, 63 sectors/track, 8322 cylinders
$ e4 S* d: b0 W y/ S/ W Units = cylinders of 1008 * 512 = 516096 bytes' }" {& l; ?. _# q. }6 O
Device Boot Start End Blocks Id System
( Z" Q7 w/ u% S: N8 e& t0 t /dev/hda1 1 1000 503968+ 83 Linux
' J; x R, V+ M$ w0 a Command (m for help): w
5 u9 j9 G! Z' o The partition table has been altered!+ D% ]! h4 G& @3 R8 S' q+ A: o% R" }
Calling ioctl() to re-read partition table.
; C2 g) V3 P. E, {& e |/ S, e Syncing disks.
4 I9 ^6 B" N, z& e8 D! V8 O# e //格式化新分区, t- K2 r+ F+ B: n% f& ^4 o, }3 M7 G
mke2fs 1.32 (09-Nov-2002)
% g* j0 c6 Q, r, [' ?9 a Filesystem label=% N7 W# Y& T; L6 E" K; ]
OS type: Linux8 @# t1 P) O3 e
Block size=1024 (log=0)9 H" d# S: z* R/ Y( w- P. A7 ~% l
Fragment size=1024 (log=0)3 X/ L- g, B5 ^ u8 \4 z# z) Z. `
126480 inodes, 503968 blocks
: \' V0 o" D, n% R* r5 E$ S6 { 25198 blocks (5.00%) reserved for the super user: O8 ^) i9 k; y( `# s7 n5 m
First data block=1$ w4 h* R3 E) v8 l7 [8 |8 O
62 block groups- J4 _; H) L5 ~4 Q4 r/ u6 M; @
8192 blocks per group, 8192 fragments per group/ ~. p8 x8 B) W( C% H
2040 inodes per group
t! U5 ^2 B6 P+ c8 _+ B6 w Superblock backups stored on blocks:
& k# Q1 m; J' O+ S, c 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% |( q; ^7 r# O8 z+ S+ G Writing inode tables: done 8 E4 C& U3 e# g, Q9 F
Creating journal (8192 blocks): done
5 b- c* H" T( T Writing superblocks and filesystem accounting information: done
' F# @( A h7 }4 R. b% C0 g! Z This filesystem will be automatically checked every 30 mounts or. c- s. o8 C5 ~% @
180 days, whichever comes first. Use tune2fs -c or -i to override.
( V6 m3 |- ` E0 x+ f/ v文件系统 1K-块 已用 可用 已用% 挂载点
# o; V2 d y: p8 R /dev/sda3 3723848 705992 2828692 20% /
6 S) D2 e. U) n$ V P /dev/sda1 101089 9274 86596 10% /boot/ ^: i8 K( h. p. V
none 14520 0 14520 0% /dev/shm
3 K! u% z6 b* O8 }. K //挂上新分区
( E R* H2 C7 |- mount /dev/hda1 /home
1 F4 b. P/ ^8 @4 Q$ k- {5 u% l; g0 K - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点# c4 R3 M: H; ~ i
/dev/sda3 3723848 705992 2828692 20% /
) l! q: {/ r9 E5 N) z /dev/sda1 101089 9274 86596 10% /boot! F( N* s& a& A5 E* L3 `+ e
none 14520 0 14520 0% /dev/shm
" _4 s' l/ v) g$ F" F /dev/hda1 488006 8239 454569 2% /home
+ T9 [/ {- @* E2 C; F: Y9 K. H; y1 N( C; {- ~" x
自动挂载:9 G3 a( I2 u6 D$ D
- vi /etc/fstab" y% m2 }- x% h% p" m0 q5 F' `6 ~
# Q- Q6 Q/ o; _$ ~- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
- E7 r- x1 r' K9 P3 A" w8 ]$ L$ H
5 A; b+ e9 E# b- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:. v. t+ u9 G' r' E
- mount /dev/sdb5 /mnt/ljp1( t# y% |0 [3 h* [
- & `9 F6 v9 q! {' P6 e& ]# O
- mount /dev/sdb6 /mnt/ljp2
复制代码 O2 |$ u! ]- D1 [9 E
3 T p9 h* S0 ^3 U- ~: i# |! B7 ?# m
|
|