Linux/parted

From Omnia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

parted

GNU Parted - a partition manipulation program

Used by OpenELEC to create SD card partitions: (create_sdcard)

DISK = /dev/sdh

# writing new disklabel on $DISK (removing all partitions)...
parted -s /dev/sdh mklabel msdos

# creating partitions on $DISK...
parted -s "$DISK" unit cyl mkpart primary fat32 -- 0 16
parted -s "$DISK" unit cyl mkpart primary ext2 -- 16 -2

# make partition active (bootable)
parted -s "$DISK" set 1 boot on

# tell kernel we have a new partition table
partprobe "$DISK"

# create filesystem
# creating filesystem on $PART1...
mkfs.vfat "$PART1" -I -n System
# creating filesystem on $PART2...
mkfs.ext4 "$PART2" -L Storage

# sync disk
sync

Larger than 2TB RAID

To get larger than 2TB you need GPTs

parted /dev/sdb
 mklabel gpt
 print free
 mkpart primary 1M 4TB
 p
 set 1 raid on
 align-check optimal 1
 q
mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sd[iklm]1
mkfs.ext4 /dev/md0 -L /ci
cat /proc/mdstat

---

parted -a optimal /dev/sdf


Ref:

Tools

lsblk

List block devices:

lsblk

How To - Linux List Disk Partitions Command - nixCraft - https://www.cyberciti.biz/faq/linux-list-disk-partitions-command/

List SCSI Devices

lsscsi

Use different unit

parted -ls /dev/sda 'unit s'
parted /dev/sda 'unit s print'

[parted] How to list start/end/size sectors? - https://www.linuxquestions.org/questions/linux-software-2/%5Bparted%5D-how-to-list-start-end-size-sectors-4175461903/

Specify TB

unit TB
unit GB