|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
0 p. {3 D3 }5 t/ K or: fdisk /dev/sdc (for the third SCSI disk)" ]& d: V4 X% Y7 T: y' z* ?
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
6 N9 G* a- y4 E6 ~ or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)! E. f* w2 \% d
...; z c/ F q" h5 T, t- U
- df -k" F" M% w2 h9 N0 n% c
- df -lh( o6 o. z2 X A2 i
- 查看有几块硬盘:fdisk -l6 L$ `* J) o9 m8 L0 Z4 e2 Q8 _$ r
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
7 r9 O( W3 o, i. g, P /dev/sda3 3723848 705968 2828716 20% /
4 K9 h1 T# b" Z /dev/sda1 101089 9274 86596 10% /boot# x, H1 t, s' i. \( z2 F* u& X
none 14520 0 14520 0% /dev/shm+ u0 \& V- j' d! k
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
8 p% P! X% c; \ j3 k1 P: `, E5 v8 GDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel0 N* B4 Z7 H: s: Q v, R# P, f9 Y
Building a new DOS disklabel. Changes will remain in memory only,
# }4 U$ b8 f( I) y6 i! M until you decide to write them. After that, of course, the previous! V2 }- Q7 e$ d
content won't be recoverable.& r% J6 w& O* l# m! c
The number of cylinders for this disk is set to 8322.: M! c# |/ Z3 n% X- O3 Q
There is nothing wrong with that, but this is larger than 1024,, A0 X6 J. e8 z+ K5 J2 {
and could in certain setups cause problems with:: P) m* W8 R6 x# |
1) software that runs at boot time (e.g., old versions of LILO)- I5 V5 R0 X) A1 n" W
2) booting and partitioning software from other OSs2 E' V: E3 \% a4 Y1 Y4 E% x
(e.g., DOS FDISK, OS/2 FDISK)4 ~1 M# B2 k4 L L) Y1 M. O
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
! ^. q1 C. z: `% F" w' M! T; ^ Command (m for help): p4 g9 Z3 o" L3 f' J) j; w5 C; y
Disk /dev/hda: 4294 MB, 4294967296 bytes \4 U$ ~0 f& Z1 o# g* Y; }
16 heads, 63 sectors/track, 8322 cylinders
' m9 H5 n# f" Q# E0 q Units = cylinders of 1008 * 512 = 516096 bytes. Y1 s) w) u* h
Device Boot Start End Blocks Id System
* s$ K8 Z' Z2 M7 g Command (m for help): m
& e0 u/ c- D. r3 R7 A Command action
3 k a( N+ Y, q# F8 ]# z a toggle a bootable flag
( v {* y9 E ?4 B% v$ ~8 s b edit bsd disklabel- i3 f9 `! S, b9 b4 i
c toggle the dos compatibility flag. T) ?* p1 F9 S3 C0 {, s- B! o
d delete a partition0 M, F0 x, u9 ]/ O: n
l list known partition types
4 L- \5 U5 b. V3 }8 a9 }, i+ V m print this menu( o5 @' H; q4 ]4 I9 F
n add a new partition
4 t6 _8 g; J j o create a new empty DOS partition table& q7 c O1 @' F; s( L, m$ u8 G
p print the partition table
5 l6 m$ B0 Y7 _9 M9 J& q q quit without saving changes
- [8 V( [2 F& |$ T- A# e: M s create a new empty Sun disklabel; f9 G* W1 X& k& s# J6 @4 c
t change a partition's system id" g, |3 {) D( F& V/ I; r
u change display/entry units
, D9 t$ M8 X" i: O v verify the partition table
5 R3 b4 X4 k! i- a w write table to disk and exit% v8 U2 e+ P4 t, X% J
x extra functionality (experts only)' m g8 f6 q/ \7 c2 _) \+ \0 W
Command (m for help): n' o7 h" W6 S2 J, U3 h/ U
Command action
v. t+ X/ V/ X- B e extended
0 n# A0 N# \- @+ X; P% q8 c p primary partition (1-4) N3 b; C9 C7 o& p8 ~' Y" ^% {
p
! U8 A1 y) T: K7 N- W1 n Partition number (1-4): 1
% e0 [' j6 n8 f First cylinder (1-8322, default 1):
4 J) J6 X2 e7 x" f- c5 o Using default value 1( I; w! S9 u+ P3 \
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
+ c& B1 E! O& h9 L9 U/ l Command (m for help): p- }3 K' z! c& z4 } k
Disk /dev/hda: 4294 MB, 4294967296 bytes
, |: o' ` I# }0 G' y' Z4 @ Z; B 16 heads, 63 sectors/track, 8322 cylinders; v& X$ A" O/ G6 Z. e9 @2 y
Units = cylinders of 1008 * 512 = 516096 bytes8 N2 e3 y0 q7 I! P4 i+ C$ v! }; `
Device Boot Start End Blocks Id System
' c; u7 r- n/ K- L0 \1 B /dev/hda1 1 1000 503968+ 83 Linux
* g6 A+ x, _8 n z Command (m for help): w5 D6 f. u& {& ?6 D& j$ T: _5 w5 h
The partition table has been altered!4 f9 d) l" n4 Z* M( q
Calling ioctl() to re-read partition table.
3 n) f$ ~# Q: @8 ]# n. ` Syncing disks.9 w( g! ?# t) Z
//格式化新分区1 q2 _) J5 J& W) V: ?, N4 ]
mke2fs 1.32 (09-Nov-2002)- |5 S9 `# O6 |* ]$ s
Filesystem label=2 a% D6 N' C' q. F0 R# z! E
OS type: Linux
6 M5 X- X3 `8 {8 {0 p Block size=1024 (log=0)
! M2 |9 C, Z4 Z9 \7 j$ q Fragment size=1024 (log=0)9 R4 ]% p, O3 T, z- y6 w2 L
126480 inodes, 503968 blocks: [2 n( [0 Y) \2 _$ y
25198 blocks (5.00%) reserved for the super user
) |; m$ Z' H3 i1 d3 A* f1 ?6 [ First data block=18 z8 C- q. D& X, Y& [% g1 A4 T t r
62 block groups
, \- {) d1 M5 H+ i; u 8192 blocks per group, 8192 fragments per group" x+ G/ ~, U1 e; p) l7 C& C6 b6 R8 ]
2040 inodes per group3 k1 E/ z4 V& I3 c; e; e: O9 z
Superblock backups stored on blocks: $ {" x' S5 }$ g7 E$ i0 x! m
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014093 \4 q% y" d7 L1 v& z
Writing inode tables: done
$ D. k4 B; x% x9 K1 G% ~; J% ] Creating journal (8192 blocks): done0 A W" ]3 R- }, p6 |
Writing superblocks and filesystem accounting information: done+ ~6 t. s4 M& _$ n0 m [6 _, D
This filesystem will be automatically checked every 30 mounts or1 p; n5 R* q: B# y% q( W7 |: p
180 days, whichever comes first. Use tune2fs -c or -i to override.) M3 a4 K# w0 W) m
文件系统 1K-块 已用 可用 已用% 挂载点0 m3 A. ?4 v8 e' T8 U3 t
/dev/sda3 3723848 705992 2828692 20% /& E# x5 @8 h- I
/dev/sda1 101089 9274 86596 10% /boot
" ~4 N" h5 w6 |2 w) O6 ?5 V' [6 R none 14520 0 14520 0% /dev/shm% V$ O* U- G. ?: N, r
//挂上新分区
& I+ H4 Y0 v- i, k2 F- mount /dev/hda1 /home
7 t) J, J4 O6 g! I) j' N; V: a - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点2 _1 ^% C2 T `1 }+ t
/dev/sda3 3723848 705992 2828692 20% /
" y" K: O K3 b B; H/ r /dev/sda1 101089 9274 86596 10% /boot2 g" a' [0 N- |
none 14520 0 14520 0% /dev/shm
r1 u6 V1 O0 D8 t* b' r /dev/hda1 488006 8239 454569 2% /home
+ G1 m, `4 n2 i1 P! |0 ?/ P9 t" \' p& C! [: g$ z
自动挂载:
/ B% K; [+ v) J9 w- vi /etc/fstab3 f0 E$ g( n2 k6 t. t5 [! U
- % i3 T6 G0 \3 B# x( M7 y
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0: y1 B [8 y( [: }- y0 t$ S6 K) ~
( F+ B" W' u& i: T3 d( B: R- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
: W! h$ T% ]; t4 |0 w- mount /dev/sdb5 /mnt/ljp1
/ g$ r+ {) y! B" e9 R" D* S+ l) u c - : Y0 T J- X6 r
- mount /dev/sdb6 /mnt/ljp2
复制代码
( c4 S% j2 I4 }7 U+ w" Y' O( J
+ |4 d% W7 D0 ^: ?- l( a q" a& R% H5 g+ V5 |
|
|