|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)& ]. C. q4 x+ t. V a
or: fdisk /dev/sdc (for the third SCSI disk)
: s* F* N# h2 {8 D$ _% Y/ A* A or: fdisk /dev/eda (for the first PS/2 ESDI drive)
. q& |1 A* E* {& ]8 K" T or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)5 N2 S3 Z! \; P7 D) H8 a
...; ~$ B5 y" Q/ d4 X' @6 n6 X7 j1 Z7 V
- df -k
% G0 }# P0 V* Z3 i: L2 { - df -lh
e1 y$ f: Z" }' V( d0 o7 X/ G, \ - 查看有几块硬盘:fdisk -l( g6 p7 g# x! N9 I* E" e' S$ [
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
6 n7 n1 w6 K4 }% R. s/ y( _/ S /dev/sda3 3723848 705968 2828716 20% /
8 Z4 M& R' |% N$ U /dev/sda1 101089 9274 86596 10% /boot. {5 B) T8 L5 E! x6 n
none 14520 0 14520 0% /dev/shm+ T. W, G9 M- l2 J% B: X
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用3 h/ ?2 c+ q d5 N% F% }6 j
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel1 r4 p/ q. Q0 u
Building a new DOS disklabel. Changes will remain in memory only,
$ _) z' k: M% \- H; Z3 i8 H until you decide to write them. After that, of course, the previous. k. g" h5 H2 g) G
content won't be recoverable.! j, |) ]# t" T! @: t a
The number of cylinders for this disk is set to 8322., B6 n: B7 s) V+ g
There is nothing wrong with that, but this is larger than 1024,) ^1 o0 d4 a1 }! p2 @" D' N
and could in certain setups cause problems with:
' d9 |: D9 r/ q/ Z; f; Z 1) software that runs at boot time (e.g., old versions of LILO)
d+ y. F/ n5 T- t, n' _$ f 2) booting and partitioning software from other OSs- D8 g& D# V+ D2 R1 E! [
(e.g., DOS FDISK, OS/2 FDISK)% A$ C, X6 o0 a) }3 E; G
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
# H1 q3 D( y4 A- ]- L% G2 X: h Command (m for help): p
- [9 `, l" K9 J9 W6 W Disk /dev/hda: 4294 MB, 4294967296 bytes
% N. ^, Q5 Z1 j1 _ 16 heads, 63 sectors/track, 8322 cylinders
' u# |& [: W. T) Z Units = cylinders of 1008 * 512 = 516096 bytes0 a! j3 c; q& W0 ?) y% R
Device Boot Start End Blocks Id System
8 p) Z+ ` C) q Command (m for help): m: v: i1 e" a3 L! y
Command action
/ o& ?0 _5 c, o! D a toggle a bootable flag- [! S' {# |% w
b edit bsd disklabel
1 h& R* H1 k/ k2 r c toggle the dos compatibility flag
% z. g, A( ^, ^7 e* g/ M d delete a partition
+ u9 `2 a" F: T {# `# G* Y l list known partition types
( o( z- Z2 a$ S& ?) p: h6 ] m print this menu" P; O' x% m% x' u8 O
n add a new partition
: h! X- \+ ^# {4 x7 e& q o create a new empty DOS partition table
Q* V) d V' e p print the partition table
( i+ t7 ]0 n2 c3 G q quit without saving changes
3 B6 W" H3 V, `$ N2 { s create a new empty Sun disklabel
$ b0 f/ ~$ C, R" J8 _% K t change a partition's system id' Z9 U4 Z3 b9 X0 J! ^4 H* U7 x) K
u change display/entry units
% s2 d( w# M8 b" J( k v verify the partition table
, W" H8 w9 d) N w write table to disk and exit" G' q: i0 r/ [9 _7 }8 Q7 v
x extra functionality (experts only)
) t9 m \8 \6 t" k3 Z t# o Command (m for help): n/ P: ~! h7 B* s2 x b
Command action
7 y3 Y, v; z7 Q: T5 d9 ?* h; C e extended
1 v" a/ H2 x8 f% s" b0 Y9 Y0 ?: B p primary partition (1-4)
% ^$ q' r& s9 t# s7 V! X p# B6 g+ o$ _$ l/ |" F
Partition number (1-4): 1
/ V/ e' R9 A2 W' ~ First cylinder (1-8322, default 1): ) d, |7 ^% s7 k+ }/ z
Using default value 1
7 v- b( W8 f [8 r Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
, X( U# B) S% k) B! U$ B& Z Command (m for help): p
3 o" J# ]6 e0 a8 p% { Disk /dev/hda: 4294 MB, 4294967296 bytes8 D0 m& q$ V, L6 @" k3 B$ t5 [
16 heads, 63 sectors/track, 8322 cylinders
. e$ A0 h, W3 B" d/ ], T Units = cylinders of 1008 * 512 = 516096 bytes3 `9 D( f8 n5 B" {
Device Boot Start End Blocks Id System
* ~( Q8 l1 y8 v# v' o /dev/hda1 1 1000 503968+ 83 Linux5 h/ x% O" V t8 u: O0 _/ A
Command (m for help): w
8 a2 ^' q2 N& o8 R. P4 E+ Z The partition table has been altered!
6 F$ ^ g* C1 o9 m Calling ioctl() to re-read partition table.
) I, O' g2 g: X+ H2 \5 j Syncing disks. t1 `- g8 u7 W
//格式化新分区
- h1 h# j2 |6 E0 ~6 p' Wmke2fs 1.32 (09-Nov-2002)
; J7 ^5 p7 A8 U0 m4 w9 a! K0 ~7 G Filesystem label=
' i# g: X# c$ n* p) h' x, ]; Q! @ OS type: Linux" W3 ^! z0 z/ ]7 [
Block size=1024 (log=0)
* E! i l# M! k. K4 n Fragment size=1024 (log=0)0 W% \" U0 G1 U
126480 inodes, 503968 blocks" J2 r' r3 n8 K+ L8 t7 h
25198 blocks (5.00%) reserved for the super user
# q. }: [; l& y- b3 j) c First data block=1
0 L3 X' ^' i, h& X+ D 62 block groups
8 z& H4 X4 ^! z4 k' R3 P" ~ 8192 blocks per group, 8192 fragments per group
C# T7 z$ Y% u 2040 inodes per group) j; R' e* v; G5 P8 S' m" |
Superblock backups stored on blocks:
' Y" N, o: n5 c( I3 W; N 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
9 z$ ?8 J# v& c4 Z% w% p) S Writing inode tables: done + F, M9 u; a+ Z1 x3 _# A! W p8 A
Creating journal (8192 blocks): done3 V+ D3 ?0 X- h8 I' E( @$ S
Writing superblocks and filesystem accounting information: done
- j9 ^4 \+ h6 p+ f This filesystem will be automatically checked every 30 mounts or/ G) _+ k% c* T# ?7 W0 D+ E
180 days, whichever comes first. Use tune2fs -c or -i to override.
9 Z- f1 O9 V2 q6 g5 X" `- U0 e+ d文件系统 1K-块 已用 可用 已用% 挂载点# Z+ @; K6 \! O0 c% d; H- z
/dev/sda3 3723848 705992 2828692 20% /
2 O. |' R5 `, n4 `( X! Q /dev/sda1 101089 9274 86596 10% /boot
D, ~, Z6 B" ~* ` none 14520 0 14520 0% /dev/shm
8 g) ]# M" R# t+ u8 b# { //挂上新分区9 H+ N) ]' n% x" i3 h: ?
- mount /dev/hda1 /home
7 E, d0 |* B, O* | - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
* k8 \* j `7 R8 k3 R/ Y /dev/sda3 3723848 705992 2828692 20% /2 ~( a+ L5 z6 k/ [& z, ~
/dev/sda1 101089 9274 86596 10% /boot* H+ }8 C: `6 s# E3 [/ H
none 14520 0 14520 0% /dev/shm
6 B" z4 q5 N2 P8 ]1 K2 K /dev/hda1 488006 8239 454569 2% /home
9 J; ]& i3 i# P3 `" q9 c) p) O! M% b5 T! u
自动挂载:& W( Z! L) Q5 q# v$ W1 p
- vi /etc/fstab
# I& I& ?0 e3 k0 I
' D& ~7 C4 `0 g. L; j) b3 J: J- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
- E* q9 ?7 g% E4 L) N4 | - % e: l) p0 h V U n( x
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
& A: ]- A8 x7 [- h% s7 C# j- mount /dev/sdb5 /mnt/ljp12 n' V! k+ ^# [6 N. J2 J1 i4 R5 C
- 8 k) a1 j% d0 x% Z
- mount /dev/sdb6 /mnt/ljp2
复制代码 ! _/ `( o4 M) A# m" v& V/ V' p
: q6 m# u9 o9 h5 x3 K2 ~
5 [5 \( D9 V6 }- n* V' x0 Q |
|