• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Looking for someone with scripting knowledge...

Joined
Feb 22, 2019
Messages
757 (1.42/day)
System Name Fatboii
Processor AMD Ryzen 7 3700X @ 4.2 GHz (all cores)
Motherboard ASUS Crosshair VIII Hero WiFI
Cooling Custom water
Memory Patriot Viper Steel 2x8GB @ 3733 14-15-15-34-52-1T
Video Card(s) EVGA GTX 1080 Ti FTW3 under water
Storage Samsung SM951 256GB + 860 EVO 1TB
Display(s) ASUS ROG PG278Q 144Hz
Case Fractal Design R6 Tempered Glass
Audio Device(s) Onboard
Power Supply EVGA SuperNOVA G3 850w
Mouse Logitech G502
Keyboard Cooler Master Pro Keys L
Software Win 10 Pro
Benchmark Scores I only game on this system... built for silence, not absolute max performance. ;)
Hey guys,

Long story short: I need to format hundreds of drives from 520KB sectors to 512KB sectors. I used to do this by hand and type out the commands every time... but I know it can be done easier.

Can someone here with the knowledge write me a quick script? I am willing to float some $$$ your way if it works as intended! :D

What I used to have to type was this:
This was on every boot as I used a live drive, but will be changing this to a full install on my server when it arrives. I assume this will irradicate the need for this portion but I may be wrong.
►sudo apt-get update
►sudo apt-get upgrade
►sudo apt-get install software-properties-common
►sudo apt-get install sg3-utils

This is the format segment:
►sudo sg_format --format --size=512 /dev/sg* - where * indicates drive number from terminal

Basically, I need it to run on 12 drives simultaneously and with room to expand up to 24. I will most likely install on to a spare drive to make this easier, if possible. :)

Thank you for your assistance. I will be trying to figure something out myself, but I will no doubt get stuck somewhere.
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
20,744 (3.50/day)
Processor Core i7-4790K
Memory 16 GB
Video Card(s) GTX 1080
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 7
This seems trivial? Just write a bash script? Which is just a collection of commands.
 
Joined
Feb 22, 2019
Messages
757 (1.42/day)
System Name Fatboii
Processor AMD Ryzen 7 3700X @ 4.2 GHz (all cores)
Motherboard ASUS Crosshair VIII Hero WiFI
Cooling Custom water
Memory Patriot Viper Steel 2x8GB @ 3733 14-15-15-34-52-1T
Video Card(s) EVGA GTX 1080 Ti FTW3 under water
Storage Samsung SM951 256GB + 860 EVO 1TB
Display(s) ASUS ROG PG278Q 144Hz
Case Fractal Design R6 Tempered Glass
Audio Device(s) Onboard
Power Supply EVGA SuperNOVA G3 850w
Mouse Logitech G502
Keyboard Cooler Master Pro Keys L
Software Win 10 Pro
Benchmark Scores I only game on this system... built for silence, not absolute max performance. ;)
I have absolutely zero scripting knowledge, but if it is that easy... maybe it's worthy of a (many) attempt(s). :D
 

eidairaman1

The Exiled Airman
Joined
Jul 2, 2007
Messages
30,443 (6.36/day)
Location
Republic of Texas (True Patriot)
System Name PCGOD
Processor AMD FX 8350@ 5.0GHz
Motherboard Asus TUF 990FX Sabertooth R2 2901 Bios
Cooling Scythe Ashura, 2×BitFenix 230mm Spectre Pro LED (Blue,Green), 2x BitFenix 140mm Spectre Pro LED
Memory 16 GB Gskill Ripjaws X 2133 (2400 OC, 10-10-12-20-20, 1T, 1.65V)
Video Card(s) AMD Radeon 290 Sapphire Vapor-X
Storage Samsung 840 Pro 256GB, WD Velociraptor 1TB
Display(s) NEC Multisync LCD 1700V (Display Port Adapter)
Case AeroCool Xpredator Evil Blue Edition
Audio Device(s) Creative Labs Sound Blaster ZxR
Power Supply Seasonic 1250 XM2 Series (XP3)
Mouse Roccat Kone XTD
Keyboard Roccat Ryos MK Pro
Software Windows 7 Pro 64
I have absolutely zero scripting knowledge, but if it is that easy... maybe it's worthy of a (many) attempt(s). :D
You may ask Chris at Chris Titus Tech on Youtube (he may have a website even).
 

Solaris17

Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
21,695 (3.97/day)
Location
Florida
System Name Venslar
Processor I9 7980XE
Motherboard MSI x299 Tomahawk Arctic
Cooling EK Custom
Memory 32GB Corsair DDR4 3000mhz
Video Card(s) Nvidia Titan RTX
Storage 1x 250GB 960 EVO | 1x 500gb Intel 720p | 32TB SAN
Display(s) 3x AOC Q2577PWQ (2k IPS)
Case Inwin 303 White (Thermaltake Ring 120mm Purple accent)
Audio Device(s) Schiit Fulla 3 on Beyerdynamic DT 990 Pros
Power Supply Seasonic 1050W Snow
Mouse Roccat Kone Aimo White
Keyboard Ducky Shine 6 Snow White
Software Windows 10 x64 Pro
what debian based system is this? and what is its version?

How do you display and know the disk numbers?

EDIT:: im bored.

Code:
#!/bin/bash

#clear the screen so we can read stuff
clear

