|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)8 F! J i! i, x( L
or: fdisk /dev/sdc (for the third SCSI disk)
8 u; G+ [* K5 d( ~) I7 j or: fdisk /dev/eda (for the first PS/2 ESDI drive)+ r& z, G7 ]3 [9 i
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)! @: v5 g4 W2 ^& E' H% H8 _# q
...
4 R( u% F5 O- j, e R- df -k
/ d L( n: ^' R z' c5 X - df -lh
' F: k& s+ B0 T" z9 O" [4 h - 查看有几块硬盘:fdisk -l* B u4 X, X4 J" C; j% R4 t9 G& X% u
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
7 h+ K+ x7 D: w- r" ?; Z7 N /dev/sda3 3723848 705968 2828716 20% /, s0 H# I5 P( x% T$ |7 u4 p
/dev/sda1 101089 9274 86596 10% /boot7 d1 n9 L% H1 W s& C
none 14520 0 14520 0% /dev/shm
! v, {4 p6 j# u) A! ^7 V 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
' q) o! o" ^$ n: MDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
2 `$ V, a- ], ? ^# q! o; B, ` Building a new DOS disklabel. Changes will remain in memory only,5 `+ O/ K$ L, M5 z# o' J
until you decide to write them. After that, of course, the previous
# a" n2 ~4 P9 w* W content won't be recoverable.# @3 U4 U& [" n) O e3 T& K
The number of cylinders for this disk is set to 8322.
2 u2 r0 E% j( l" l) L4 q/ p9 `5 x- S There is nothing wrong with that, but this is larger than 1024,$ `5 o/ t* x+ E2 E- \# c) s
and could in certain setups cause problems with:4 N* S' h$ X3 |% M1 `
1) software that runs at boot time (e.g., old versions of LILO)
; O2 U8 G. l5 f9 Z r; S9 C7 [9 p 2) booting and partitioning software from other OSs- m0 ~3 h: D" P6 b }. v4 P
(e.g., DOS FDISK, OS/2 FDISK)$ n8 a' C8 x9 \$ d% ?. `" L$ |
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
" S2 ] _6 v) R8 A' k, e/ O' U Command (m for help): p
2 X* \$ z2 y, L; S" c+ S: h! J Disk /dev/hda: 4294 MB, 4294967296 bytes
5 |: D& R) i$ E- c5 e 16 heads, 63 sectors/track, 8322 cylinders
4 W; Z2 C# [8 T5 |0 U5 H6 I! ^ Units = cylinders of 1008 * 512 = 516096 bytes. w* R. d3 W( `: V
Device Boot Start End Blocks Id System
8 i/ Y8 c" c3 L, V3 Z9 i( U$ E Command (m for help): m
4 L6 W; N1 l4 N2 x Command action& ]- f; ~. ?& g' `' e2 D. h$ [! Z
a toggle a bootable flag: a! P( W: X- f( m4 t/ e- `/ B( v- L
b edit bsd disklabel
) ]6 W& C2 X9 Q6 t c toggle the dos compatibility flag' O, {4 v1 B+ o& p
d delete a partition
3 S! _) L$ H# ] }0 Q3 Y; a l list known partition types
8 ?3 `( ?2 m1 T/ `$ x8 R P m print this menu) s0 I# C, y6 c5 f3 c) Z% I
n add a new partition1 T" y/ T0 N" V4 D8 w# s( K
o create a new empty DOS partition table
) n( k8 T% f/ w/ b3 Z/ O m p print the partition table# S; _; G6 l9 i6 G4 ?7 w0 ]# ~
q quit without saving changes% ?' r$ G( ]- R% m( ?! W5 E
s create a new empty Sun disklabel, m( K6 _- b" ^# w1 M( V
t change a partition's system id. S* V4 ^4 ?; k* c* O
u change display/entry units
8 g# {# B+ m. o+ h1 H, I1 H" ?6 H v verify the partition table3 c3 O( H+ z- s9 |7 k
w write table to disk and exit
2 N+ t$ X& G1 j8 U. I x extra functionality (experts only); Y% {# [- P! e$ L& q6 e: W5 I
Command (m for help): n9 c p+ t+ r3 H4 ]- o6 i3 f& o
Command action: f* f9 {7 H8 r1 B9 k+ G, K3 k+ q
e extended$ e$ v. q5 Q a1 G1 d @ m
p primary partition (1-4)
; C. d8 t6 g! ?+ B% z5 d p
+ {% ~8 j! I1 ?. c7 R7 m Partition number (1-4): 1
; q" W0 D1 _7 B First cylinder (1-8322, default 1): * a$ X( a+ u7 ~: W3 i; |
Using default value 1
1 \3 u0 C5 p3 M8 I- X* V2 w Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
. U1 I5 ^* r- O5 a Command (m for help): p% g$ }% B% i' ~+ P: w
Disk /dev/hda: 4294 MB, 4294967296 bytes
. i# w$ d f- r 16 heads, 63 sectors/track, 8322 cylinders
/ R* i3 T" i* K, Q& | Units = cylinders of 1008 * 512 = 516096 bytes
4 W) L- J( u" u) z% k Device Boot Start End Blocks Id System
( n# X5 O% U* f/ T/ n /dev/hda1 1 1000 503968+ 83 Linux
6 b9 f4 v+ p1 I: I8 C* b# N7 z; s1 d Command (m for help): w9 j: w( { t% Z" x
The partition table has been altered!9 u# K5 o' E) r; }: o' f
Calling ioctl() to re-read partition table.
" W0 X& g5 U* j0 Z2 N4 C7 M Syncing disks.
1 O2 R( [# ?# U* @. o8 _ //格式化新分区
- d c5 ?8 E! ~mke2fs 1.32 (09-Nov-2002): y' M' p5 S' n$ q/ |' j
Filesystem label=
( e5 m1 C) G3 @9 \, @ OS type: Linux( M5 x$ g1 W) W- U# I
Block size=1024 (log=0)
( Y d6 g7 t' ^: L: r8 F" ^" P Fragment size=1024 (log=0)0 q2 s' ^5 S& P+ p% r3 X, g" J* v
126480 inodes, 503968 blocks7 p: E) p/ W% v C: K
25198 blocks (5.00%) reserved for the super user" T# W" `4 U9 V! K$ \
First data block=1! {' v! V3 R/ k9 H* x* p; \
62 block groups) d# X$ N+ G3 v- d' s' u
8192 blocks per group, 8192 fragments per group
7 S2 u1 m X- ^5 p# K 2040 inodes per group$ b$ M7 n2 a1 W6 x+ ]
Superblock backups stored on blocks: , b4 t! H, R! t) g# O" A7 c
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409# x, d( J) Q' O# s) T8 O
Writing inode tables: done
4 t( j& \( [: o1 u* ]7 i9 W; B; } Creating journal (8192 blocks): done, x# w( k% ~9 j
Writing superblocks and filesystem accounting information: done2 @' P' a2 T' ]! _4 C) P6 N9 W
This filesystem will be automatically checked every 30 mounts or
2 x5 ` d5 i% I, L) Z$ @ 180 days, whichever comes first. Use tune2fs -c or -i to override.
& J- |6 m A0 P文件系统 1K-块 已用 可用 已用% 挂载点
, c7 b1 p- w. i /dev/sda3 3723848 705992 2828692 20% /
' E2 `4 e6 H# p* A /dev/sda1 101089 9274 86596 10% /boot
8 F* _' M' ?7 `3 S- t; \& ] none 14520 0 14520 0% /dev/shm5 d1 F C- @* O
//挂上新分区0 Q; m2 J; G% u+ M
- mount /dev/hda1 /home5 V5 [, f7 T" \ M) @$ s+ F) u2 b
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点6 S& A5 v ]8 S) |+ P. `9 Q1 q
/dev/sda3 3723848 705992 2828692 20% /1 z$ P9 _7 w) |/ v/ p# p- N
/dev/sda1 101089 9274 86596 10% /boot$ R+ E0 K9 w* ?" Y9 M9 S
none 14520 0 14520 0% /dev/shm
% E8 ~( v+ A3 B, L5 S/ p5 x4 Z /dev/hda1 488006 8239 454569 2% /home* o, D' a# W o; { n; n: m
$ k2 w- N* s) K) B/ ~4 |, m自动挂载:/ E) U* T: J6 h3 c5 J% s$ U; d
- vi /etc/fstab& q: I( ~! H2 _, s6 {3 U, ?
- " p& @% ]5 t7 B* L1 {9 l3 C8 z
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0+ o' N1 U# P$ V0 E$ d0 N4 N
, ~ z* N" K8 ~2 J W D0 R, S4 O- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:- w# u; v1 `; e. ~- U
- mount /dev/sdb5 /mnt/ljp15 z% {" y: m% V4 I
4 F( O& l2 e9 y" f- mount /dev/sdb6 /mnt/ljp2
复制代码
! y7 q2 J* ~/ f1 d2 _- G, n' {7 m5 k
( r1 _! J% j5 n! z* V! P |
|