|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
+ a9 c0 s# ]3 H; M3 L/ c1 H or: fdisk /dev/sdc (for the third SCSI disk)
1 i8 |$ M( e5 q9 h3 p7 f or: fdisk /dev/eda (for the first PS/2 ESDI drive)0 W- _0 [0 X( | x( Q5 k
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices). }6 l% B# Z9 I
..." Q3 V" L9 h% Y2 i# ?% I' e" _
- df -k
- e) F- `) }9 R: i- p7 _1 Y% v) Z! u - df -lh' m' z, _! M, |0 @
- 查看有几块硬盘:fdisk -l" F/ D6 H) n( g9 }2 `: {
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
% ]2 o6 U" E0 _3 N9 |8 }8 | /dev/sda3 3723848 705968 2828716 20% /
% z9 N, r" `9 L3 j3 L /dev/sda1 101089 9274 86596 10% /boot
8 \; u/ L) r: r5 I3 o1 a none 14520 0 14520 0% /dev/shm- U& D5 T/ @. q) J
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
0 @4 k) Z5 c* L1 V; ADevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
* ]; [ N8 M( ^% I. M8 I0 [ Building a new DOS disklabel. Changes will remain in memory only,
5 V. \9 q$ s! f8 s5 d7 b until you decide to write them. After that, of course, the previous4 `" a9 y6 F& G {
content won't be recoverable.0 o% U% K8 O) _8 T1 d
The number of cylinders for this disk is set to 8322.
6 W4 f# z3 m0 P2 t There is nothing wrong with that, but this is larger than 1024,
5 a/ p# K* \5 P* W* z. h0 S" D and could in certain setups cause problems with:
3 |' s% l$ A5 \; a 1) software that runs at boot time (e.g., old versions of LILO)& x0 W% C) k. @/ }) j8 K3 C
2) booting and partitioning software from other OSs
- ^% [3 h( h( h/ W (e.g., DOS FDISK, OS/2 FDISK)6 u+ {* l' \( o' I9 `! O8 T5 n
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)& t. N% I3 O8 M7 c( L( X5 J$ A8 K
Command (m for help): p
% N" w) K8 C K: c6 t+ x Disk /dev/hda: 4294 MB, 4294967296 bytes; x4 C M! c8 t, b* l8 K
16 heads, 63 sectors/track, 8322 cylinders4 N: T0 g' q! g$ [* ~; o2 j+ B* Q5 Q
Units = cylinders of 1008 * 512 = 516096 bytes
" r0 ?. Z3 Q- `6 l7 k* ~ Device Boot Start End Blocks Id System
# b9 A* c& i/ ~- ^* x6 @ Command (m for help): m8 ~0 I9 ?3 b+ @; Y- ?6 Y
Command action
5 M3 r K! R! H( A a toggle a bootable flag
. P8 q7 S! c1 g; h% l- r b edit bsd disklabel/ ~+ j$ _9 ], ^ I& k0 {1 G4 x4 y
c toggle the dos compatibility flag
; s3 t7 {1 m3 p5 W- z& y d delete a partition1 z0 x6 L2 \& a% B4 F
l list known partition types
7 T% ` g1 c$ a m print this menu
; F9 v$ c& R4 G, M' F1 P! z n add a new partition
7 ]& _6 j2 e# B& _ o create a new empty DOS partition table
3 r; n8 H8 m3 @/ e5 x1 ?8 g p print the partition table: y: }+ O8 d5 Z. q
q quit without saving changes
1 A/ u: l! h4 ] s create a new empty Sun disklabel; s1 u& g: \8 a( P3 P: S. K) S" T7 T
t change a partition's system id
8 b! {& G9 E0 C, ^: g2 L u change display/entry units
2 S H+ V; a1 J# A p/ _6 k v verify the partition table! V6 S p: N( a* I$ C! G3 y3 p
w write table to disk and exit7 J( ?7 t `2 Z4 @( \0 Q8 y
x extra functionality (experts only)4 l9 l. G3 Y5 g! c/ w+ e
Command (m for help): n
3 h' s7 u& \. b3 J- P D; r7 r3 @ Command action
! X$ D; @# z/ {3 p: `5 e e extended
/ W* A2 x5 K5 d2 ?0 s C ~# A, { p primary partition (1-4); r. e7 E7 C, I( b
p
5 U/ ]8 [( m6 } V# E) s( V Partition number (1-4): 1
5 N' p& v% {4 x First cylinder (1-8322, default 1): : X* [) C+ Q- l4 s
Using default value 11 }( O* ^7 z7 h- N- n. x' @. B
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
) c* H# x5 J6 S+ ^. ~! H$ P Command (m for help): p7 L4 s0 p$ f7 N- m i% I
Disk /dev/hda: 4294 MB, 4294967296 bytes
1 N7 D* W' C0 {" g& y 16 heads, 63 sectors/track, 8322 cylinders
6 v* Q! F) @. k! c Units = cylinders of 1008 * 512 = 516096 bytes/ }6 P5 `9 i+ j
Device Boot Start End Blocks Id System
% v1 p0 s; I" C& w9 \3 C /dev/hda1 1 1000 503968+ 83 Linux
* y: \+ o/ G2 X* L% B Command (m for help): w8 K, v5 O. p7 w
The partition table has been altered!
; Q( E4 y; j9 | Calling ioctl() to re-read partition table.
/ F9 U! c: T# l4 T( G8 D0 O Syncing disks.. z+ e* a; Y8 Q' ~; d N
//格式化新分区
! m5 J+ ~/ M" I# X& f) s3 zmke2fs 1.32 (09-Nov-2002)/ s1 V# J7 b, F+ ?
Filesystem label=
8 b Q* l2 k( h3 M7 ] OS type: Linux9 E" Z% ]$ J- `; R$ U" C# G
Block size=1024 (log=0)
) G. n/ i" ~0 k' O, ?' \8 K Fragment size=1024 (log=0)
' N4 m5 }6 L0 d 126480 inodes, 503968 blocks* V2 {( j5 N' ]- Y2 R! d
25198 blocks (5.00%) reserved for the super user
; J7 x! M" H+ H3 k* z6 B First data block=1; f2 E* y/ N7 X% x5 v
62 block groups& u: G$ w8 a9 y4 }% n( p7 d$ i
8192 blocks per group, 8192 fragments per group5 T& H% ?& c! n% d
2040 inodes per group
7 C6 [+ E; a4 O5 I9 f Superblock backups stored on blocks:
8 a% y+ S* _1 W 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
) \8 Q0 B/ Y7 o7 ^3 @; U, i6 D4 \ Writing inode tables: done
0 l4 d7 n% ]$ Z c1 F) L. h: S Creating journal (8192 blocks): done
- _1 Y& i" {* G# o: r$ H9 E: x Writing superblocks and filesystem accounting information: done, I" O3 s! G3 D8 ^
This filesystem will be automatically checked every 30 mounts or
' k* S' Y: R# D: m# o' J 180 days, whichever comes first. Use tune2fs -c or -i to override.9 D$ g' g; X4 Z( T2 X+ _# p
文件系统 1K-块 已用 可用 已用% 挂载点, k% w ?" R) |/ z0 y$ C0 Y
/dev/sda3 3723848 705992 2828692 20% /7 D0 I! q# ^" \) h
/dev/sda1 101089 9274 86596 10% /boot
+ U" {+ Y4 w- o3 U7 d0 a, X. H, v none 14520 0 14520 0% /dev/shm
5 c- ]: Y; r. u' |+ X //挂上新分区
& }4 Z1 G9 X6 V1 Z. S4 `5 ]8 {2 _- mount /dev/hda1 /home) [. T b$ y+ v* S0 k+ C
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 W, Q0 C8 Y9 ^: _8 D /dev/sda3 3723848 705992 2828692 20% /4 ]% b b. u8 b- o
/dev/sda1 101089 9274 86596 10% /boot; k4 H \6 j: e- @3 [) D
none 14520 0 14520 0% /dev/shm7 y) ` g8 J6 d$ L- X
/dev/hda1 488006 8239 454569 2% /home) t6 m. E/ F: z* y/ Z( o
7 `$ W7 C5 N9 r5 F7 O自动挂载:
2 Q+ }: G7 Z& G( P- vi /etc/fstab& |7 K6 Z9 m: [2 _( ^: ?8 `# J
- 0 {# D0 F& f5 r
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
, o$ w! F5 X: g* ]" N2 |+ I
6 ^3 @, c' X, G' ? ?' _: k- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; v: L: k+ W' {8 C- k- mount /dev/sdb5 /mnt/ljp1
* D/ C$ j9 z/ a, ?9 l9 I
& R, J, ?# H& W; Z- mount /dev/sdb6 /mnt/ljp2
复制代码 $ v! h) k& ^8 x
7 K. h& Z" E% q& m0 A+ J* I
?5 Z3 `& }' ]2 ^4 v4 V2 L
|
|