|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
4 @' A$ I, C8 G% e1 d6 R5 @ or: fdisk /dev/sdc (for the third SCSI disk)2 e! S$ E( ^5 s& p) w6 F/ E0 H, ]
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
! z" n. C# g4 Y( B! n3 L3 u or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
% ]6 r# ^* Z/ F& h4 I/ J. { ...# [5 q; W: j: t
- df -k$ j) ^/ v* I: \' r
- df -lh
$ h- ^: j/ }2 G9 ?: B U" O - 查看有几块硬盘:fdisk -l
* ?3 g& D. |1 E6 V
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 o7 n! U5 k: e* g+ o' z /dev/sda3 3723848 705968 2828716 20% /7 v0 \6 I1 M! b6 T
/dev/sda1 101089 9274 86596 10% /boot' _! \" I- H& l9 ]+ W
none 14520 0 14520 0% /dev/shm( Q7 u$ n# @0 o9 i5 R* ^
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用" n2 ~7 f% }) Y
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel U* k5 W1 k5 ?
Building a new DOS disklabel. Changes will remain in memory only,+ T. b5 T2 d% m4 O) W; G
until you decide to write them. After that, of course, the previous7 ?& z4 i- z0 a) M V
content won't be recoverable.
, b# Q" r$ O1 s; T The number of cylinders for this disk is set to 8322.
6 z. @9 h# R; [ There is nothing wrong with that, but this is larger than 1024,
: s4 E ]$ U; X4 P; c& H3 ~: M and could in certain setups cause problems with:
& e2 r% O4 W- ]2 S4 N1 a6 F0 p 1) software that runs at boot time (e.g., old versions of LILO)
T# V) f* m4 W- m 2) booting and partitioning software from other OSs
( N' J Y4 g9 {2 \ (e.g., DOS FDISK, OS/2 FDISK)
/ w/ x+ V8 E. e+ d" @; x6 y/ u Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
3 t# v; d! b/ n# C9 \ Command (m for help): p5 s9 p, k( L4 a8 J9 W
Disk /dev/hda: 4294 MB, 4294967296 bytes
; [ ]5 u5 B3 _ o 16 heads, 63 sectors/track, 8322 cylinders- d. v# L4 a5 n9 Z y0 \
Units = cylinders of 1008 * 512 = 516096 bytes6 S, S* J/ R* q/ o9 T+ i
Device Boot Start End Blocks Id System0 ~5 o- u; Z+ o( h: {2 Y' `6 h
Command (m for help): m
( U* j' |: n* x7 a3 ]' ? Command action
" h6 T: D; b: c& t& r( u* w a toggle a bootable flag
& n& Q R( }8 |0 ~ b edit bsd disklabel0 L" q5 O% c$ Y# h
c toggle the dos compatibility flag3 O5 }- ]% d9 l3 H4 X
d delete a partition: Q' k) B! Q v( k: i( @+ D
l list known partition types
& z' L R/ K9 e9 g m print this menu
6 ]1 n& O5 a% W# L$ L/ m) `9 k- F n add a new partition
7 u( S& I/ m% o7 {( W# @1 p o create a new empty DOS partition table
. B" R' S3 p) Y; Z1 N- }: a p print the partition table
, E3 N2 Y# K: X q quit without saving changes
" W7 v" E- w9 l5 _+ G s create a new empty Sun disklabel
* ]2 {# t( x+ Y( E6 I: [; i& _0 J t change a partition's system id
3 s( t9 b' g9 { u change display/entry units
P8 T$ \) z" f* ? v verify the partition table
, V# L/ _+ r( a8 ^5 B2 _ n w write table to disk and exit# n8 U; o% K* s0 t% w3 b* C* O
x extra functionality (experts only)
: j5 e, }/ G1 R3 I0 r) F* K, o Command (m for help): n
x2 ~+ ~* ^. C9 I n# [+ T$ d1 U Command action7 L, w+ F. j8 J& ]1 N8 x5 a8 K
e extended
4 O$ I' u/ d. V! k p primary partition (1-4)1 Z7 q l4 F6 q5 k# | ?* c, Q
p
4 b6 Y' A8 h1 ?( N& Y Partition number (1-4): 1
% J3 o: W7 S( B( i+ m First cylinder (1-8322, default 1): # ~6 L" {! V# E7 ^! G, a& K
Using default value 10 q1 l, ?: G) z$ L; S9 ?: ^9 e. ^+ J
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G4 M8 Q. B4 }$ T) c
Command (m for help): p6 N# ]6 a+ u! E
Disk /dev/hda: 4294 MB, 4294967296 bytes
2 \9 w* [% M5 M( N$ M% A; M 16 heads, 63 sectors/track, 8322 cylinders
. Q+ ]) O+ Y( {: ~8 t! e8 D Units = cylinders of 1008 * 512 = 516096 bytes+ N2 D- M6 _2 h* B
Device Boot Start End Blocks Id System
6 I) E2 N1 i N; J) P" K: i /dev/hda1 1 1000 503968+ 83 Linux
0 ?! F! o" J/ c E9 n3 | Command (m for help): w
: Y6 j$ M, n# a# D$ _- w4 N) j+ M The partition table has been altered!$ q: V4 s5 S' Z) v
Calling ioctl() to re-read partition table.
7 ~7 P/ E6 C3 z$ K3 { Syncing disks.
. w6 E$ S$ X- D* o6 G/ U0 p4 s //格式化新分区( x; {: G- ~1 x3 F+ F9 X' |
mke2fs 1.32 (09-Nov-2002): p Y" P! {6 b+ K- l
Filesystem label=
% C4 q: @4 p) E6 ]: G OS type: Linux M: @0 ?, `7 x0 q; J3 ]3 |" R' Z
Block size=1024 (log=0)* X8 _2 i2 n! @! a$ F, T+ R
Fragment size=1024 (log=0)
- Y8 K2 _2 s9 j- L+ t3 ]2 x 126480 inodes, 503968 blocks
( H5 ?7 b; T& d1 Q K) ] 25198 blocks (5.00%) reserved for the super user2 x5 |# G4 A- e1 k U/ H5 s
First data block=1- Y/ \, I+ w# p% Y
62 block groups
: A! A% \5 i2 N+ M9 g* L7 m( p 8192 blocks per group, 8192 fragments per group
7 L/ O4 n6 s6 t" \6 I 2040 inodes per group) Q6 d! `. t D$ d6 } c) h
Superblock backups stored on blocks: $ W4 k7 V$ g8 J* ?* V) F8 R8 g& D
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409. U6 V8 B: L& V: r6 l" P
Writing inode tables: done
" N4 i% Y# a# Y' f, ~ Creating journal (8192 blocks): done
. D7 K; e3 g; R" v Writing superblocks and filesystem accounting information: done% v8 C6 f2 a* r( g) e
This filesystem will be automatically checked every 30 mounts or A) l+ _3 V% e/ A5 f% G5 q# B! m
180 days, whichever comes first. Use tune2fs -c or -i to override.
: |6 O0 D3 X: m文件系统 1K-块 已用 可用 已用% 挂载点# \" s2 w' C% B; q5 A
/dev/sda3 3723848 705992 2828692 20% /4 Z# I" f. a8 e5 a' ?$ b$ c* _2 G
/dev/sda1 101089 9274 86596 10% /boot
\1 G# u: |! b$ Q7 d$ v9 |( v- k none 14520 0 14520 0% /dev/shm2 q+ t" |. s! d) p/ v) y6 [
//挂上新分区5 i& P; X- E) M5 r- Y
- mount /dev/hda1 /home
( I3 M* G S+ | - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点3 r3 l& S/ U8 e! {" r. H6 C
/dev/sda3 3723848 705992 2828692 20% /
2 m) j2 I1 b; A" J! q /dev/sda1 101089 9274 86596 10% /boot
- }4 i! B: f. O4 C$ l1 q8 _' r none 14520 0 14520 0% /dev/shm
+ M3 G7 ^7 q* a) Y: X: O2 \4 k! G, \1 U /dev/hda1 488006 8239 454569 2% /home
0 S3 P& d* G. L% c6 s2 J( c
: Y9 x$ m" y6 [- d. V自动挂载:
/ l2 Y/ ~/ G. |) x1 x- vi /etc/fstab4 K" {, h1 Y7 L
8 \7 Q8 [+ t) U- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
3 _. p$ p) C+ j1 i9 p: o: V$ Q# \
: R$ X$ O: Y, I! a r- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:1 f6 ^! R) t5 ?0 K
- mount /dev/sdb5 /mnt/ljp1; J E5 V. e2 G
- % U% {( @0 {' {0 E6 H3 m
- mount /dev/sdb6 /mnt/ljp2
复制代码 ; ` R# U/ q) q, c3 ^
6 u& Y }" @' U' {3 D& i
4 r6 Y2 R( w2 @/ p0 _ |
|