Linux command parted

Linux command parted

Purpose

       Learning linux command parted to manipulate disk partitions

 

Eevironment

       Ubuntu 16.04 terminal

 

Procdeure

       example:

parted -s $DRIVE mklabel msdos
parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9
parted -s $DRIVE set 1 boot on
parted -s $DRIVE unit cyl mkpart primary ext2 -- 9 -2

mkfs.vfat -F 32 -n "boot" ${DRIVE}1
mkfs.ext3 -L "rootfs" ${DRIVE}2  << EOM
y
EOM
sync
sync

mount -t vfat ${DRIVE}1 tmp_boot
mount -t ext3 ${DRIVE}2 tmp_rootfs

   and cyl size is 8225kB, we can find from:

root@IoTP:~# parted 
GNU Parted 3.2
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit cyl print
Model: SD SD16G (sd/mmc)
Disk /dev/mmcblk0: 1904cyl
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 1904,255,63.  Each cylinder is 8225kB.
Partition Table: msdos
Disk Flags: 

Number  Start  End      Size     Type     File system  Flags
 1      0cyl   9cyl     8cyl     primary  fat32        boot, lba
 2      9cyl   1902cyl  1893cyl  primary  ext3
原文地址:https://www.cnblogs.com/lianghong881018/p/10518145.html