gnu-parted

0.0.0 • Public • Published

All warnings have been removed. This is an experimental project. Please do not use on a disk containing important data unless you know what you're doing

node-gnu-parted

Installation

npm i gnu-parted

Usage

Pass the disk path, size of disk and command you want to run to parted.

See for how to get disk size and paths drivelist

import { parted } from 'gnu-parted'

(async () => {
  const diskPath = "DISK_PATH" // e.g. /dev/sda or /dev/disks/disk1
  const diskSize = 100000 // size in bytes of disk

  // print partition table
  await parted(diskPath, diskSize, 'print')
  
  // create gpt partition table:
  await parted(diskPath, diskSize, "mklabel gpt")

  // create new primary fat32 partition, 512MiB:
  await parted(diskPath, diskSize, "mkpart fat32 1MiB 512MiB")
})();

Note this does not create the actual file system. It just edits the partition table. You can create a file system with mkfs.

Readme

Keywords

none

Package Sidebar

Install

npm i gnu-parted

Weekly Downloads

0

Version

0.0.0

License

ISC

Unpacked Size

4.78 MB

Total Files

398

Last publish

Collaborators

  • zwhitchcox