# Echos with nothing are just line seperators
echo
echo Updating repos and doing upgrades...
echo
# You can combine commands and use the -y flag to auto make changes.
sudo apt update && sudo apt -y upgrade
clear
echo
echo Installing prerequisite software...
echo
# Using a space we can list the packages we want installed. Again using -y to confirm automatically.
sudo apt install software-properties-common sg3-utils -y
clear
echo
echo Starting disk configuration. Please type the disk number you would like to reconfigure.
echo
# I might be able to do ranges but im lazy, and we can just loop back.
read -p 'Disk Number: ' disknum

sudo sg_format --format --size=512 /dev/sg$disknum

echo
echo
echo Done I think! super basic script run me again bye!
echo

# Maybe I can add loops and menus and stuff later idk.
# remember do chmod a+x scriptname.sh
# remember if modifying under windows run "sed -i -e 's/\r$//' sg3.sh" to remove weird CRs

exit
 

Attachments

Last edited:
Joined
Feb 22, 2019
Messages
757 (1.42/day)
System Name Fatboii
Processor AMD Ryzen 7 3700X @ 4.2 GHz (all cores)
Motherboard ASUS Crosshair VIII Hero WiFI
Cooling Custom water
Memory Patriot Viper Steel 2x8GB @ 3733 14-15-15-34-52-1T
Video Card(s) EVGA GTX 1080 Ti FTW3 under water
Storage Samsung SM951 256GB + 860 EVO 1TB
Display(s) ASUS ROG PG278Q 144Hz
Case Fractal Design R6 Tempered Glass
Audio Device(s) Onboard
Power Supply EVGA SuperNOVA G3 850w
Mouse Logitech G502
Keyboard Cooler Master Pro Keys L
Software Win 10 Pro
Benchmark Scores I only game on this system... built for silence, not absolute max performance. ;)
I’ll give this a try when my server arrives and let you know. Thank you so much!!

I am totally clueless with Linux and programming in general, so I really appreciate that. Send me a PM if you’d like a few bucks for your troubles. :)
 

Solaris17

Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
21,695 (3.97/day)
Location
Florida
System Name Venslar
Processor I9 7980XE
Motherboard MSI x299 Tomahawk Arctic
Cooling EK Custom
Memory 32GB Corsair DDR4 3000mhz
Video Card(s) Nvidia Titan RTX
Storage 1x 250GB 960 EVO | 1x 500gb Intel 720p | 32TB SAN
Display(s) 3x AOC Q2577PWQ (2k IPS)
Case Inwin 303 White (Thermaltake Ring 120mm Purple accent)
Audio Device(s) Schiit Fulla 3 on Beyerdynamic DT 990 Pros
Power Supply Seasonic 1050W Snow
Mouse Roccat Kone Aimo White
Keyboard Ducky Shine 6 Snow White
Software Windows 10 x64 Pro
Send me a PM if you’d like a few bucks for your troubles
Not my cup of tea, remember to read the notes in the script, especially if you modify it on windows. Otherwise, curious how it pans out!
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
14,897 (2.97/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 7500 Kaby Lake
Motherboard AsRock MicroATX Z170M Extreme4
Cooling Stock
Memory 2x 16 Gb Gskill Ripjaws 2400
Video Card(s) AMD Radeon 5700
Storage Samsung 970 EVO 1 TB m.2 NVMe + Samsung 860 EVO 2 TB SATA3 SSD
Display(s) LG 34GK950F-B 34" 21:9 Ultragear WQHD Nano IPS Curved Gaming Monitor with Radeon FreeSync 2
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply Seasonic SSR-650GD Flagship Prime Series 650W Gold
Mouse Logitech G900 Chaos Spectrum
Keyboard Corsair K63 Wireless
Software Windows 10
what debian based system is this? and what is its version?

How do you display and know the disk numbers?

EDIT:: im bored.

Code:
#!/bin/bash

#clear the screen so we can read stuff
clear

# Echos with nothing are just line seperators
echo
echo Updating repos and doing upgrades...
echo
# You can combine commands and use the -y flag to auto make changes.
sudo apt update && sudo apt -y upgrade
clear
echo
echo Installing prerequisite software...
echo
# Using a space we can list the packages we want installed. Again using -y to confirm automatically.
sudo apt install software-properties-common sg3-utils -y
clear
echo
echo Starting disk configuration. Please type the disk number you would like to reconfigure.
echo
# I might be able to do ranges but im lazy, and we can just loop back.
read -p 'Disk Number: ' disknum

sudo sg_format --format --size=512 /dev/sg$disknum

echo
echo
echo Done I think! super basic script run me again bye!
echo

# Maybe I can add loops and menus and stuff later idk.
# remember do chmod a+x scriptname.sh
# remember if modifying under windows run "sed -i -e 's/\r$//' sg3.sh" to remove weird CRs

exit
I'm disappointed you didn't add a line to fire up a bit miner:roll:
 

Solaris17

Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
21,695 (3.97/day)
Location
Florida
System Name Venslar
Processor I9 7980XE
Motherboard MSI x299 Tomahawk Arctic
Cooling EK Custom
Memory 32GB Corsair DDR4 3000mhz
Video Card(s) Nvidia Titan RTX
Storage 1x 250GB 960 EVO | 1x 500gb Intel 720p | 32TB SAN
Display(s) 3x AOC Q2577PWQ (2k IPS)
Case Inwin 303 White (Thermaltake Ring 120mm Purple accent)
Audio Device(s) Schiit Fulla 3 on Beyerdynamic DT 990 Pros
Power Supply Seasonic 1050W Snow
Mouse Roccat Kone Aimo White
Keyboard Ducky Shine 6 Snow White
Software Windows 10 x64 Pro
Top