|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
, z; T( g9 }" l* _* K or: fdisk /dev/sdc (for the third SCSI disk). N$ w* b% ?* t2 }$ _
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
2 h9 q/ R; [4 i% F0 i or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
( ]* X) o, Q. H/ p; U ...
6 |8 f2 d2 g$ k) h- df -k* c3 L" H- ]; |8 K8 m4 o
- df -lh
& C a. t8 v8 c- g& y5 k5 h - 查看有几块硬盘:fdisk -l* h- B2 @) ^8 u. j6 P
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
% E) w, p' G8 B! U /dev/sda3 3723848 705968 2828716 20% /; Q- T6 F3 z* _: ^# g$ F5 J+ v9 ]9 _
/dev/sda1 101089 9274 86596 10% /boot
$ f8 B2 ^0 q2 ]- @: _9 a1 I none 14520 0 14520 0% /dev/shm$ ]# q- ~& N) m# S$ w4 m1 q: c. |
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用- h% f0 j6 |# }/ O% h
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel$ [- V. v: u3 k! [. P( b
Building a new DOS disklabel. Changes will remain in memory only,
' ~( D0 Q$ q# \" D' ` until you decide to write them. After that, of course, the previous$ t m2 p3 t+ l3 b4 k9 @8 C
content won't be recoverable.
2 a$ l( r6 E Y1 U7 m The number of cylinders for this disk is set to 8322.4 L$ W& L7 e& ]( J& u
There is nothing wrong with that, but this is larger than 1024,
8 D4 {) p; b/ z0 J and could in certain setups cause problems with:* s. d4 {3 A4 Q( M
1) software that runs at boot time (e.g., old versions of LILO)3 Y1 t" K( L# I9 y3 W9 N
2) booting and partitioning software from other OSs
r2 g3 o7 c: L( [ (e.g., DOS FDISK, OS/2 FDISK)+ F2 O3 A9 n9 {% t
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite), J- a. v: d, h/ B0 h v, R
Command (m for help): p3 U/ I; H( c' K4 V) Y/ v3 m/ V, V* D
Disk /dev/hda: 4294 MB, 4294967296 bytes9 q6 G' ~+ j' F1 B! [* H
16 heads, 63 sectors/track, 8322 cylinders a7 U$ b+ g) c- y
Units = cylinders of 1008 * 512 = 516096 bytes" X6 F* Q# Z1 h0 u, }
Device Boot Start End Blocks Id System
1 U3 S7 B8 q0 R: O Command (m for help): m
3 X2 X& I2 I) M3 f7 ^ Command action
, x7 H# B- f4 y a toggle a bootable flag
, w8 o! d( C9 o( U: s o+ D3 D b edit bsd disklabel% W) c# d% o S9 E
c toggle the dos compatibility flag3 @% Q) N1 c0 h$ j% Y
d delete a partition5 }3 Y% n# ~" o$ e% |
l list known partition types( \' B. o9 E1 O4 C
m print this menu7 w2 M- n" V7 D. R7 \
n add a new partition
9 U3 q; k% e) K, Q* R: W o create a new empty DOS partition table
9 k' C8 z4 P Y* Q. @1 T% C p print the partition table
2 {" u, k7 d% R q quit without saving changes
0 a) d9 A- J* B& a s create a new empty Sun disklabel
: c: a* q1 Z# I( e" n t change a partition's system id- B$ {! n3 C) I5 E. ]6 R
u change display/entry units& l' {+ V4 H; q& i
v verify the partition table1 k6 V! o. e% \7 x
w write table to disk and exit
% h; @# z) E7 j( Z( c9 Y x extra functionality (experts only): E: ^, M2 e& o3 `# j
Command (m for help): n8 K+ }% d& H5 ?' x! k7 e3 K
Command action$ J8 |; L2 B$ ~0 [; V
e extended. ?* @6 ^/ b, d. J, \' Z4 q
p primary partition (1-4)
6 L3 p+ u* U2 Z+ L3 z p: P6 }% O" \ F
Partition number (1-4): 1
+ J; n4 k$ O4 s& d First cylinder (1-8322, default 1):
( F. c* B. J7 D+ A3 [$ A1 a( z Using default value 1, \/ T$ T+ \% o: ~" k9 q4 {; t9 e
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G: I! F! r1 h0 H+ n
Command (m for help): p( e! }2 n I/ B2 k* h+ v
Disk /dev/hda: 4294 MB, 4294967296 bytes
9 ^) Y! B! a0 n& @' f* C 16 heads, 63 sectors/track, 8322 cylinders
) }4 g1 s- M) Y8 t8 `& ]7 V Units = cylinders of 1008 * 512 = 516096 bytes
! g- W: t0 A. ~ z, {5 y* Q8 ~ Device Boot Start End Blocks Id System
p+ R( P/ n) n7 P, R! Y% r- g9 y /dev/hda1 1 1000 503968+ 83 Linux
3 P4 C' d- t, h9 J Command (m for help): w
5 r* w$ D. I# M& A% u The partition table has been altered!+ _, T6 l# E/ W5 Z
Calling ioctl() to re-read partition table. v+ Y* C( e( ^! [8 v
Syncing disks.0 d+ Z; _( Y+ j+ e4 o/ ?/ X
//格式化新分区( v7 |% A; u. [" V1 }& {) i) `, G4 a
mke2fs 1.32 (09-Nov-2002)8 {2 ^# s+ E! i4 N; _5 e6 ^2 y9 |: I: x
Filesystem label=
" l, G0 x7 q1 ]; L+ \ OS type: Linux
9 D- J2 l1 X V# v Block size=1024 (log=0)
/ E: a6 R3 e$ ^( h3 D) q4 l Fragment size=1024 (log=0)
, {& S' {4 ^4 o- C* ^* g 126480 inodes, 503968 blocks, _! c0 w! V1 B1 |) a% o J8 ~
25198 blocks (5.00%) reserved for the super user
, c1 G: b$ m: Z8 W First data block=1$ R x% E8 Q( x7 L5 p& R4 Y% O
62 block groups
; t- v# x1 E( K 8192 blocks per group, 8192 fragments per group
% B3 }2 p% w# f0 W4 B3 ^ 2040 inodes per group' g7 ^ h9 ?5 Q1 g! y! M
Superblock backups stored on blocks:
% u4 P! J( f" } {1 m- d5 K 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
" c. L. A4 G# u N8 R. } Writing inode tables: done ' ]; K& }. s% X8 M
Creating journal (8192 blocks): done8 ?3 `9 o! n* f
Writing superblocks and filesystem accounting information: done
) D# w |3 y+ W; q" K1 K5 e This filesystem will be automatically checked every 30 mounts or
' d9 q6 C9 b/ Z6 j 180 days, whichever comes first. Use tune2fs -c or -i to override.! c2 D6 d) E* p: p
文件系统 1K-块 已用 可用 已用% 挂载点
' T# K: z, Y7 F( l2 R8 R+ m& q3 { /dev/sda3 3723848 705992 2828692 20% // k1 l: @5 s# g$ C: O
/dev/sda1 101089 9274 86596 10% /boot! e4 Q+ w. `& } o- M
none 14520 0 14520 0% /dev/shm
- w4 \& x1 c7 t8 I9 Y* U //挂上新分区( M9 i& j- @/ r# B& u& r
- mount /dev/hda1 /home- k8 W3 G1 I" N: Z2 `- u
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
w9 }) _; W ~: Z; \; n- A' u* { /dev/sda3 3723848 705992 2828692 20% /
2 t6 h4 c( Z" b; y7 A) T /dev/sda1 101089 9274 86596 10% /boot' Z9 r6 r+ q" E/ W- n
none 14520 0 14520 0% /dev/shm
; t ]3 w7 C6 S /dev/hda1 488006 8239 454569 2% /home: g" p% I% J4 G- n
# r4 Z2 |' l5 S, Z! B: }1 Z5 F
自动挂载:8 K' m' s# m) z# u
- vi /etc/fstab
3 Q0 ]- ^* g% h) l - + i+ q0 x, n" Y6 `/ r& }
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
& V# `0 A! s2 }! P
( r9 n. Y# f9 x; d. l; Y2 W- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:8 z3 P5 Y9 V: s
- mount /dev/sdb5 /mnt/ljp16 k5 W8 [0 U. V, |
- # y: m3 @6 t p0 I- _
- mount /dev/sdb6 /mnt/ljp2
复制代码
# n) q; e/ x) w# v) W" o9 q4 v+ `6 v& A) }
( l, c' Z. A6 m0 | |
|