Reply
Thread Tools
Posts: 111 | Thanked: 50 times | Joined on May 2015
#1
I have just bought new microSD 32GB fast card. I want to store data on it (music etc.) and to use it as swap (2 extra partitions probably are needed). I have read that this significantly improves device performance. I know that this issue was explained many times, but I am a rookie. So can anybody write me, step by step, how to configure my microSD card for my needs? I will be very grateful.
 

The Following 3 Users Say Thank You to NotMicro For This Useful Post:
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#2
If your device is working fine (magnet et al.), simply open the built in file manager, long click on the icon for the external card and choose to format the card.
 

The Following 3 Users Say Thank You to michaaa62 For This Useful Post:
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#3
He wants to use the card as swap as well. Formatting from File Manager won't do that.
There are many ways to skin this cat. Have you seen the wiki page?
You can of course use parted on the device but a more newbie-friendly option is use GParted to partition your SD card to your liking. If you do not have a Linux machine, no problem. Just download a live CD and boot it on any machine that allows booting from a CD. You may need to enable that in the BIOS first.
__________________
Русский военный корабль, иди нахуй!
 

The Following 4 Users Say Thank You to pichlo For This Useful Post:
Posts: 111 | Thanked: 50 times | Joined on May 2015
#4
Originally Posted by pichlo View Post
He wants to use the card as swap as well. Formatting from File Manager won't do that.
There are many ways to skin this cat. Have you seen the wiki page?
You can of course use parted on the device but a more newbie-friendly option is use GParted to partition your SD card to your liking. If you do not have a Linux machine, no problem. Just download a live CD and boot it on any machine that allows booting from a CD. You may need to enable that in the BIOS first.
Thank you for your answer. I have read many pages regarding using swap no microSD, but I am not sure how to do it correctly. So I have asked for instructions step by step to avoid mistakes, that might destruct my filesystem and therefore "brick" my N900. If you could be so kind, please direct me to easy solution.
 

The Following 2 Users Say Thank You to NotMicro For This Useful Post:
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#5
Put in the card to remove the pre-installed partition, then add two new partitions. For additional data storage, roughly 30 GB, and for additional swap 768 MB. For best results first read the whole set of commands, try to understand, what is going on, ask any question as necessary.

You need the package rootsh installed on the N900 for the following commands to work fine
Code:
sudo gainroot
fdisk /dev/mmcblk1
Fdisk program is menu-based. Use 'h' for help to get the list of commands inside fdisk. In fdisk do
Code:
d
1
n
p
1
1
29764
n
p
2
29765
30532
w
You created two partitions, the first for additional file storage the second for the second swap partitions. Now apply the file systems
Code:
mkfs.vfat -n sdcard1 /dev/mmcblk1p1
mkswap -L swap_sdcard /dev/mmcblk1p2
After a reboot you might use one of the different methods to utilize the second swap like ereswap, swappolube or else.
Good luck!
 

The Following 8 Users Say Thank You to michaaa62 For This Useful Post:
Posts: 111 | Thanked: 50 times | Joined on May 2015
#6
Originally Posted by michaaa62 View Post
Put in the card to remove the pre-installed partition, then add two new partitions. For additional data storage, roughly 30 GB, and for additional swap 768 MB. For best results first read the whole set of commands, try to understand, what is going on, ask any question as necessary.

You need the package rootsh installed on the N900 for the following commands to work fine
Code:
sudo gainroot
fdisk /dev/mmcblk1
Fdisk program is menu-based. Use 'h' for help to get the list of commands inside fdisk. In fdisk do
Code:
d
1
n
p
1
1
29764
n
p
2
29765
30532
w
You created two partitions, the first for additional file storage the second for the second swap partitions. Now apply the file systems
Code:
mkfs.vfat -n sdcard1 /dev/mmcblk1p1
mkswap -L swap_sdcard /dev/mmcblk1p2
After a reboot you might use one of the different methods to utilize the second swap like ereswap, swappolube or else.
Good luck!

Thank you very much for this detailed answer. I have another questions though:
1. On this page -> http://wiki.maemo.org/Flopswap you can find information, that on microSD card 3 partitions are needed. What do you think of this solution and how to implement it to the phone.
2. When I am trying to use fdisk in x-terminal I got the info: fdisk: not found. Is fdisk the same as sfdisk ?

Last edited by NotMicro; 2016-10-10 at 13:43.
 

The Following 2 Users Say Thank You to NotMicro For This Useful Post:
Posts: 2,102 | Thanked: 1,937 times | Joined on Sep 2008 @ Berlin, Germany
#7
Having 2,3 or 4 swap partitions on the sdcard does alter the procedure slightly, but since you asked for a setup with two partitions, i wrote that up!

fdisk is NOT sfdisk, they handle things differently.
fdisk is part of busybox-power package that i have installed manually.

These could be the commands to use built-in sfdisk to change the partition table to contain two swap partitions and one data partition.
To get the rights:
Code:
sudo gainroot
These 5 lines are one command to create the text file 'table.txt'. Better copy and paste it to prevent any typos.
Code:
echo "unit: sectors
> /dev/mmcblk1p1 : start= 64, size= 59383744, Id=c
> /dev/mmcblk1p2 : start= 59383808, size= 1572864, Id=82
> /dev/mmcblk1p3 : start= 60956672, size= 1572864, Id=82
> /dev/mmcblk1p4 : start= 0, size= 0, Id= 0" > table.txt
To dump the content of the file to the partition table with sfdisk
Code:
sfdisk --no-reread /dev/mmcblk1 < table.txt
If no errors are reported, reboot the device to apply file systems to the newly created partitions. The labels (-L blablabla) or names (-n blablabla) of the partitions might only serve as suggestion, change to your liking, please.
Code:
mkfs.vfat -n sdcard1 /dev/mmcblk1p1
mkswap -L swap1_sdcard /dev/mmcblk1p2
mkswap -L swap2_sdcard /dev/mmcblk1p3
Better reboot again to make use of the swap partitions.
 

The Following 7 Users Say Thank You to michaaa62 For This Useful Post:
Posts: 111 | Thanked: 50 times | Joined on May 2015
#8
Thank you very much for this complete answer! You are the real master! I will try to implement your suggestions as soon as possible.
 

The Following 2 Users Say Thank You to NotMicro For This Useful Post:
Reply

Tags
sd card, swapfile

Thread Tools

 
Forum Jump


All times are GMT. The time now is 12:10.