|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
% w( z6 ~ t- A7 D or: fdisk /dev/sdc (for the third SCSI disk)" i' y- g7 A9 I4 _' K3 E
or: fdisk /dev/eda (for the first PS/2 ESDI drive)% b1 R2 W3 T% j& a$ R1 S3 i
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)* l0 [( Y$ e1 r: J
...# N2 g' p6 F& k, p$ D% |6 O
- df -k/ h) y4 B* r, k, |% h2 _
- df -lh
/ p1 R w$ x" u' n3 `) h - 查看有几块硬盘:fdisk -l' ~+ T) H) z: b5 r' t# f" z
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 Q0 {2 {9 J1 r/ d8 |" @ /dev/sda3 3723848 705968 2828716 20% /& s5 Y& [& B0 m
/dev/sda1 101089 9274 86596 10% /boot5 O! k& G# `- C! w: @
none 14520 0 14520 0% /dev/shm
6 W6 ^5 i( v3 _+ o: n' d 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
' }8 [! H/ ~+ c$ U7 s5 h6 O" lDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel$ F# }; u) U( N. ?" \2 z
Building a new DOS disklabel. Changes will remain in memory only,
1 _" R, s1 j, l5 r& H- B until you decide to write them. After that, of course, the previous
' E3 i4 @" M4 P6 V1 r/ o8 F" b content won't be recoverable.
& x. Y1 R$ F1 g; Q7 b! M The number of cylinders for this disk is set to 8322.# L5 ~6 r. X$ d) e% y: z4 V
There is nothing wrong with that, but this is larger than 1024,% N B) \6 ?8 |, n$ U5 x
and could in certain setups cause problems with:
4 h g9 N/ ~% W8 {3 n 1) software that runs at boot time (e.g., old versions of LILO)- x+ \ a+ J/ \% A* I
2) booting and partitioning software from other OSs
( s; k e, u5 V6 z (e.g., DOS FDISK, OS/2 FDISK)
/ H$ W8 ^0 y2 s Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ w0 @- |# `8 V- W5 E" P- }8 h' ]$ B! x Command (m for help): p5 b1 i9 z. E( D7 S& c7 e2 K
Disk /dev/hda: 4294 MB, 4294967296 bytes& ]# c/ q7 p/ K: i
16 heads, 63 sectors/track, 8322 cylinders
- \3 I) P: T/ n" t4 L Units = cylinders of 1008 * 512 = 516096 bytes
; N" R. Y8 H7 f1 R4 n Device Boot Start End Blocks Id System
! [0 m+ a* t) @* U) \! s# p Command (m for help): m) v* i y$ F8 k* F# P- z
Command action' Z, L+ T, {. z" r7 {( |( @
a toggle a bootable flag; W$ O! s. L! T( R4 `- n/ Q$ D) P- s
b edit bsd disklabel# Y' ~4 p% K3 v4 A* {5 G
c toggle the dos compatibility flag
" a) t: E( f, H$ ] d delete a partition3 v6 \6 s7 B5 r/ F8 u; p
l list known partition types' C7 N* t: D: C& l
m print this menu' t: Q0 F4 d7 H9 x- T3 S
n add a new partition' F' u; d7 X- @5 X9 x6 x/ |) u5 |& j
o create a new empty DOS partition table
. d. Z( s7 a J! }0 c" w7 Q p print the partition table
1 u% `& G4 A% i* {" ]5 S1 ^! d q quit without saving changes
0 D; Q/ u. Y0 @5 x l9 W$ g s create a new empty Sun disklabel2 @- n& M7 N( _# g$ v$ y
t change a partition's system id
: Q$ F% X1 b9 _8 d u change display/entry units7 | F$ s- i. X/ u/ J2 E B! Y
v verify the partition table* K7 g4 G, l2 o
w write table to disk and exit
4 j5 j8 {- J6 H4 s. m; ?- A6 i x extra functionality (experts only)& D0 L5 B# d9 C- v% Q* J( ?
Command (m for help): n2 |9 }$ v9 ^" j0 n6 h* i
Command action+ Z: c, F J5 L$ q, W/ X$ y
e extended& e* T, n) ], q# p
p primary partition (1-4)
+ e5 h6 @( C+ y1 ?6 [ p
% v' c- Y) U. J' W! Y3 _ Partition number (1-4): 1" K- A1 r% O/ q- t# U
First cylinder (1-8322, default 1): : E7 `# G5 S% U/ z
Using default value 1
+ g/ P3 N# D. w0 | Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
4 j7 G7 ^! b; p Command (m for help): p
2 {0 H0 o2 u* c' x$ g2 Y0 E& ] Disk /dev/hda: 4294 MB, 4294967296 bytes
L+ L! L X7 N. F" T 16 heads, 63 sectors/track, 8322 cylinders! m5 [8 g9 L* d+ q7 {9 L9 X
Units = cylinders of 1008 * 512 = 516096 bytes3 A; n4 _/ {5 B
Device Boot Start End Blocks Id System' E, q. A6 H& D, `8 }( \
/dev/hda1 1 1000 503968+ 83 Linux
4 z" U- M! k9 e! b% D. y# S3 j Command (m for help): w
8 M$ D0 T2 y v3 W The partition table has been altered!
2 F R; O# G$ K1 O5 R! Y: z! ~0 F Calling ioctl() to re-read partition table.
7 N& { a5 X( Q0 n Syncing disks.
2 J2 n0 B" k2 w: D //格式化新分区. v i, M2 x ^; O5 t* N5 s; q
mke2fs 1.32 (09-Nov-2002)0 R) x, h* j$ X9 w
Filesystem label=
9 M: G' X! c8 ?" t0 f# Z4 n OS type: Linux8 J- x6 Z# H2 }. Z/ F
Block size=1024 (log=0)
4 M" n* D% x! l8 I0 A Fragment size=1024 (log=0): U, }; `5 E: I
126480 inodes, 503968 blocks# M& Z% f. Z' D# c- N, p
25198 blocks (5.00%) reserved for the super user3 c# [) o1 |0 P2 U
First data block=10 W# J( {" o. A( A# m, x
62 block groups
S5 J3 V1 ^& \2 D, _ 8192 blocks per group, 8192 fragments per group
6 Z0 W9 S$ W5 o 2040 inodes per group/ F& T: @) b; H" T0 n9 u" E3 K
Superblock backups stored on blocks:
9 q& [$ Z9 `' V7 S 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014092 f2 n6 ]/ h7 T/ _0 A# A
Writing inode tables: done
; W+ A. X; M9 c3 i9 i `; w5 H6 \ Creating journal (8192 blocks): done
8 Z$ @: x1 E9 l9 f Writing superblocks and filesystem accounting information: done+ K( a4 D) Y8 M, Z: c
This filesystem will be automatically checked every 30 mounts or
+ S7 Q- f, \, o) A 180 days, whichever comes first. Use tune2fs -c or -i to override.
$ P" L" p. Q, M5 d* e- h文件系统 1K-块 已用 可用 已用% 挂载点
) `! T2 F0 D) }7 c/ ^ y+ W7 ^2 x /dev/sda3 3723848 705992 2828692 20% /
5 T! A [' q2 ~ /dev/sda1 101089 9274 86596 10% /boot) t+ B+ {/ F' b
none 14520 0 14520 0% /dev/shm9 c: h& T0 {9 I& F
//挂上新分区
; g6 O9 W2 d& m4 j: X' l0 }- mount /dev/hda1 /home* V. z( ]8 x) V5 Z. x9 A
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! L& t- c; M5 Q, T, t% O
/dev/sda3 3723848 705992 2828692 20% /
}" q( l, N( R: L+ N I /dev/sda1 101089 9274 86596 10% /boot
% o8 q9 |; m( m. X+ K$ A; S none 14520 0 14520 0% /dev/shm
) _" v+ f" B4 I. @ /dev/hda1 488006 8239 454569 2% /home: h7 `2 D* x0 E) i
3 M, W4 P% B8 S3 L! R自动挂载:" _& Z* Q; x7 S( i& l7 U8 X
- vi /etc/fstab
, }& `- j0 p' n8 E2 T' H- I5 E
+ P* _4 ~, }4 b$ j/ Q4 u- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0 [* k5 H" }+ D
% f8 i- u T, {9 J' B- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
8 Y [" Q4 @5 T- mount /dev/sdb5 /mnt/ljp1! x" J& f$ [4 e: y n: J. w+ I) e
- ! P$ a5 P; a: z. S7 L. k1 ?8 l
- mount /dev/sdb6 /mnt/ljp2
复制代码
! s% ?6 C: q5 X8 E: g& b
) I9 M! R" y' v8 P9 ?, w1 N% w/ f5 F1 ~2 N" m& l) u
|
|