Skip to content

Commit

Permalink
nc-format-USB: fix format disks >2TB and more (Closes #223)
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Sep 30, 2017
1 parent cfcb535 commit ba9d6fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[v0.31.4](https://github.com/nextcloud/nextcloudpi/commit/ebd1fc1) (2017-09-30) nc-format-USB: speed up ext4 creation with lazy initialization
[v0.31.5](https://github.com/nextcloud/nextcloudpi/commit/7bca99d) (2017-09-30) nc-format-USB: fix format disks >2TB and more

[v0.31.4](https://github.com/nextcloud/nextcloudpi/commit/cdf1822) (2017-09-30) nc-format-USB: speed up ext4 creation with lazy initialization

[v0.31.3 ](https://github.com/nextcloud/nextcloudpi/commit/c2abfaa) (2017-09-30) letsencrypt: fix uppercase domains cert path (Closes #229)

Expand Down
12 changes: 10 additions & 2 deletions etc/nextcloudpi-config.d/nc-format-USB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ configure()
return 1;
}

# disable nc-automount if enabled
killall -STOP udiskie 2>/dev/null

# umount if mounted
umount /media/USBdrive* &> /dev/null

Expand All @@ -45,9 +48,14 @@ configure()
local NAME=( $( lsblk -l -n | grep -v mmcblk | grep disk | awk '{ print $1 }' ) )
[[ ${#NAME[@]} != 1 ]] && { echo "unexpected error"; return 1; }

wipefs -a -f /dev/"$NAME" || return 1
printf 'o\nn\np\n1\n\n\nw\n' | sudo fdisk /dev/"$NAME" || return 1
wipefs -a -f /dev/"$NAME" || return 1
parted /dev/"$NAME" --script -- mklabel gpt || return 2
parted /dev/"$NAME" --script -- mkpart primary 0% 100% || return 3
sleep 0.5
mkfs.ext4 -q -E lazy_itable_init=0,lazy_journal_init=0 -F /dev/"${NAME}1" -L "$LABEL_"

# enable nc-automount if enabled
killall -CONT udiskie 2>/dev/null
}

install() { :; }
Expand Down

0 comments on commit ba9d6fd

Please sign in to comment.