|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk); @, p2 g0 N6 O o; ~) B
or: fdisk /dev/sdc (for the third SCSI disk)
4 C7 q; v7 y8 |) f! r" ~0 x; T& W; F5 S or: fdisk /dev/eda (for the first PS/2 ESDI drive)
. W4 r2 F2 v+ P or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
& N1 e) K. j+ V& Q( G5 N! g ...: j) `9 A, x0 a/ w) k; y
- df -k) w% g8 X. S9 K
- df -lh
$ T* s5 z( W; B! w9 `* d - 查看有几块硬盘:fdisk -l
. r/ y( L$ X8 W7 ~+ r4 o8 z8 }
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 I/ U7 k4 Z& k, w4 G/ } P; B U
/dev/sda3 3723848 705968 2828716 20% /
* s: w; O( P- U1 S4 L K /dev/sda1 101089 9274 86596 10% /boot
O6 o I* T$ F; O" B0 ` none 14520 0 14520 0% /dev/shm0 c, H" F: o# v) O3 m2 q
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
8 F! q. M# |$ r3 U6 \8 b" GDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
# m2 ~9 C4 z, f; j5 [ Building a new DOS disklabel. Changes will remain in memory only,, \+ ?# H$ ?+ o
until you decide to write them. After that, of course, the previous" K O0 K% V8 V; J* _& ]
content won't be recoverable.( t: P" A# C; | B
The number of cylinders for this disk is set to 8322.
6 J9 V5 p: z# K; V3 \ There is nothing wrong with that, but this is larger than 1024,
$ `4 ~' m( E/ ` and could in certain setups cause problems with:
, l/ o* }+ ^; C, T6 y* f: c, a: [ 1) software that runs at boot time (e.g., old versions of LILO): c2 \' \, a& `( T5 q$ k" l
2) booting and partitioning software from other OSs
$ C( x6 e4 e6 S* z7 \, ? (e.g., DOS FDISK, OS/2 FDISK); h L& p8 t3 a. N' e, J. O5 b
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
4 {6 @ g" R) h, [- ~ Command (m for help): p
& _7 R$ T* d, b# B+ h Disk /dev/hda: 4294 MB, 4294967296 bytes2 I0 T; l9 z% L8 ]6 X
16 heads, 63 sectors/track, 8322 cylinders
5 ]) W% s5 i @& L3 o @# \ Units = cylinders of 1008 * 512 = 516096 bytes
* o6 r4 f% g u! x u) ] Device Boot Start End Blocks Id System3 z* l. o6 [4 m8 | x* E
Command (m for help): m' h! W+ ], K" y( Y. n/ I
Command action0 o1 k, r V+ f# K1 ^
a toggle a bootable flag
3 L' n& x: A) t4 x- ~# K9 M b edit bsd disklabel6 \5 a' Z( }5 c- L$ n
c toggle the dos compatibility flag- A! F9 Z, @; y. {
d delete a partition6 }3 s' u+ x- c# B7 N8 V- T/ c
l list known partition types
+ P8 e* R* {) ] m print this menu
- T3 @, L$ l0 T$ t# X n add a new partition
$ X: h! U, a3 J" X o create a new empty DOS partition table9 ]# q% H' W8 i! G6 ~8 A# e
p print the partition table
+ F5 p2 v& K& q" r8 p, W" C5 T q quit without saving changes
' q- ^+ T5 y9 M5 c+ n s create a new empty Sun disklabel
; t4 v9 y- q, [: C0 i t change a partition's system id
, f4 @* d. K% o# T7 z0 a3 N u change display/entry units
' ]: g- c# i* ^5 K v verify the partition table
* B4 m1 h. S. |% H2 s5 p3 G w write table to disk and exit
7 d0 l1 o2 M; b$ N x extra functionality (experts only)
! L% D8 K1 n( W; E: L Command (m for help): n+ B# s5 q: s, k) s& }! H: F3 ~
Command action
$ m# y; I* ]& C S. [ e extended
. B! T0 W, p+ f$ G: h! v p primary partition (1-4). f, P% G6 u* B7 i
p& g4 b0 O& w9 }. k
Partition number (1-4): 1
8 D6 q$ P" H) ^2 s! L q2 ` First cylinder (1-8322, default 1):
( \. y; g8 @/ I/ Q: x" x Using default value 12 T/ b J0 E T% `: w; ?$ {
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G3 ~& p$ \9 |( ^9 {' F( _
Command (m for help): p" A8 E. t$ \1 ?- `$ T
Disk /dev/hda: 4294 MB, 4294967296 bytes m( n) ^, ^! p8 V, X( u
16 heads, 63 sectors/track, 8322 cylinders
7 U; t) u# Q: }' H7 o& g6 I Units = cylinders of 1008 * 512 = 516096 bytes; k' P5 @! u8 J# ?8 \/ j
Device Boot Start End Blocks Id System* [; f W: }4 ~9 g
/dev/hda1 1 1000 503968+ 83 Linux# E6 Y/ f9 u- Z P# c X, r
Command (m for help): w& m: w0 Z T8 c- d
The partition table has been altered!9 m* Q% |8 U- i/ S# c( i1 q
Calling ioctl() to re-read partition table.1 n! \9 f/ E) Z2 g% B3 Q9 j0 N
Syncing disks.
& G* f% t; W, T! `; y //格式化新分区
1 N3 }; _) K1 S8 |mke2fs 1.32 (09-Nov-2002)& h( U7 l( S, `; q- b/ m
Filesystem label=+ h: e* b/ p3 e+ y8 T3 f' E
OS type: Linux
# A4 y! k& q% U- h" B. z Block size=1024 (log=0)
+ O; H. `1 T0 X- e+ m# i; ? Fragment size=1024 (log=0)
1 u, R$ r0 t) y; D* ]% D 126480 inodes, 503968 blocks& b- G. y) f; u5 h+ L5 l
25198 blocks (5.00%) reserved for the super user; T4 Q" V1 h' f$ |5 |
First data block=16 O& _& y( x+ A! y4 K0 q) H- r; l( I
62 block groups! j5 }1 P, \3 I; J9 c2 J I; B
8192 blocks per group, 8192 fragments per group# C7 z; b7 |: m& f, t. K# q5 [2 N
2040 inodes per group
5 W6 H9 P+ C, y, M Superblock backups stored on blocks:
% g$ v. H( m7 R* }# K: ] 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409; y" G" O9 L4 ^ a/ ]
Writing inode tables: done
- M( ~1 g: J9 m. [; b Creating journal (8192 blocks): done
) V3 ~* S& I; ?! L& E0 P Writing superblocks and filesystem accounting information: done9 r7 b. c4 H, h4 @
This filesystem will be automatically checked every 30 mounts or
) h; i: c2 ]& r" b0 i+ |. Q 180 days, whichever comes first. Use tune2fs -c or -i to override.
$ _: \0 t. l8 e7 [6 w. g文件系统 1K-块 已用 可用 已用% 挂载点8 g- [& a5 t, j& ]: n
/dev/sda3 3723848 705992 2828692 20% /9 ~# e2 W1 S) a/ v& x
/dev/sda1 101089 9274 86596 10% /boot
/ C. p" K2 N4 ^3 ^6 X none 14520 0 14520 0% /dev/shm
2 Z& |' B, T) c2 i+ L5 _ //挂上新分区
' u5 {/ a. Z" T; S4 _- mount /dev/hda1 /home0 E. [9 d0 ?0 X1 j4 }- Q4 k5 a
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) \+ ~3 m: i4 [: @, d2 u /dev/sda3 3723848 705992 2828692 20% /9 N1 l% H! s4 X9 F9 j& E: \
/dev/sda1 101089 9274 86596 10% /boot
" Q [! E% n: u0 l$ X6 K, J none 14520 0 14520 0% /dev/shm3 |" d/ m+ u) q7 Q
/dev/hda1 488006 8239 454569 2% /home7 z3 S3 B7 q( P' c2 {" j+ B
0 N! Z# a9 R( Q( O5 [自动挂载:$ i& v* H9 `# }- g
- vi /etc/fstab& M* d, \, }, u: R L
0 N6 L/ C; R, {3 }- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
( N" {. n2 p6 C - + ^9 S+ o) f! t1 I( g
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
7 j3 n& B6 a g6 j- mount /dev/sdb5 /mnt/ljp1' k l6 g& K/ l4 v M2 N
- , m5 }7 M. `; t9 [, `
- mount /dev/sdb6 /mnt/ljp2
复制代码 ; e$ l* K% S4 w8 R4 i& |
& ~ n& E$ x& E6 |1 M
4 w1 P4 X5 Z9 Q5 m+ y
|
|