WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to setup partitions and exit?  (Read 5873 times)

Offline Eddiie

  • Newbie
  • *
  • Posts: 3
How to setup partitions and exit?
« on: August 15, 2019, 02:02:23 AM »
Hello,
I want to use TC to simply run from a USB stick and erase any partitions that exist on a connected hard disk (fdisk -l shows it as /dev/sdb, make 2 new Linux partitions and exit (or loop indefinitely).

Is this possible with TC?     My searches have found "almost" answers but it seems the OP wants to do more than simply delete any existing partitions and make some new one's.

Appreciate any help!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: How to setup partitions and exit?
« Reply #1 on: August 15, 2019, 09:21:25 AM »
Hi Eddiie
It sounds like you want to automatically repartition the drive upon boot up and then wind up at a command line (or GUI) to perform
other actions. You already installed Tinycore to a USB stick, right? Open your  /opt/bootlocal.sh  file and add the following:
Code: [Select]
fdisk /dev/sda <<EOF
commands
EOF
Replace  commands  with the actual keystrokes you would use when running  fdisk, for example:
Code: [Select]
fdisk /dev/sda <<EOF
p
n
p
1
 ---~ SNIP ~---
p
w
EOF

Offline Eddiie

  • Newbie
  • *
  • Posts: 3
Re: How to setup partitions and exit?
« Reply #2 on: August 15, 2019, 09:01:05 PM »
Thank you!   Very cool.

Actually, I am going to use dd to wipe -

dd if=/dev/urandom /dev/sda  bs=512 count=1 conv=notrunc

and fdisk to create -

fdisk /dev/sda <<EOF
u
n
p
1
2
1000
n
p
2
1000
w
EOF
fdisk -l


Now to finger out how to make this persist on to the Flash drive and create a new ISO from it.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: How to setup partitions and exit?
« Reply #3 on: August 15, 2019, 09:14:29 PM »
Hi Eddiie
... Now to finger out how to make this persist on to the Flash drive and create a new ISO from it.
You need to run a backup. If you're using a GUI, clicking the  Exit  icon then  OK  should run a backup. From the command line:
Code: [Select]
filetool.sh -b
I would highly recommend you take an hour to read this fine book:
http://tinycorelinux.net/corebook.pdf

Offline Eddiie

  • Newbie
  • *
  • Posts: 3
Re: How to setup partitions and exit?
« Reply #4 on: August 16, 2019, 01:37:20 PM »
I got it working.  So cool.  Reading through wiki and FAQs etc.

To save the settings I wound up creating a EXT2 partition and redirected opt= to that location in boot file I think it was...

I used the core-plus.iso  to install on to a removable media.   Using 64bit.

Is there anything I should post here to help others?

Thank you for the guidance.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: How to setup partitions and exit?
« Reply #5 on: August 16, 2019, 02:34:06 PM »
Hello,
I want to use TC to simply run from a USB stick and erase any partitions that exist on a connected hard disk (fdisk -l shows it as /dev/sdb, make 2 new Linux partitions and exit (or loop indefinitely).
This sounds extremely dangerous!  And possibly illegal?
[emoji15]


Sent from my iPhone using Tapatalk

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: How to setup partitions and exit?
« Reply #6 on: August 16, 2019, 04:07:39 PM »
That's one reason one should *never* try to use an abandoned usb stick laying around somewhere for booting, or even for simple internal inspection unless you have a forensic box.
That's a UNIX book! - cool  -- Garth

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: How to setup partitions and exit?
« Reply #7 on: August 16, 2019, 04:45:50 PM »
This poses an interesting situation for a utility like this --

Would the protect boot code - even though you aren't protecting anything at this point - come on early enough in the boot process to only allow those who know the password to proceed?

Say for instance in a recycling facility where something like this could be used by the unskilled who are trying to do the right thing by erasing previous user's data.

All they have to know is one thing - the protect password / passphrase to continue..

Or would protect come on too late in the process?
That's a UNIX book! - cool  -- Garth

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: How to setup partitions and exit?
« Reply #8 on: August 16, 2019, 05:56:48 PM »
This poses an interesting situation for a utility like this --

Would the protect boot code - even though you aren't protecting anything at this point - come on early enough in the boot process to only allow those who know the password to proceed?

Say for instance in a recycling facility where something like this could be used by the unskilled who are trying to do the right thing by erasing previous user's data.

All they have to know is one thing - the protect password / passphrase to continue..

Or would protect come on too late in the process?

Hi, PDP-8!
I think you are talking about setting good password for tc user and "noautologin" bootcode?

Offline jfieser

  • Newbie
  • *
  • Posts: 1
Re: How to setup partitions and exit?
« Reply #9 on: June 19, 2024, 08:25:59 AM »

dd if=/dev/urandom /dev/sda  bs=512 count=1 conv=notrunc


This was helpful for me, but I had to add of=

dd if=/dev/urandom of=/dev/sda  bs=512 count=1 conv=notrunc

I intend to protect users from inadvertently wiping disks with:

read -r -p "Are you sure? [y/N] " response
response=${response,,}    # tolower
if [[ "$response" =~ ^(yes|y)$ ]]