|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)4 S7 s6 K6 |0 Z5 L" f6 C9 c
or: fdisk /dev/sdc (for the third SCSI disk)" b" v8 U4 u v' N0 q! I
or: fdisk /dev/eda (for the first PS/2 ESDI drive)# x. s( D' Q6 l+ J
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
. m5 P ~2 L/ c5 C8 o0 u ...
- ]5 K t8 i$ r7 j0 |- df -k0 F! t8 G0 w: i2 ]. b
- df -lh G# b# G' @; w8 @/ u1 z) b5 I
- 查看有几块硬盘:fdisk -l+ T5 \6 b3 x. t% d$ x
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点5 F' y1 G- R' v* j& h3 `
/dev/sda3 3723848 705968 2828716 20% /
- u5 Q! c7 n9 U+ f) H4 b$ f7 T /dev/sda1 101089 9274 86596 10% /boot0 i" A) Y0 }. i( p
none 14520 0 14520 0% /dev/shm
3 X0 x0 k/ \9 s 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用9 ^7 F4 a+ z& ?# g/ B
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel; E* r" I) `% W `
Building a new DOS disklabel. Changes will remain in memory only,
: m) f3 I6 ]% m7 e+ Q until you decide to write them. After that, of course, the previous
, @( G; H/ Q6 B% t! m2 `% { content won't be recoverable.
( P7 N$ ^+ q7 I/ J1 u8 ] The number of cylinders for this disk is set to 8322.+ Y$ X8 w0 ~7 p- z4 P
There is nothing wrong with that, but this is larger than 1024,* R9 N" h$ {7 i2 [
and could in certain setups cause problems with:
+ k6 V% n5 k6 ~9 u9 i/ p% w0 Q9 Y 1) software that runs at boot time (e.g., old versions of LILO)
7 E3 `+ [. p1 V* b 2) booting and partitioning software from other OSs9 b, n+ b. ^7 M
(e.g., DOS FDISK, OS/2 FDISK)
" H* k: ]) i( |3 F8 l: { Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)1 X5 c' _/ P. J% Z3 [4 _- ]
Command (m for help): p
4 i! b. C; R* w" f' ] Disk /dev/hda: 4294 MB, 4294967296 bytes
/ P) K/ D6 t2 C 16 heads, 63 sectors/track, 8322 cylinders
9 B: l D, W2 e. \) _4 n- T Units = cylinders of 1008 * 512 = 516096 bytes+ j: f2 M: V$ N4 D# [
Device Boot Start End Blocks Id System) O7 K, [( d }, g$ U P9 l4 G
Command (m for help): m B) d0 r% [+ i$ s
Command action
( k' l# N. E) L3 N1 O a toggle a bootable flag
) f/ k' `, Q9 K2 h- n5 {+ _9 L b edit bsd disklabel" U! y' K8 v( Z. ^" ^8 F
c toggle the dos compatibility flag: O ^# U# E* Z# X1 r
d delete a partition
/ {! P* Z# w7 S1 b5 `5 T& N" m l list known partition types7 h: d9 n) a- p8 I$ ~) F$ H
m print this menu, p& m/ Q2 Y* m
n add a new partition
0 `2 P8 A& L3 I! m; Z, a; | o create a new empty DOS partition table
. Z3 v3 B: E: |: J p print the partition table$ r! t, J, m+ p" @4 `2 H# @# O
q quit without saving changes# X! O0 D; J7 x
s create a new empty Sun disklabel
# F0 P9 ]' a) [- Y t change a partition's system id
3 |+ _$ Y7 i( H" j$ { u change display/entry units
3 |% w m& h& _. r7 {8 I9 C v verify the partition table3 L1 v* w0 Y3 W, i! v: i; u* Y
w write table to disk and exit0 x0 j0 l4 F" c3 W; j
x extra functionality (experts only)% S1 l) H( T d& I( O! s& c
Command (m for help): n
8 E2 [. S. H' \% ^. a; {3 y& i8 D Command action
: H0 `! Z0 j" `5 W6 y* L e extended6 B- `$ R) P) Q) ?% x0 `
p primary partition (1-4)
; Z! H( U$ `2 d6 J& N. T: U p2 q2 p0 k5 O7 U8 C* ]' V5 h6 q
Partition number (1-4): 1 h9 w# C" }# H2 f; x+ F
First cylinder (1-8322, default 1):
+ ]' K: m; U# R( @0 y& C: [( f Using default value 1
- ]8 `, h# D2 }9 }4 a4 F Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
! g$ T- p) e3 S6 e* n% P3 e Command (m for help): p+ u& \2 L4 m' W( d0 v) s% s, p P5 o3 p
Disk /dev/hda: 4294 MB, 4294967296 bytes
3 {6 `# g6 U2 E8 M/ V, l% r( w" {# l 16 heads, 63 sectors/track, 8322 cylinders _ ~( A# J; K9 M9 }3 o
Units = cylinders of 1008 * 512 = 516096 bytes
{( Z$ w+ s* z3 t. B- F) N) i Device Boot Start End Blocks Id System3 b9 A7 ^# O( X
/dev/hda1 1 1000 503968+ 83 Linux
9 M, G+ P$ D% ]- ~% ^' [ Command (m for help): w
0 T" J, D8 I- g2 N# g# p The partition table has been altered!
( |" C" F4 y( l: ~* U Calling ioctl() to re-read partition table.
/ L3 w7 ]1 ^: S9 R8 a' J- h Syncing disks.
& a3 v, A7 t* }) W //格式化新分区1 Y7 ~. a/ s" G3 o5 G5 H& u
mke2fs 1.32 (09-Nov-2002)# G) x; c* _( J
Filesystem label=
' ^ P8 ?) i: k$ I; t' ?" M OS type: Linux
3 G2 f# `( ?& P' | ^# c Block size=1024 (log=0)
# e8 s6 J2 K- N: C' W* s5 b" n Fragment size=1024 (log=0)
2 T2 `; L/ s" t# z* o) x: | 126480 inodes, 503968 blocks3 ~5 P! |0 u6 ~: t* v! W8 A0 ?
25198 blocks (5.00%) reserved for the super user
: G& V' @& A+ w8 @ First data block=1
; j& I0 H9 e( Z4 K/ z5 C 62 block groups
Q8 W8 `% i3 ] X) I 8192 blocks per group, 8192 fragments per group0 H; K8 c/ d* g* L/ b
2040 inodes per group
8 K, G0 ?* }: B X& s Superblock backups stored on blocks:
# V& M3 |. F% L8 C) g; f 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ y+ ^& _7 G6 Y4 t# Z; }0 o Writing inode tables: done 3 t9 D B* o ~6 `: k- V2 `
Creating journal (8192 blocks): done
1 `3 c+ Q8 M$ u [ Writing superblocks and filesystem accounting information: done
0 }8 J9 U! P& L0 E* y/ j This filesystem will be automatically checked every 30 mounts or6 |2 ]4 G% f" J) P
180 days, whichever comes first. Use tune2fs -c or -i to override.: J: ^, r: a. Q5 s5 E
文件系统 1K-块 已用 可用 已用% 挂载点
2 h" D( { c+ W& W9 @* d1 k /dev/sda3 3723848 705992 2828692 20% /
$ \. c6 Y/ P, x& H% X /dev/sda1 101089 9274 86596 10% /boot
$ {, s+ t, w* y7 _" b none 14520 0 14520 0% /dev/shm" Z7 T$ n4 h& T# o0 I
//挂上新分区
9 w4 }: G7 c; u# }8 \9 A! p) ]- mount /dev/hda1 /home; U- F' `1 Q9 J7 l2 I
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
e& j$ A N x7 @' r( ? z G /dev/sda3 3723848 705992 2828692 20% /
+ h. I: F; o$ V7 h$ Q& \ o& C /dev/sda1 101089 9274 86596 10% /boot
G5 D6 t, ^( I& C. {+ S. V# w none 14520 0 14520 0% /dev/shm- Z' c% D- V. @) F8 r: i
/dev/hda1 488006 8239 454569 2% /home" i( A* V' F$ r) ^( I
) Q' w: Z2 o6 m2 r. ^" }. j自动挂载:/ Q( w' V+ g& I
- vi /etc/fstab
1 P; M. p8 ~* Y - ) K# n* \2 @; u, v
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0! i9 ^$ p- u0 W4 w" e
7 X$ |1 X* z2 Y8 Z- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: q9 u; J; Z ]) @/ A, g1 N
- mount /dev/sdb5 /mnt/ljp1+ F( y' |2 u! @9 D7 A! _0 _
) E( X) r0 }* n e6 h* ]9 U$ m' h2 {% K- mount /dev/sdb6 /mnt/ljp2
复制代码 * E) Y& m: J! I% g4 E$ i" W
5 s( i( u% H0 d6 [( q& J7 H7 C. i {
|
|