5,606,779 Members 37,871 Now Online
XDA Developers Android and Mobile Development Forum

Resize Nook STR Partitions

Tip us?
 
meghd00t
Old
#1  
Senior Member - OP
Thanks Meter 138
Posts: 112
Join Date: Jul 2011
Location: Bangalore
Default Resize Nook STR Partitions

I wanted to increase the available space for my side loaded content and reduce the space for B&N downloads

First I used noogie to make a backup of the pristine nook at v 1.0.0, next I upgraded it to v1.0.1 and made another image

Then these commands on a linux box

Code:

dd if=/dev/zero of=new.img bs=1958739968 count=1

(
cat << _EOF
0,8,c,*
,2,c
,64,L
,,E
,128,L
,668,c
,32,L
,,L
_EOF
) | sfdisk -H128 -S32 -D -f new.img


kpartx -a mynookbackup.img
kpartx -a new.img

mkdir x z
cd x
mkdir boot  cache  data  factory  NOOK  p5  rom
cd ../z
mkdir boot  cache  data  factory  NOOK  p5  rom
cd ..

mkdosfs -H128 -t32 -F16 -n boot /dev/mapper/loop1p1
mkdosfs -H128 -t32 -F12 -n rom  /dev/mapper/loop1p2
mkdosfs -H128 -t32 -F32 -n NOOK /dev/mapper/loop1p6

mkfs.ext2 -L factory /dev/mapper/loop1p3
mkfs.ext2            /dev/mapper/loop1p5

mkfs.ext3 -L cache   /dev/mapper/loop1p7
mkfs.ext3 -L data    /dev/mapper/loop1p8


cd x
mount /dev/mapper/loop0p1 boot
mount /dev/mapper/loop0p2 rom
mount /dev/mapper/loop0p3 factory
mount /dev/mapper/loop0p5 p5
mount /dev/mapper/loop0p6 NOOK
mount /dev/mapper/loop0p7 cache
mount /dev/mapper/loop0p8 data


cd ../z
mount /dev/mapper/loop1p1 boot
mount /dev/mapper/loop1p2 rom
mount /dev/mapper/loop1p3 factory
mount /dev/mapper/loop1p5 p5
mount /dev/mapper/loop1p6 NOOK
mount /dev/mapper/loop1p7 cache
mount /dev/mapper/loop1p8 data
cd ..

