@fanisfun
2017-03-07T02:12:23.000000Z
字数 4924
阅读 2919
Linux
sudo fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 1 3907029167 1953514583+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/mapper/ubuntu--vg-root: 1931.0 GB, 1930973675520 bytes
255 heads, 63 sectors/track, 234760 cylinders, total 3771432960 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/ubuntu--vg-root doesn\'t contain a valid partition table
Disk /dev/mapper/ubuntu--vg-swap_1: 68.6 GB, 68627202048 bytes
255 heads, 63 sectors/track, 8343 cylinders, total 134037504 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/ubuntu--vg-swap_1 doesn\'t contain a valid partition table
Disk /dev/sdb: 31.1 GB, 31104958464 bytes
255 heads, 63 sectors/track, 3781 cylinders, total 60751872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x91cd37a8
Device Boot Start End Blocks Id System
/dev/sdb1 * 784384 60751871 29983744 c W95 FAT32 (LBA) ## <- here!
可以看出U盘分区号是: /dev/sdb1
sudo fdisk /dev/sdb
Command (m for help): m ## 打印命令列表
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): p ## 打印U盘分区: /dev/sdb1
Disk /dev/sdb: 31.1 GB, 31104958464 bytes
255 heads, 63 sectors/track, 3781 cylinders, total 60751872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x91cd37a8
Device Boot Start End Blocks Id System
/dev/sdb1 * 784384 60751871 29983744 c W95 FAT32 (LBA)
Command (m for help): d ## 删除原本分区
Selected partition 1
Command (m for help): p ## 打印U盘分区: 无
Disk /dev/sdb: 31.1 GB, 31104958464 bytes
255 heads, 63 sectors/track, 3781 cylinders, total 60751872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x91cd37a8
Device Boot Start End Blocks Id System
Command (m for help): n ## 新建分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p ## 基本分区
Partition number (1-4, default 1): 2 ## 指定为2号分区
First sector (2048-60751871, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-60751871, default 60751871): +2G ## 大小为2G
Command (m for help): p ## 打印分区: /dev/sdb2
Disk /dev/sdb: 31.1 GB, 31104958464 bytes
255 heads, 63 sectors/track, 3781 cylinders, total 60751872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x91cd37a8
Device Boot Start End Blocks Id System
/dev/sdb2 2048 4196351 2097152 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p ## 基本分区
Partition number (1-4, default 1): 1 ## 指定为2号分区
First sector (4196352-60751871, default 4196352):
Using default value 4196352
Last sector, +sectors or +size{K,M,G} (4196352-60751871, default 60751871): ## 剩余所有空间
Using default value 60751871
Command (m for help): p ## 打印分区: /dev/sdb1 & /dev/sdb2
Disk /dev/sdb: 31.1 GB, 31104958464 bytes
255 heads, 63 sectors/track, 3781 cylinders, total 60751872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x91cd37a8
Device Boot Start End Blocks Id System
/dev/sdb1 4196352 60751871 28277760 83 Linux ## 数据分区
/dev/sdb2 2048 4196351 2097152 83 Linux ## 启动分区
Command (m for help): w ## 保存修改并退出
The partition table has been altered!
注意: Windows下默认只识别 1号分区
,因此将数据分区指定为1号 /dev/sdb1
。
sudo mkfs.ntfs -f -L NTFS /dev/sdb1 ## NTFS
sudo mkfs.vfat -F 32 /dev/sdb2 ## FAT32
数据分区为 NTFS
以支持大于4G文件的存取,启动分区为 FAT32
获得更好的兼容性。
sudo mkdir -p /mnt/usb1
sudo mount -t auto /dev/sdb1 /mnt/usb1
sudo mkdir -p /mnt/usb2
sudo mount -t auto /dev/sdb2 /mnt/usb2
sudo df -h ## 打印文件系统信息
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root 1.8T 3.4G 1.7T 1% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 32G 4.0K 32G 1% /dev
tmpfs 6.3G 1.5M 6.3G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 32G 144K 32G 1% /run/shm
none 100M 36K 100M 1% /run/user
/dev/sda2 237M 45M 180M 20% /boot
/dev/sda1 511M 3.4M 508M 1% /boot/efi
/dev/sdb2 27G 16K 2.0G 1% /mnt/usb2 # <- here
/dev/sdb1 2.0G 16K 27G 1% /mnt/usb1 # <- here
Extension
Clonezilla(再生龙)是一款遵守GUN授权方式的自由软件,它基于Partimage,吸取了Norton Ghost和Partition Image的优点。即不仅支持对整个硬盘系统进行克隆,而且也可以克隆单个的分区,这种灵活性更能满足各种使用者的需要,此外支持多种的操作系统与文件系统也是其强大之处。我主要使用Clonezilla对Windows和Linux系统环境进行的备份、还原和部署。单台部署,选择最新的 Live
稳定版。
sudo unzip clonezilla.zip -d /mnt/usb2
cd /mnt/usb2/utils/linux
sudo ./makeboot.sh /dev/sdb2
sudo apt-get install -y libc6-i386 # may need
Clonezilla 具体使用方法参考 百度文库: Clonezilla(再生龙)用户指南
sudo umount /mnt/usb1 && sudo rm -r /mnt/usb1
sudo umount /mnt/usb2 && sudo rm -r /mnt/usb2
提示: 每次拔出U盘前,请保持 卸载
的好习惯。