|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)& `, v2 l$ z# |
or: fdisk /dev/sdc (for the third SCSI disk)
$ m/ n \% Z- D: R5 G or: fdisk /dev/eda (for the first PS/2 ESDI drive)* U9 {' m# d( h" }( p' _) b
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
O/ Y8 n- s6 _6 n* j, U ...
s( d) K8 y3 B7 K; c' j- df -k! [; _" u( K* @* [4 h+ k
- df -lh
) ]2 T) ~: G4 L5 B - 查看有几块硬盘:fdisk -l
8 V7 n- k2 d1 k# ]1 W% q
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- S: k& x: Q! o+ b; I0 u /dev/sda3 3723848 705968 2828716 20% /; j+ j# g! @% \+ t
/dev/sda1 101089 9274 86596 10% /boot
8 O) u" S0 }6 I none 14520 0 14520 0% /dev/shm, F6 j% w9 _6 x% w0 C1 G4 Z+ t
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
6 Q' b+ A: H" w( I* F& } qDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
* H4 F& Z* q) z9 y1 c1 @: j j Building a new DOS disklabel. Changes will remain in memory only,
" \; N, z+ u, e until you decide to write them. After that, of course, the previous
) u' Z: W2 q3 y) T# U content won't be recoverable.
3 f. C" Y/ ]" t; [, _" ` The number of cylinders for this disk is set to 8322.
5 e1 X6 S8 I# ]/ k There is nothing wrong with that, but this is larger than 1024,
8 V0 L, W0 l/ e3 V and could in certain setups cause problems with:
( g6 F" y1 ^$ p3 O4 c 1) software that runs at boot time (e.g., old versions of LILO)1 v7 p) R J* n1 U G
2) booting and partitioning software from other OSs9 Q! R7 \- Q K( B0 `9 Z: z
(e.g., DOS FDISK, OS/2 FDISK)
9 h+ |6 v8 e1 D. J Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)/ p0 M3 G3 H- [- k2 ^7 E
Command (m for help): p! o+ K" V6 X& R, A( c% S7 K$ e9 ^
Disk /dev/hda: 4294 MB, 4294967296 bytes
. v2 M& `+ \. v, {5 J 16 heads, 63 sectors/track, 8322 cylinders- f4 q r( A7 L( S/ Z3 O) Y. m
Units = cylinders of 1008 * 512 = 516096 bytes
" D% S* Z" z& H- D Device Boot Start End Blocks Id System4 M$ J& S y y" y
Command (m for help): m7 R& B" W; v9 p) p; l7 M
Command action
9 n$ `& H+ x: q' p* R0 }% ? a toggle a bootable flag+ ]4 {8 c3 s% }; O7 B
b edit bsd disklabel
. o6 z! j* e# Q- _" Z c toggle the dos compatibility flag
$ A/ G9 N8 m; |% `8 j: J* f# w d delete a partition3 C7 ^$ c% k- {
l list known partition types
7 }( b1 J& ^8 P+ @. E" j0 W. V/ ` [ m print this menu
/ p9 |, W5 W2 }( E n add a new partition
: E; G7 m9 Y6 @ Q o create a new empty DOS partition table: Z$ o. M( E+ ]" [* S4 \
p print the partition table
6 _( ?6 c9 @$ ]" |9 E q quit without saving changes
( X5 U- e( ~; c! a& b s create a new empty Sun disklabel0 f, T! S7 q6 }' o# P D
t change a partition's system id
, y4 d; n, T4 x; c" K2 {0 Q u change display/entry units! w% w" s) ^; ]; M* x/ g2 l2 f
v verify the partition table8 I! y1 k0 f+ j! I- y1 H1 {6 C
w write table to disk and exit5 A: o5 r' a+ C& U
x extra functionality (experts only)
9 e4 m c4 S/ K9 b% `" | Command (m for help): n4 N% f8 n# A: A; F+ `- d4 y' W
Command action: ] D" X3 v- Y& B( B: ]8 G" j( e9 o
e extended. t, n" [: _" Y* @1 V" u' h3 E
p primary partition (1-4)
8 D/ g/ [ H- b$ F8 c2 D p
! x; T& {" z5 Q9 C Partition number (1-4): 1
1 N. B6 q6 _9 D6 e: S/ E% j First cylinder (1-8322, default 1):
, W! v8 Y$ j& H Using default value 1
; U: F" e5 G/ h' X8 I, Q6 }6 o+ N Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
' ]' F$ z4 r% p$ M2 R6 L/ s7 s% G Command (m for help): p
+ N7 A- g- T' l1 q. I" l Disk /dev/hda: 4294 MB, 4294967296 bytes) W, r$ ?3 B1 a3 V
16 heads, 63 sectors/track, 8322 cylinders
/ S6 |* _& y0 p Units = cylinders of 1008 * 512 = 516096 bytes
1 q8 s1 C& d0 \, E9 Z y Device Boot Start End Blocks Id System7 f' `$ J0 [: I* ?6 V5 F, h8 K. P
/dev/hda1 1 1000 503968+ 83 Linux) A- C% x3 t0 i; K
Command (m for help): w# e" F: Q4 a5 e6 N# D' R
The partition table has been altered!
) n- G/ e" F6 A4 t Calling ioctl() to re-read partition table.
& V+ d3 \8 H5 z, a0 P8 T Syncing disks.1 o4 @- h% g. p" D- C0 ]5 Y
//格式化新分区8 A9 D; T' t! k3 V# E' m, Y) C
mke2fs 1.32 (09-Nov-2002)# J4 c [) \7 L5 Z8 A7 k5 n
Filesystem label=6 m* e6 L9 t* T% M$ X
OS type: Linux
' j9 e6 O' R7 l6 X6 N Block size=1024 (log=0)" |; u4 `$ q- @ Z+ \8 b* z
Fragment size=1024 (log=0)5 ~8 M; y7 h) w# _/ v* m+ a( @
126480 inodes, 503968 blocks
! R e# F) C/ k1 M+ t 25198 blocks (5.00%) reserved for the super user' s6 j$ c) y* F' d; c! _# R
First data block=15 T5 V; e. v3 [. ~" Q. ?
62 block groups9 X# c) \0 B; X
8192 blocks per group, 8192 fragments per group& {8 I, i1 N) V9 r# q6 h
2040 inodes per group
8 Y! Z3 Z) p6 Z: q( k+ X' X5 h' ~/ D Superblock backups stored on blocks: ( S1 k- o; k6 N" [9 Z' l
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
+ }" S! \& p8 N. q Writing inode tables: done ) S0 v& d. q: j* T2 @
Creating journal (8192 blocks): done
1 C; [* i3 b5 [0 K7 u3 ~ Writing superblocks and filesystem accounting information: done, z: y w& F; r! n6 W5 L! K
This filesystem will be automatically checked every 30 mounts or
# E7 j% l2 L1 V7 S$ [ 180 days, whichever comes first. Use tune2fs -c or -i to override.* V1 @, {' g! l O% R% D0 ^: j' Z
文件系统 1K-块 已用 可用 已用% 挂载点
* Q2 ^0 `- q# Y5 j+ f K /dev/sda3 3723848 705992 2828692 20% /% B" D. u/ N8 j; R1 ?$ z' c4 N
/dev/sda1 101089 9274 86596 10% /boot* K0 y! A C8 _9 O X% F! X, ^
none 14520 0 14520 0% /dev/shm
! a/ ], n1 e- r2 K //挂上新分区
, _2 w$ ^* D. O- L' m8 H/ F- mount /dev/hda1 /home/ o3 W8 [* f* U8 R6 K# }) P8 Y
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
/ o, x t/ i1 y* q/ W /dev/sda3 3723848 705992 2828692 20% /
- l! h0 b7 z t/ X% h! X3 l /dev/sda1 101089 9274 86596 10% /boot
; c5 ]; w5 _7 {& q( X* v2 F+ _3 H none 14520 0 14520 0% /dev/shm& R1 n- p( Y; Y* ~
/dev/hda1 488006 8239 454569 2% /home
: l1 C* A+ W7 A' l4 T
5 |% e7 h" u! Z* V9 E/ L自动挂载:: S8 T. n" U% {- `1 r
- vi /etc/fstab
" @0 L$ g. X, I" y - - B0 ?! q' y A7 Z* E- T, D
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
* n9 D& b6 D* i
! }, G; e' n0 L' C* i- L- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
4 O2 e5 f# u' ^0 D% y$ I- mount /dev/sdb5 /mnt/ljp1$ P+ i/ c) Y. C) e8 N
5 s) v, t5 _! O9 t, E, P- mount /dev/sdb6 /mnt/ljp2
复制代码 : A2 ?2 \! a5 E- D* x* H6 r* F$ G
3 Y: t! d0 n7 X7 v+ S4 w7 G" A( n) f$ z( A; N2 c
|
|