|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
$ C% D$ f( y# I7 `7 I or: fdisk /dev/sdc (for the third SCSI disk)
! d' T# E, B) U9 R, h7 W or: fdisk /dev/eda (for the first PS/2 ESDI drive)
) a+ U0 s3 Q/ s' D5 k or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
- Y$ Y! X$ L @( o: Q, w* S0 ^$ B+ {8 ` ...
% L- a3 @! F+ |" C+ o- df -k
$ c" I5 w4 v+ ^' y3 p: a - df -lh
8 }- B3 a/ R" ~# j" m - 查看有几块硬盘:fdisk -l
: X& O8 ?3 E/ M) d O2 S
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
; j7 x; q9 K4 r3 c }5 N /dev/sda3 3723848 705968 2828716 20% /7 i# y4 b! @$ ^6 Z% U% ^% _, _
/dev/sda1 101089 9274 86596 10% /boot
[# s1 m# O- O, M none 14520 0 14520 0% /dev/shm
' e9 A4 I& z& R5 X) N 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用% k' r k9 N2 I# s) t s3 m1 J C
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
8 D6 |4 x5 S" F! r) x) o8 a5 `( ` Building a new DOS disklabel. Changes will remain in memory only,
r7 I- j+ u9 g, \4 v& \( d until you decide to write them. After that, of course, the previous3 I5 Z8 g7 c& p: f9 R
content won't be recoverable./ X6 y, E/ u p }5 B! u- O4 \
The number of cylinders for this disk is set to 8322." M& m3 \/ D7 a5 K9 S* k% Z
There is nothing wrong with that, but this is larger than 1024,5 n) I2 q, E, h- y1 F! }
and could in certain setups cause problems with: \! y3 ~1 F( D) ~ j
1) software that runs at boot time (e.g., old versions of LILO)
+ F8 V$ ]- l( {! M$ C 2) booting and partitioning software from other OSs0 R6 N5 r, x+ ~" I& O( ~: E
(e.g., DOS FDISK, OS/2 FDISK); x0 @/ n+ f+ \! _
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
1 T9 X9 c3 |! D& B Command (m for help): p
8 m3 l* h& f9 M1 S: [" o5 Z! k Disk /dev/hda: 4294 MB, 4294967296 bytes5 l- n' a4 C& ?, |5 T' F
16 heads, 63 sectors/track, 8322 cylinders0 T% }: O% e. C6 |* J v
Units = cylinders of 1008 * 512 = 516096 bytes
, h" q7 X$ M; H* k Device Boot Start End Blocks Id System
6 i3 }! u3 S( z3 Y& A6 O Command (m for help): m
* ^# }$ h) {: O" M" B- [8 U ] Command action8 `8 g# @2 N1 Q: c; D' c+ o
a toggle a bootable flag
% Q$ v' n* o# C7 h4 }! e) F; {/ h b edit bsd disklabel5 {2 N" }" K* e6 V& I$ a5 r
c toggle the dos compatibility flag% w2 q% n5 p1 }' L# Z7 O
d delete a partition0 n, g3 L% v3 G% i" ?# X
l list known partition types' `" S: u+ z8 @3 Z* i' x4 f; t
m print this menu( W V9 ?' y, S
n add a new partition
/ d4 [: i. i3 b( ?5 }8 W- m o create a new empty DOS partition table
: |$ c7 f3 u3 }: M9 |" r- P3 F! G/ d p print the partition table1 h8 [# `# T; b
q quit without saving changes
; Z; L1 c/ y$ }* M2 i s create a new empty Sun disklabel: j! h) V# A4 g6 {
t change a partition's system id0 x# K2 t8 g! R
u change display/entry units
* G/ A/ D" @ j8 C9 X2 s, r1 E {9 o% K v verify the partition table
% h: X7 I% l0 A1 V; G1 }( m w write table to disk and exit; K( y' ]+ Y7 b5 G |1 o X4 `* K
x extra functionality (experts only)
( Z5 y- U1 f) q2 o3 O9 h0 W Command (m for help): n
/ r" G- U$ C; G+ O4 f Command action
3 `8 K8 U* ]& k2 \& F e extended
- j9 x, I5 v% Q) Z1 v) ]4 ~ p primary partition (1-4)
, q0 U! I: |; i8 N8 u p* `( w3 y8 m+ S. Y
Partition number (1-4): 1( G k4 R4 Z7 V$ P; r2 F8 `- M; n; Q
First cylinder (1-8322, default 1): 4 j8 r' e4 C0 `# ~ k, A$ W. l
Using default value 1
5 j7 s( z5 y. u% t" n# L" P Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G% { {% W. P1 }) [
Command (m for help): p
6 C- f1 E$ t% ^; x Disk /dev/hda: 4294 MB, 4294967296 bytes
% {" e" b8 b/ c3 K- _) W 16 heads, 63 sectors/track, 8322 cylinders
9 p% L8 W5 i& ^2 `' Y Units = cylinders of 1008 * 512 = 516096 bytes
# _) W% y, H) m |: X1 ?. n Device Boot Start End Blocks Id System
' S" Q) n( W; J5 \3 m9 ]. K /dev/hda1 1 1000 503968+ 83 Linux
: `0 ~' Y( o9 }( G. m9 H Command (m for help): w/ I5 {% k; u& Z! O9 |, ~
The partition table has been altered!9 K2 a% h$ e) s! V; D" D; ^7 {
Calling ioctl() to re-read partition table.+ X. L5 d9 H( m7 I
Syncing disks.
# C2 ?# c% z' R //格式化新分区
5 @, V+ C7 V% y0 Hmke2fs 1.32 (09-Nov-2002)
! G; \# h6 R7 d8 s3 N Filesystem label=
$ M' G8 J+ ?$ i- F4 I- o OS type: Linux
6 L1 h: K/ }; T3 M1 ?, W Block size=1024 (log=0)/ u; A. w7 P" K; l( W7 t* U
Fragment size=1024 (log=0)
# e" n8 a* R, O) J 126480 inodes, 503968 blocks
; ?) C. }, {3 m. O 25198 blocks (5.00%) reserved for the super user
0 ~) J& T0 P" S8 ?' e, B/ L) u First data block=14 c0 I, b( t& B5 b
62 block groups
9 ?& ], _3 C: b6 b: g( y 8192 blocks per group, 8192 fragments per group
8 h* Z2 V$ U0 D+ ^5 p" F 2040 inodes per group) I/ R0 _. n. ~) V+ R
Superblock backups stored on blocks: 7 x! H/ P# s5 I" B; g. t
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
5 Z% |* `$ }8 P2 @/ P Writing inode tables: done / r* _8 t" d3 T, T
Creating journal (8192 blocks): done4 ~' l; V: L5 s. D3 n
Writing superblocks and filesystem accounting information: done
% ^9 d+ X3 L% e! |2 s* x( a1 V( d This filesystem will be automatically checked every 30 mounts or8 U7 Z$ r) [5 U# n* U: w8 A* @& j
180 days, whichever comes first. Use tune2fs -c or -i to override.
7 g% U9 l# z, e2 E& ~( K& t& c文件系统 1K-块 已用 可用 已用% 挂载点
4 Q7 w6 ^8 g, r' g /dev/sda3 3723848 705992 2828692 20% /' M! f: o" o8 {! j
/dev/sda1 101089 9274 86596 10% /boot, y& A% c5 K# _; f
none 14520 0 14520 0% /dev/shm1 k$ N* S& Q. j& I0 {! S7 v. e# B) N
//挂上新分区
" Z) u+ K& r+ `1 Z- mount /dev/hda1 /home
( u: J- x$ V3 M! @! X. e - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
" w- G2 T9 P! v1 D& w X9 Q /dev/sda3 3723848 705992 2828692 20% /
" j" w1 ?$ u- ~) B- W w /dev/sda1 101089 9274 86596 10% /boot
& ^% t6 K0 g7 m" ~9 D none 14520 0 14520 0% /dev/shm) m x8 d" E2 F& G+ H8 i% `) m
/dev/hda1 488006 8239 454569 2% /home
/ z0 c9 x8 y' P2 E; ~" {
* p3 L+ @8 b/ N& [5 } E: L# j6 t* x自动挂载:
4 A. S3 w6 s0 }- vi /etc/fstab
6 v l0 m* X$ u# X1 I3 b( I - & N: I4 V% o. i" X$ \7 }
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0 h4 ?* @. H- _ q" ^. @
- 6 h7 H8 S$ \( U5 b4 u
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:$ W7 Y3 o% i3 [( b* O
- mount /dev/sdb5 /mnt/ljp13 K, y3 h5 C! n% T- y3 H. n7 V1 h
- ( ]5 U% d- l X8 V. g
- mount /dev/sdb6 /mnt/ljp2
复制代码 7 L! E8 |: B, M, w! J4 T5 u# z/ t% n9 ~
9 S/ o0 `8 n, X5 z
. N4 S# B5 y6 Q2 W% a" f$ J |
|