|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)8 r6 J% x- K- N1 P0 Q( J- a* c1 E- t
or: fdisk /dev/sdc (for the third SCSI disk)% N8 s3 S: I- v+ g) A2 U1 g9 v! o
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
) S! t$ g9 V9 A ]; X" { or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
& b" }7 i; c: |# x7 q ...
. [' g! {6 Q# ^- df -k2 W7 c/ {) X5 m2 K o" C
- df -lh
! ]1 ^3 C, I# C0 v) }' X - 查看有几块硬盘:fdisk -l0 Y' q& D/ C0 a0 ]! C& S
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
8 B. V' _2 Y7 ^ /dev/sda3 3723848 705968 2828716 20% /
8 k1 d0 D; |* |& l, G4 u7 ? /dev/sda1 101089 9274 86596 10% /boot6 w0 D4 H' R4 O; e6 _# H m7 R
none 14520 0 14520 0% /dev/shm
7 ^4 P3 ]! S- s! V E5 Z6 e# F 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用0 p9 I* V: P8 |; E2 T% E( \
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel! Q: p1 N4 E$ u: R8 f
Building a new DOS disklabel. Changes will remain in memory only,
! o9 d6 p% t+ E Z& Z until you decide to write them. After that, of course, the previous
2 {0 H& \$ y6 i& n( ^ content won't be recoverable.
2 Q8 y8 k W I4 w, V The number of cylinders for this disk is set to 8322.& `8 }3 q9 i( F7 n+ J5 E |9 L5 y) y
There is nothing wrong with that, but this is larger than 1024,
0 z& M# J9 k5 E& u0 m5 | and could in certain setups cause problems with:
, }' N, B% P7 c! \" J& f% |/ v 1) software that runs at boot time (e.g., old versions of LILO)+ b6 c" L5 l5 e* f( @* ?$ f/ `
2) booting and partitioning software from other OSs+ H3 a! k1 z1 i# F5 `
(e.g., DOS FDISK, OS/2 FDISK)
8 x5 Z# R( M; B0 r. i5 v& _ y Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
2 h& ]4 ~9 S4 C Command (m for help): p
/ J* j4 t- Q% v# I' T- x Disk /dev/hda: 4294 MB, 4294967296 bytes
F+ _' x ]. Q B 16 heads, 63 sectors/track, 8322 cylinders
& ?* t8 Y3 [- ?% J Units = cylinders of 1008 * 512 = 516096 bytes
4 M. l0 [- Q" T) \! Q) A Device Boot Start End Blocks Id System
3 Y7 H# M8 V4 C* i) ? Command (m for help): m
- j/ ^8 M; N0 J$ v r. g. ~ Command action
7 j0 o1 p- g' u; u a toggle a bootable flag
3 {$ R! N* B$ C2 @/ q1 E b edit bsd disklabel
# P: Y6 l B/ k8 \5 u% X c toggle the dos compatibility flag
# F0 ?' z) N0 |5 {/ g, r2 N0 Q( H d delete a partition4 H& O* ]0 Q8 L/ G
l list known partition types+ Q" f7 p, D3 Y: \6 O+ n" M- }
m print this menu
/ u+ c) F# j% x. s n add a new partition' X* D8 m2 }+ }8 K. @
o create a new empty DOS partition table k% U z+ T3 `, {
p print the partition table
6 w3 i) p! ]0 f" v7 N# y- ` q quit without saving changes2 c, Y" c2 L0 P
s create a new empty Sun disklabel% v7 |9 @- S$ c4 W$ ]2 R% Y
t change a partition's system id; z) a Z3 T' F2 K! M5 F1 y
u change display/entry units
. Y6 p, p! Y5 {, H/ s v verify the partition table8 y7 o1 Z1 C: {( W! R! Z# t
w write table to disk and exit6 L" T0 a9 `& q7 x6 s) Y
x extra functionality (experts only)
* f: b& K' w$ u' h- I6 I; N$ d" w$ c Command (m for help): n
- R# K, z3 Z# P. C Command action* v) I4 M6 z7 r1 ]1 L( F4 k E
e extended
$ D/ W) \& i7 l/ a+ d1 j3 B) d p primary partition (1-4)4 J% s1 \; i( L& u2 Y
p
& Z* a' ^ f6 [% y9 I" \( F' w; E Partition number (1-4): 1" d# M y# y% {7 m+ ]
First cylinder (1-8322, default 1): 7 H/ X( s* [* x3 T! s4 l' [' {
Using default value 1
* \: a! g6 v4 z2 q Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G; N/ g9 `- u0 U0 F& {- y
Command (m for help): p; D( E" J: W. Y* x! Y1 i
Disk /dev/hda: 4294 MB, 4294967296 bytes
, O& Z. j' D" y9 T9 C: v: k' [ 16 heads, 63 sectors/track, 8322 cylinders
+ p; D$ a: b0 |6 F Units = cylinders of 1008 * 512 = 516096 bytes
$ Y; d5 ]+ i, s: Z Device Boot Start End Blocks Id System2 |- W+ [0 D: B! A
/dev/hda1 1 1000 503968+ 83 Linux5 P0 W4 `4 E4 [6 r4 H) Q5 o
Command (m for help): w v3 Q5 G, Z; ]0 D6 ?1 |. _1 Y
The partition table has been altered!
+ a) K6 u! i+ T- e Calling ioctl() to re-read partition table.
2 {+ n* L. C. h+ G Syncing disks.
6 b7 ]% F# ^+ Q% [ //格式化新分区. |* O( F7 b: q, t0 t9 k3 x
mke2fs 1.32 (09-Nov-2002)4 N; ?/ |; n9 |
Filesystem label=' B' e; A2 c+ M1 t. H
OS type: Linux+ m5 ^9 W; Q' ~; y
Block size=1024 (log=0)5 s; {' F+ W; F+ N3 n8 }
Fragment size=1024 (log=0)
! T! F2 R2 J4 }5 y9 W 126480 inodes, 503968 blocks
8 E' d& C, N7 r# s3 k. v* o 25198 blocks (5.00%) reserved for the super user9 J0 K7 @9 o" ^
First data block=1
% C! R" T/ Y% ?, W4 r 62 block groups
% l. W. W" v |0 C 8192 blocks per group, 8192 fragments per group4 X! z* M' i& d, P2 r( s% Q) i' _
2040 inodes per group5 Y$ N6 N- a1 b
Superblock backups stored on blocks:
- B; Z( V1 Q z9 b% u 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409& p* f$ [) _+ d& U- v
Writing inode tables: done
5 _: M9 w( A+ F0 G; m Creating journal (8192 blocks): done; ]% \3 ^; z' }0 L7 S! N' }9 M1 i
Writing superblocks and filesystem accounting information: done9 H4 [1 A* N& H1 A5 Q
This filesystem will be automatically checked every 30 mounts or- H/ {5 F3 ^+ ^
180 days, whichever comes first. Use tune2fs -c or -i to override.
! t9 }9 N& C8 [5 C" d! x/ n- h文件系统 1K-块 已用 可用 已用% 挂载点" ]9 X! y& t! x, E/ L
/dev/sda3 3723848 705992 2828692 20% /
. ^# \% t9 b5 ^ /dev/sda1 101089 9274 86596 10% /boot7 o4 i' l$ K$ i& R+ ]' f
none 14520 0 14520 0% /dev/shm+ y$ ~; r: o" x' i
//挂上新分区: u( W" ~: F, `9 P4 G
- mount /dev/hda1 /home
! J( x' q0 ~ B7 p l1 x - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
. U3 C; k6 `8 F% E /dev/sda3 3723848 705992 2828692 20% /
( u, E6 l3 `4 E6 `* ? /dev/sda1 101089 9274 86596 10% /boot! d: @8 U% I9 W% m" l# W8 k
none 14520 0 14520 0% /dev/shm* t6 m9 C$ x, ^ W: H/ K
/dev/hda1 488006 8239 454569 2% /home
1 K/ e. k) `$ o9 G( I
: t7 p2 j! p: A' _. w! l( _自动挂载:
" v1 H* J8 w! ?0 k' G4 u" |- vi /etc/fstab+ s1 _: R: H6 D* [. Y% I4 `
- : D1 H- w+ C; `! C
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 08 H1 K J$ {6 D( l. X5 V- h
2 [5 i5 F/ l" u: [- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
0 j+ c8 Y5 x1 _9 D3 v- mount /dev/sdb5 /mnt/ljp1: z2 L5 A0 V0 f9 o) n3 W
- ! s% \+ R9 T+ c; ?
- mount /dev/sdb6 /mnt/ljp2
复制代码 , h' A. D) g( k- n. }# _) k
p" X* O. F0 X" G6 d$ `
1 w: H- z9 R- i; q
|
|