U盘安装debian初学教程(2)

#df
看看你的USB所在设备,我的是/dev/sda1
其实有没有这一步无所谓,接下来对U盘分区,如果你有分区,
那么你就得看看是sdaX....
如果你的U盘已有分区要另说了~我的只是为了快,就直接分区了.

#fdisk /dev/sda
请注意这里是sda,不是sda1,sda2..或是别的什么..

分区的命令大家不用细说吧.
Command (m for help): p

Disk /dev/sda: 1048 MB, 1048576000 bytes
255 heads, 63 sectors/track, 127 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 127 1020096 83 Linux

Command (m for help): d
Selected partition 1

Command (m for help): 1
1: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-127, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-127, default 127): //这里我空白是把全间全部都用了,不分了,大家可以慢慢分的... 格式如: +100M
Using default value 127

Command (m for help): a
Partition number (1-4): 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.


#umount /dev/sda1 格式化前要umount(我这里一分完区,马上自动mount)
#mkfs.ext2 /dev/sda1 格式化,没有这个命令apt-get install dosfstools
#mount /dev/sda1 /yourDir 再把U盘挂上来
#mkdir /yourDir/boot 在U盘上建个boot的目录
#cp -R /boot/grub/ /yourDir/boot cp本机上的/boot/grub里的内容

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/f441d4f0038a558ee8ad93d86b7332f2.html