USB Partition

General discussion relating to the O2 Joggler, from the default O2 setup, to alternative operating systems and applications.
michaelm
Posts: 17
Joined: Fri Mar 04, 2011 9:18 am
Location: Glasgow

USB Partition

Post by michaelm »

Hey guys

I am using a 16GB USB Flash drive on the btrfs (comp) image through a USB extension cable to hide some of the cable clutter.

It all seems to work well for now.

The image install obviously only took 4 GB of space on the stick which means I have 12GB left. Is there anyway I can partition this stick without having to re-install Jolicloud and make the 12GB available to me for photos etc?

I have a full version of Jolicloud running on another PC and I can use the gparted there to re-partition but as a newbie I have no idea what file format to choose etc.

Finally do you think NOT using the USB extension cable will give me any speed benefits?

Thanks in advance

Michael
User avatar
dwl99
Posts: 765
Joined: Fri Mar 04, 2011 7:38 am
Location: Glasgow

Re: USB Partition

Post by dwl99 »

You can create a new partition using the unallocated space. The format doesn't matter much, ext2 and FAT32 can be read by Ubuntu/Jolicloud. Windows PC's will not be able to see the extra partition even if you choose FAT32 as I think only the first partition is visible. I don't think a cable will be slowing things down.
michaelm
Posts: 17
Joined: Fri Mar 04, 2011 9:18 am
Location: Glasgow

Re: USB Partition

Post by michaelm »

Thanks will get that sorted just now and report back - cheers

Michael

P.S. Pleased to see another joggler in Glasgow
User avatar
BuZz
Site Admin
Posts: 1460
Joined: Fri Mar 04, 2011 1:15 am

Re: USB Partition

Post by BuZz »

Another option would be to "grow" the btrfs partition. This can be done on another machine with an modern linux install (ubuntu maverick for example)

for example

put the usb stick in another linux machine and do (replacing /dev/USBDEVICE with /dev/sdb or whatever the device is - be careful to get this right!)

Code: Select all

sudo -s (or switch to root)
OFFSET=`sudo parted -m /dev/USBDEVICE unit s print | grep ^3 | cut -d: -f 2`
sudo parted /dev/USBDEVICE -- unit s rm 3 mkpart primary btrfs $OFFSET -1s
sudo mount /dev/USBDEVICE3 /mnt
sudo btrfsctl -r max /mnt
sudo umount /mnt
you can also try a premade script

http://joggler.exotica.org.uk/source/sc ... zebtrfs.sh
Last edited by BuZz on Wed Mar 16, 2011 7:14 pm, edited 4 times in total.
Reason: fixed up code
michaelm
Posts: 17
Joined: Fri Mar 04, 2011 9:18 am
Location: Glasgow

Re: USB Partition

Post by michaelm »

Thanks guys

In the end I used Gparted on my other Jolicloud Machine and created a new partition of the empty space in FAT32 to allow me to use on my Mac for photos etc.

All worked a treat.

Thanks for the advice.

Michael
User avatar
dwl99
Posts: 765
Joined: Fri Mar 04, 2011 7:38 am
Location: Glasgow

Re: USB Partition

Post by dwl99 »

BuZz wrote:Another option would be to "grow" the btrfs partition.

from the joggler open up a terminal and do

Code: Select all

sudo bash -c "OFFSET=`parted -m /dev/sda unit s print | grep ^3 | cut -d: -f 2`; parted /dev/sda -- unit s rm 3 mkpart primary btrfs $OFFSET -1s"
then reboot and open up a terminal again and do

Code: Select all

sudo btrfsctl -r max /
http://joggler.exotica.org.uk/source/sc ... zebtrfs.sh
How long should the sudo bash -c "OFFSET=`parted -m /dev/sda unit s print | grep ^3 | cut -d: -f 2`; parted /dev/sda -- unit s rm 3 mkpart primary btrfs $OFFSET -1s" bit take? It's been running for 2 hours now & the Terminal cursor is still blinking away. I'm trying to grow the partition to 8GB from a compressed btrfs.

Ta
User avatar
BuZz
Site Admin
Posts: 1460
Joined: Fri Mar 04, 2011 1:15 am

Re: USB Partition

Post by BuZz »

should be instant. if its not doing anything ctrl+c it. and do "parted /dev/sda print" and make sure you have a partition 3 before rebooting. I will double check the commandline now.

[edit]
try doing it like

Code: Select all

OFFSET=`sudo parted -m /dev/USBDEVICE unit s print | grep ^3 | cut -d: -f 2`
sudo parted /dev/USBDEVICE -- unit s rm 3 mkpart primary btrfs $OFFSET -1s
on the joggler USBDEVICE would be sda

I have fixed up the code in the previous posts. It wasnt quite correct sorry.
User avatar
dwl99
Posts: 765
Joined: Fri Mar 04, 2011 7:38 am
Location: Glasgow

Re: USB Partition

Post by dwl99 »

Thanks, all working now.

EDIT - when I rebooted & entered "sudo btrfsctl -r max /" I got an error message "ioctl:: Invalid argument"
User avatar
BuZz
Site Admin
Posts: 1460
Joined: Fri Mar 04, 2011 1:15 am

Re: USB Partition

Post by BuZz »

dwl99 wrote:Thanks, all working now.

EDIT - when I rebooted & entered "sudo btrfsctl -r max /" I got an error message "ioctl:: Invalid argument"
yeh sorry, actually parted doesn't let us delete and recreate the partition now (something must have changed to add this "protection") so we have no choice but to try it on another machine.
silentchill07
Posts: 10
Joined: Wed Mar 16, 2011 5:48 pm

Re: USB Partition

Post by silentchill07 »

What do you mean by try it on another machine ?
User avatar
dwl99
Posts: 765
Joined: Fri Mar 04, 2011 7:38 am
Location: Glasgow

Re: USB Partition

Post by dwl99 »

Boot your PC into Ubuntu & plug in the Joggler USB stick & it will mount it. Or create a second USB stick & boot the Joggler from that then insert the one you want to resize into the Joggler via a USB hub.
silentchill07
Posts: 10
Joined: Wed Mar 16, 2011 5:48 pm

Re: USB Partition

Post by silentchill07 »

I tried that booted into ubuntu via live on pc, inserted joggler pendrive, loaded up the partition program, clicked on resize but the sizes that are already set are stated as the maximum.
User avatar
BuZz
Site Admin
Posts: 1460
Joined: Fri Mar 04, 2011 1:15 am

Re: USB Partition

Post by BuZz »

you cant resize it from gparted. you can try my little shell script though listed earlier. you should also go for the latest image you can get - maybe something like ubuntu natty just for the newer btrfstool and kernel
silentchill07
Posts: 10
Joined: Wed Mar 16, 2011 5:48 pm

Re: USB Partition

Post by silentchill07 »

Ok here is me doing your instructions and the errors as they appear back: sdi was the pendrive on the ubuntu install for the joggler pendrive.

ubuntu@ubuntu:~$ sudo -s
root@ubuntu:~# sudo bash -c "OFFSET=`parted -m /dev/sdi unit s print | grep ^3 | cut -d: -f 2`; parted /dev/sdi -- unit s rm 3 mkpart primary btrfs $OFFSET -1s"
End? y
Error: Invalid number.
Information: You may need to update /etc/fstab.

root@ubuntu:~# sudo btrfsctl -r max /
ioctl:: Inappropriate ioctl for device
User avatar
BuZz
Site Admin
Posts: 1460
Joined: Fri Mar 04, 2011 1:15 am

Re: USB Partition

Post by BuZz »

Please try

http://joggler.exotica.org.uk/source/sc ... zebtrfs.sh

as it provides a more automated resize.

I need to test resizing on my system. as I use bleeding edge btrfs on joggler, it is possible that btrfs cant resize for some reason. you can only resize a mounted filesystem bts, which was one step you missed out on.
silentchill07
Posts: 10
Joined: Wed Mar 16, 2011 5:48 pm

Re: USB Partition

Post by silentchill07 »

I may sound dumb, but i am very new to all this, how do i run that script, i copied it and pasted it into terminal but terminal just closes ?
User avatar
roobarb!
Posts: 1746
Joined: Sat Mar 05, 2011 1:30 pm
Location: Salford, UK
Contact:

Re: USB Partition

Post by roobarb! »

silentchill07 wrote:I may sound dumb, but i am very new to all this, how do i run that script, i copied it and pasted it into terminal but terminal just closes ?
You need to download the script and save it as a file, then give it permissions that say it can run. One way to do it is like this, on the command line, one line at a time:

Code: Select all

wget http://joggler.exotica.org.uk/source/scripts/resizebtrfs.sh
Downloads the file with an application called wget and saves it in whichever directory you happen to be in at the time.

Code: Select all

chmod +x ./resizebtrfs.sh
Gives it execute permissions.

Code: Select all

./resizebtrfs.sh
Runs it.

In fact, you'll probably need to do this as a superuser, as you're messing with partitions:

Code: Select all

sudo ./resizebtrfs.sh
Literally, superuser do <whatever>.
BirdsLikeWires - Get fresh builds of Debian Bullseye and Bookworm for OpenFrame with the latest 5.10 and 6.1 kernels! 8-)
User avatar
BuZz
Site Admin
Posts: 1460
Joined: Fri Mar 04, 2011 1:15 am

Re: USB Partition

Post by BuZz »

Thanks roobarb :)
silentchill07
Posts: 10
Joined: Wed Mar 16, 2011 5:48 pm

Re: USB Partition

Post by silentchill07 »

Thank You that worked a treat, like being back with Dos 6.2 when i was at school !!!

The very last line needed changing a little to:

sudo ./resizebtrfs.sh /dev/sdb

but i managed to work that out all by myself. :D :D
User avatar
roobarb!
Posts: 1746
Joined: Sat Mar 05, 2011 1:30 pm
Location: Salford, UK
Contact:

Re: USB Partition

Post by roobarb! »

silentchill07 wrote:The very last line needed changing a little to:

sudo ./resizebtrfs.sh /dev/sdb

but i managed to work that out all by myself. :D :D
Awesome. :D

Not used the script myself (yet!), but I guess it makes sense to point it at something. ;)
BirdsLikeWires - Get fresh builds of Debian Bullseye and Bookworm for OpenFrame with the latest 5.10 and 6.1 kernels! 8-)
Post Reply