rsync -avP x/ z/
sync
umount x/*
umount z/*

kpartx -d mynookbackup.img
kpartx -d new.img

after that I now have 1.4 GB for side loaded content.

Hope this helps someone.
The Following 7 Users Say Thank You to meghd00t For This Useful Post: [ Click to Expand ]
 
TheChefSLC
Old
#2  
Member
Thanks Meter 20
Posts: 52
Join Date: Oct 2010
Location: Clearfield, UT
Thanks for sharing. This is something that i have been wanting to do so I would not have to use an sd card.

Now I do have a question on this. the part
Code:
(
cat << _EOF
0,8,c,*
,2,c
,64,L
,,E
,128,L
,668,c
,32,L
,,L
_EOF
) | sfdisk -H128 -S32 -D -f new.img
what does this actually do?
 
meghd00t
Old
#3  
Senior Member - OP
Thanks Meter 138
Posts: 112
Join Date: Jul 2011
Location: Bangalore
It creates a new partition table on the file new.img using sfdisk I can script it instead of doing it manually

Here is the output of fdisk -l on both files
Code:
Disk mynook101.img: 1958 MB, 1958739968 bytes
128 heads, 32 sectors/track, 934 cylinders, total 3825664 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
mynook101.img1   *          32      155647       77808    c  W95 FAT32 (LBA)
mynook101.img2          155648      188415       16384    c  W95 FAT32 (LBA)
mynook101.img3          188416      577535      194560   83  Linux
mynook101.img4          577536     3792895     1607680    5  Extended
mynook101.img5          577568     1167359      294896   83  Linux
mynook101.img6         1167392     1658879      245744    c  W95 FAT32 (LBA)
mynook101.img7         1658912     2150399      245744   83  Linux
mynook101.img8         2150432     3792895      821232   83  Linux

Disk new.img: 1958 MB, 1958739968 bytes
128 heads, 32 sectors/track, 934 cylinders, total 3825664 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
new.img1   *          32       32767       16368    c  W95 FAT32 (LBA)
new.img2           32768       40959        4096    c  W95 FAT32 (LBA)
new.img3           40960      303103      131072   83  Linux
new.img4          303104     3825663     1761280    5  Extended
new.img5          303136      827391      262128   83  Linux
new.img6          827424     3563519     1368048    c  W95 FAT32 (LBA)
new.img7         3563552     3694591       65520   83  Linux
new.img8         3694624     3825663       65520   83  Linux
The Following User Says Thank You to meghd00t For This Useful Post: [ Click to Expand ]
 
meghd00t
Old
#4  
Senior Member - OP
Thanks Meter 138
Posts: 112
Join Date: Jul 2011
Location: Bangalore
and here is the output of df to see where the space has been reallocated

Code:
Filesystem    Type    Size  Used Avail Use% Mounted on
              vfat     75M  9.8M   66M  14% /mnt/scratch/tmp/x/boot
              vfat     16M  119K   16M   1% /mnt/scratch/tmp/x/rom
              ext2    184M  106M   77M  58% /mnt/scratch/tmp/x/factory
              ext2    279M  185M   92M  67% /mnt/scratch/tmp/x/p5
              vfat    237M  171K  237M   1% /mnt/scratch/tmp/x/NOOK
              ext3    233M  6.1M  224M   3% /mnt/scratch/tmp/x/cache
              ext3    790M   42M  740M   6% /mnt/scratch/tmp/x/data
              vfat     16M  9.8M  6.2M  62% /mnt/scratch/tmp/z/boot
              vfat    4.0M  148K  3.9M   4% /mnt/scratch/tmp/z/rom
              ext2    124M  106M   13M  90% /mnt/scratch/tmp/z/factory
              ext2    248M  185M   51M  79% /mnt/scratch/tmp/z/p5
              vfat    1.4G  212K  1.4G   1% /mnt/scratch/tmp/z/NOOK
              ext3     62M  5.4M   54M  10% /mnt/scratch/tmp/z/cache
              ext3     62M   30M   29M  51% /mnt/scratch/tmp/z/data
 
mdall
Old
#5  
Member
Thanks Meter 29
Posts: 95
Join Date: Dec 2010
Location: Paris
Thank you very much, it works very well

Here is what I did with comments of what I understood (might be useful for someone)
Code:
#First, we create a blank image (same size as the nook, mine is 1962934272)
#I used bs=1916928 count=1024 instead of bs=1962934272 count=1, I assume it is the same (or else I didn't have enough memory))
dd if=/dev/zero of=new.img bs=1916928 count=1024

#Then, we create partitions on it with sfdisk (I used a larger data partition to have more space for my apps)
(
cat << _EOF
0,8,c,*
,2,c
,64,L
,,E
,128,L
,620,c
,32,L
,,L
_EOF
) | sfdisk -H128 -S32 -D -f new.img

#We create partition mapping (or something like that) so that we can "access" them in /dev/mapper
kpartx -a mynookbackup.img
kpartx -a new.img

mkdir x z
cd x
mkdir boot  cache  data  factory  NOOK  p5  rom
cd ../z
mkdir boot  cache  data  factory  NOOK  p5  rom
cd ..

# We create the filesystems on the partitions (Your mkdosfs commands were invalid for me, so I did something like)
mkdosfs -F16 -n boot /dev/mapper/loop1p1
mkdosfs -F12 -n rom  /dev/mapper/loop1p2
mkdosfs -F32 -n NOOK /dev/mapper/loop1p6

mkfs.ext2 -L factory /dev/mapper/loop1p3
mkfs.ext2            /dev/mapper/loop1p5

mkfs.ext3 -L cache   /dev/mapper/loop1p7
mkfs.ext3 -L data    /dev/mapper/loop1p8

#We mount them
cd x
mount /dev/mapper/loop0p1 boot
mount /dev/mapper/loop0p2 rom
mount /dev/mapper/loop0p3 factory
mount /dev/mapper/loop0p5 p5
mount /dev/mapper/loop0p6 NOOK
mount /dev/mapper/loop0p7 cache
mount /dev/mapper/loop0p8 data


cd ../z
mount /dev/mapper/loop1p1 boot
mount /dev/mapper/loop1p2 rom
mount /dev/mapper/loop1p3 factory
mount /dev/mapper/loop1p5 p5
mount /dev/mapper/loop1p6 NOOK
mount /dev/mapper/loop1p7 cache
mount /dev/mapper/loop1p8 data
cd ..

#We copy the content of the nook's partitions to the new ones
rsync -avP x/ z/
sync

umount x/*
umount z/*

kpartx -d mynookbackup.img
kpartx -d new.img

#Now we just have to "restore" new.img on the nook
For information, my partition table
Code:
Disque new.img*: 1962*Mo, 1962934272*octets
128 têtes, 32 secteurs/piste, 936 cylindres, total 3833856 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Taille de secteur (logique / physique)*: 512*octets / 512*octets
taille d'E/S (minimale / optimale)*: 512*octets / 512*octets
Identifiant de disque*: 0x00000000

Périphérique Amorce  Début        Fin      Blocs     Id  Système
new.img1   *          32       32767       16368    c  W95 FAT32 (LBA)
new.img2           32768       40959        4096    c  W95 FAT32 (LBA)
new.img3           40960      303103      131072   83  Linux
new.img4          303104     3833855     1765376    5  Étendue
new.img5          303136      827391      262128   83  Linux
new.img6          827424     3366911     1269744    c  W95 FAT32 (LBA)
new.img7         3366944     3497983       65520   83  Linux
new.img8         3498016     3833855      167920   83  Linux

#The original one
Disque /dev/sdb*: 1962*Mo, 1962934272*octets
128 têtes, 32 secteurs/piste, 936 cylindres, total 3833856 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Taille de secteur (logique / physique)*: 512*octets / 512*octets
taille d'E/S (minimale / optimale)*: 512*octets / 512*octets
Identifiant de disque*: 0x00000000

Périphérique Amorce  Début        Fin      Blocs     Id  Système
/dev/sdb1   *          32      155647       77808    c  W95 FAT32 (LBA)
/dev/sdb2          155648      188415       16384    c  W95 FAT32 (LBA)
/dev/sdb3          188416      577535      194560   83  Linux
/dev/sdb4          577536     3792895     1607680    5  Étendue
/dev/sdb5          577568     1167359      294896   83  Linux
/dev/sdb6         1167392     1658879      245744    c  W95 FAT32 (LBA)
/dev/sdb7         1658912     2150399      245744   83  Linux
/dev/sdb8         2150432     3792895      821232   83  Linux

#df
Sys. de fichiers    Taille Util. Disp. Uti% Monté sur
/dev/mapper/loop0p1    75M   58M   17M  78% /home/mdall/x/boot
/dev/mapper/loop0p2    16M  120K   16M   1% /home/mdall/x/rom
/dev/mapper/loop0p3   184M  106M   77M  58% /home/mdall/x/factory
/dev/mapper/loop0p5   279M  194M   83M  71% /home/mdall/x/p5
/dev/mapper/loop0p6   240M  104M  137M  43% /home/mdall/x/NOOK
/dev/mapper/loop0p7   233M   14M  217M   6% /home/mdall/x/cache
/dev/mapper/loop0p8   790M  149M  633M  20% /home/mdall/x/data

/dev/mapper/loop1p1    16M   10M  6,0M  63% /home/mdall/z/boot
/dev/mapper/loop1p2   4,0M  150K  3,9M   4% /home/mdall/z/rom
/dev/mapper/loop1p3   124M  106M   13M  90% /home/mdall/z/factory
/dev/mapper/loop1p5   248M  191M   45M  82% /home/mdall/z/p5
/dev/mapper/loop1p6   1,3G  104M  1,2G   9% /home/mdall/z/NOOK
/dev/mapper/loop1p7    62M   13M   47M  21% /home/mdall/z/cache
/dev/mapper/loop1p8   159M  136M   16M  90% /home/mdall/z/data
The Following 3 Users Say Thank You to mdall For This Useful Post: [ Click to Expand ]
 
silentwind96
Old
#6  
silentwind96's Avatar
Junior Member
Thanks Meter 3
Posts: 21
Join Date: Jan 2007
Location: Bakersfield, CA
For those of us tards who have no clue how to use linux and still wanna increase the size of our Nook Touch, is there a nice gui that will do the same thing?
The Following 2 Users Say Thank You to silentwind96 For This Useful Post: [ Click to Expand ]
 
roustabout
Old
#7  
Senior Member
Thanks Meter 174
Posts: 602
Join Date: Feb 2011
Another helpful trick to add to this mix:

symlink /data/media to
/media so you can actually see the files BN is downloading to your device.

in adb shell or via ssh:

cd /data/media

rm -r *

cd ..

rmdir media

ln -s media /media

After doing this, the reader, etc. put their files where you can pick them up and archive them in Calibre, etc.
 
ctot
Old
#8  
Junior Member
Thanks Meter 2
Posts: 20
Join Date: Dec 2009
One more nook succesfully resized.

Thanks
 
toniexly
Old
(Last edited by toniexly; 3rd December 2011 at 12:43 PM.)
#9  
Junior Member
Thanks Meter 0
Posts: 7
Join Date: Aug 2008
is a step by step instruction possible......
 
cceerrtt
Old
#10  
Senior Member
Thanks Meter 24
Posts: 147
Join Date: Sep 2010
Hi, I can see the you do not care about bootloader during the resize. Do you know what bootloader is used in nook? grub? (don't have my nook atm so I cannot check it)

Tags
howto, linux, partition, resize
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes