|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)9 Z! X0 N* U0 K
or: fdisk /dev/sdc (for the third SCSI disk)* K x+ Y7 `3 A8 M s
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
% E5 `% c' }, J: V& Q8 V8 y8 J or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)! N3 G9 q2 r$ F
...
- T6 d% B4 W: H x, Q- df -k; @; L) k& f3 d, o e
- df -lh2 _& x- l( ^4 Q; S8 { e1 k& D
- 查看有几块硬盘:fdisk -l) {# m, s& J& ^ W2 N- U
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点. T0 O; a! X0 j( u
/dev/sda3 3723848 705968 2828716 20% /
) ?2 D4 k8 u# T8 ^& ?3 O8 \- { /dev/sda1 101089 9274 86596 10% /boot
6 a6 d% ]! a' n; v) H none 14520 0 14520 0% /dev/shm
, N- v' Z& [0 H0 s 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
0 a: z8 i* ^+ ~7 G: O1 S3 I; N5 gDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel. i4 s& B- D( m
Building a new DOS disklabel. Changes will remain in memory only,
5 a( A6 ?9 h" A/ D, Z1 H2 H until you decide to write them. After that, of course, the previous
8 h( E; `) h$ B0 G% i content won't be recoverable.: }" P0 R) W( c( u+ G4 ]+ ~/ X2 T- e
The number of cylinders for this disk is set to 8322.
; h! S% \3 a' M0 x" Q& s* \4 V* t There is nothing wrong with that, but this is larger than 1024,6 O6 B6 d$ Y- Q j1 [
and could in certain setups cause problems with:
9 z& g4 [& ^% @8 z, s 1) software that runs at boot time (e.g., old versions of LILO)/ }" G0 c- h+ |2 Z8 D
2) booting and partitioning software from other OSs
- K; b& d9 D- N) R3 a) c (e.g., DOS FDISK, OS/2 FDISK)* |. ~7 C& ]# y/ t) @
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)/ e5 J" {! ~- B& O5 D% [
Command (m for help): p% C, E X. d+ W$ s2 C" ?
Disk /dev/hda: 4294 MB, 4294967296 bytes
: w: g) {; W+ k, U/ R 16 heads, 63 sectors/track, 8322 cylinders
3 d/ i1 T8 \8 [9 G9 I/ g( m Units = cylinders of 1008 * 512 = 516096 bytes6 q: J) M/ I, U
Device Boot Start End Blocks Id System1 ~- B9 i2 S) v7 u t6 U, l
Command (m for help): m
' ^$ e; u0 Y0 g+ e$ T Command action5 r% k9 s! V& Q
a toggle a bootable flag: V! o2 S; o( U! q- G
b edit bsd disklabel/ B! X" `6 F% A. U- A# E
c toggle the dos compatibility flag% Y9 A, k( ?$ }$ _2 k
d delete a partition
' t* `# l6 C9 t, h+ N( g; P l list known partition types2 }$ k8 p. i8 H ]1 c0 u5 [/ W
m print this menu1 e% ], o1 q- G! P0 n4 T# I2 n
n add a new partition
6 S+ |; W; A; R9 P/ O o create a new empty DOS partition table
1 o+ I' x% G* ^) v# Q p print the partition table- l: }3 y R$ B
q quit without saving changes
( J# s* F+ t7 \, p% M* o" a s create a new empty Sun disklabel0 k1 y. J& i) n" e* {& x- b
t change a partition's system id1 e3 ?* {4 i& E* X6 C
u change display/entry units
' K8 |5 [, k! A z/ b v verify the partition table! D) i/ h: A% Q" |; q" }
w write table to disk and exit) u3 Z9 l% I( F( i# g2 D" \( ]2 u
x extra functionality (experts only)
. T+ y3 ?+ L6 B Command (m for help): n: v% m: O! `1 M* D4 Z- B* F. ~6 }$ C
Command action' M, _$ u# X, Q
e extended" ?9 Y8 @7 l, h T% P
p primary partition (1-4)
& K' z) i1 U- b5 q p
, {3 j: `! M# K$ T* c2 P Partition number (1-4): 1
& f s/ a& B2 x First cylinder (1-8322, default 1): 7 Y8 ^4 u/ ^& i0 Z
Using default value 1
6 d5 n& W5 Y' T* X2 C% J Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
+ y/ Z; B! F# x3 [5 V5 V! [% c Command (m for help): p+ N% \9 q- V+ b1 w. L
Disk /dev/hda: 4294 MB, 4294967296 bytes! U, w2 r& l" v, T
16 heads, 63 sectors/track, 8322 cylinders, `9 b$ {# \9 e* Q
Units = cylinders of 1008 * 512 = 516096 bytes
: W6 ?0 q9 Y* Z* _( v+ ? Device Boot Start End Blocks Id System. X! E, j) [- k+ g5 h/ ~1 U
/dev/hda1 1 1000 503968+ 83 Linux6 h6 Y7 g3 K, V) v0 b ~2 i
Command (m for help): w* L: Y# @# A" C8 }, ~) o
The partition table has been altered!
0 G4 O0 W! X( |/ S3 p Calling ioctl() to re-read partition table.
" ] C5 k+ D4 Y Syncing disks.
; {8 ~4 N; y. B //格式化新分区1 I: `5 S$ e4 b7 z
mke2fs 1.32 (09-Nov-2002)5 {# q/ \' @/ M
Filesystem label=5 p1 y Z4 c4 d! B0 L
OS type: Linux1 o3 ^2 N$ b) q7 Q s _
Block size=1024 (log=0)
' @6 I5 I0 Y' \# ], ? Fragment size=1024 (log=0)
6 P" k- {( k( t) c) K 126480 inodes, 503968 blocks. N1 m+ U* n8 L0 B6 E9 r
25198 blocks (5.00%) reserved for the super user" I) n6 s8 a% B3 I h, O
First data block=1; Z+ s- z6 h2 J
62 block groups" m- s$ Z6 c9 c4 B2 f
8192 blocks per group, 8192 fragments per group
* P2 S: S- R5 h$ S" ]; t5 |* N 2040 inodes per group
1 K8 O- c2 z; t' ~ Superblock backups stored on blocks: 0 Z3 k5 a0 R$ \. u$ w. l
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ i- a0 {9 b( l5 Q Writing inode tables: done $ }% l- i9 K# {! _/ w
Creating journal (8192 blocks): done/ e0 K& ?5 N# S) B4 f! l: U3 o: d
Writing superblocks and filesystem accounting information: done' z7 u+ V8 t G$ P7 U1 A
This filesystem will be automatically checked every 30 mounts or
& \- }* \( ]! c4 k 180 days, whichever comes first. Use tune2fs -c or -i to override.' p0 O2 P* ^+ ?+ |1 |. }: W/ V
文件系统 1K-块 已用 可用 已用% 挂载点/ b' P$ U4 K7 S# D5 E
/dev/sda3 3723848 705992 2828692 20% /8 Y( B9 Y7 B8 l. Y; ~4 l4 }
/dev/sda1 101089 9274 86596 10% /boot8 B2 a5 Z8 E0 x' L+ d2 g& l
none 14520 0 14520 0% /dev/shm8 A1 u& Z7 @# u# G& N
//挂上新分区; O) L$ ~! U! _' U) n: y. O
- mount /dev/hda1 /home
0 w2 J4 Z% [/ U* w! ~, z ?9 I - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- n s- |- n- f; h; q: h /dev/sda3 3723848 705992 2828692 20% /
3 _6 c2 B) S m7 I. s) g6 F4 ]$ W /dev/sda1 101089 9274 86596 10% /boot, d, c$ D& E; C( o& ~
none 14520 0 14520 0% /dev/shm$ p* B7 s1 x Y, z, K- Z5 R% s" x! H) ?
/dev/hda1 488006 8239 454569 2% /home
/ f0 |! t4 `7 v, Q" V
" a8 N3 w, b9 }! H& G自动挂载:
0 z0 G2 n: r! S' W/ V- Q# K- D- vi /etc/fstab
- g( l1 K! M3 h% f/ \& W
( H+ i+ P1 f9 h C2 ^# Z! V) Z( A- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 09 x8 V3 ?- }" c, T0 r
- 3 k+ K) L. ^& G9 B2 y: O9 `* i
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:# |' u- f) { ?0 s/ {1 g
- mount /dev/sdb5 /mnt/ljp1 e3 o! w' r5 R0 V# e
- : h2 Y; Y) Q O8 D
- mount /dev/sdb6 /mnt/ljp2
复制代码 $ x- ` t2 T: U
" s- Q9 A) y- D. ?
) q$ d; z/ R: ]; M4 Q |
|