LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-27-2017, 02:00 PM   #1
qrange
Senior Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable/testing, amd64
Posts: 1,061

Rep: Reputation: 47
real bootable USB


I'd like to install Debian stable to USB as if it were HDD, so that later I can add/remove packages, compile stuff etc...
Is there a way to do it?

Thanks.
 
Old 06-27-2017, 05:10 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by qrange View Post
I'd like to install Debian stable to USB as if it were HDD, so that later I can add/remove packages, compile stuff etc...
Is there a way to do it?

Thanks.
yesh - should be - just install it to a usb like you would a hdd.

I do it with Void Linux
here is a how to I wrote for that
Install Void Linux onto a USB Stick
(shameless plug)
 
1 members found this post helpful.
Old 06-27-2017, 10:11 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,939

Rep: Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619
I like to use a virtual machine sometimes but best is if you remove power to your internal drives. Then you simply can't make a mistake. Boot to dvd and follow instructions to install to usb drive.
 
1 members found this post helpful.
Old 06-28-2017, 01:34 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by qrange View Post
I'd like to install Debian stable to USB as if it were HDD, so that later I can add/remove packages, compile stuff etc...
Is there a way to do it?

Thanks.
The Debian installer sees USB drives just like any other drives. It will happily let you do the install. However, be aware that the computer's motherboard might not let you boot from all USB ports. I've had laptops where I had to move the USB drive to another port before it would boot.

Especially if the USB drive is smaller than 16GB, I would recommend that you do an install without a swap partition. The Debian installer will give you a warning and ask if you really want to continue without configuring a swap partition. Later on, you can configure a swap file, which I like to place in /var/swapfile

The big advantage of using a swap file instead of a swap partition is that it's a lot easier to adjust the drive space set aside for swap vs usable drive space. The big disadvantage is that hibernation doesn't work with a swap file (not without some ugly hacks, I think). I've personally never used the hibernation feature, so I don't miss that.

There's an explanation how to create and set up a swap file here:

https://wiki.debian.org/Swap

Basically, you set up a swap file by adding the following line to /etc/fstab
Code:
/var/swapfile none swap sw 0 0
Then you create and activate the swap file with:
use the following commands to create a swap file:
Code:
dd if=/dev/zero of=/PATH/FILENAME bs=1024 count=512000
chmod 600 /var/swapfile
mkswap /var/swapfile
swapon -a
If you find yourself desperate for disk space, or you want to create a new swap file with a different size, you can do the following to immediately recover the space consumed by the swap file:
Code:
swapoff -a
rm -vi /var/swapfile
 
Old 06-28-2017, 01:43 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
from my notes on swap file using fallocate, I think this is a bit faster then dd
Code:
a different way to make a swapfile 

userx@crunchbangerz:~$ man 1 fallocate

sudo fallocate -l 512M /swapfile

1GB Swap File

sudo fallocate -l 1G /media/data/moreswap/swapfile ;

sudo mkswap /media/data/moreswap/swapfile ;

sudo chmod 0600  /media/data/moreswap/swapfile ;

sudo swapon /media/data/swapfile  

userx@crunchbangerz:~$ sudo mkswap /swapfile1

Setting up swapspace version 1, size = 524284 KiB
no label, UUID=67328381-6ed2-4c61-8276-c54a003906f9
userx@crunchbangerz:~$ sudo swapon /swapfile1
as you can see from my crunchbangerz prompt its been a while sense I've used a swap anything actually. but with a USB Boot its not a bad idea to use a little swap file - you can also just add to it, by making another swap file and swapon with that one having more than one swap file at a time up and running.

Just make sure you use proper path to swap file
 
Old 06-28-2017, 02:34 PM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Yeah, dd isn't the most efficient way to do this, but it works and it's what was in the web reference I linked to.

BTW, by default Debian does not install sudo. The usual way of doing things in Debian is to log in as root (either directly on a console or using "su -").
 
Old 06-28-2017, 02:42 PM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
chrunchbang was a Debian knock off - nothing wrong with options - but to each his own -- as long as it gets done.

when I did my USB OS install experiments I used GParted to create my swap and partition on the USB stick before installing it via USB ports - as stated before it just sees the USB Ports as hdd as well. I put the swap on the back end.

Last edited by BW-userx; 06-28-2017 at 02:45 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Need help making a bootable USB flash drive from a bootable CD. Gregg Bell Linux - Software 8 01-06-2016 01:38 PM
How to: Bootable USB drive with one installed distro, and two bootable installations ? Okruglica Linux - Newbie 1 04-21-2013 08:09 PM
Bootable USB Thumb Drive fails with "ERROR: Failed to mount real root device" bsquared Linux - General 7 08-08-2011 11:16 AM
Creating bootable CDROM from a bootable USB drive seaquesttr Linux - Desktop 2 08-01-2010 11:57 AM
Making a USB stick bootable from a bootable cdrom cwwilson721 Slackware 2 10-23-2009 09:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration