Shrinking a 8GB Archlinux distro for distribution

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Shrinking a 8GB Archlinux distro for distribution

Postby hendry » Sun Feb 16, 2014 11:03 am

Hi, I prepared a teaching demo on a 8GB SD card, that I want others to use:

$this->bbcode_second_pass_code('', '
[root@alarmpi ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.2G 1.1G 5.8G 16% /
devtmpfs 84M 0 84M 0% /dev
tmpfs 232M 0 232M 0% /dev/shm
tmpfs 232M 316K 231M 1% /run
tmpfs 232M 0 232M 0% /sys/fs/cgroup
tmpfs 232M 0 232M 0% /tmp
/dev/mmcblk0p1 90M 24M 66M 27% /boot
')

I dd-ed the image to my Thinkpad and compressed it with XZ and it was weighing in at 3GB. Any tips to get the size down?

I know how to http://archpi.dabase.com/#resizing-a-freshly-dd-ed-archlinux-image-to-take-all-the-available-space-of-the-sd-card, but can one shrink it?
hendry
 
Posts: 40
Joined: Wed Jul 31, 2013 8:28 am
Location: Singapore

Re: Shrinking a 8GB Archlinux distro for distribution

Postby pepedog » Sun Feb 16, 2014 12:30 pm

Clear package cache with pacman -Scc
Now on thinkpad-
Delete logs
$this->bbcode_second_pass_code('', 'rm /mounpoint/etc/ssh/ssh_host_*
rm -r /mounpoint/root/*
dd if=/dev/zero of=/mounpoint/fillfile bs=1M #this will fill up partition spare space
sync
sync
sync
rm /mounpoint/fillfile
sync')
Should compress better

Or make smaller partition on another card with smaller partition, copy date, fill up as above, use count= when you use dd to create img
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Shrinking a 8GB Archlinux distro for distribution

Postby hendry » Sun Feb 16, 2014 1:29 pm

Thanks, I'll give it a try. Why use count? Do you have an example?

I was initially using $this->bbcode_second_pass_code('', 'sudo dd bs=4M if=/dev/mmcblk0 | gzip > teach.img.gz')
hendry
 
Posts: 40
Joined: Wed Jul 31, 2013 8:28 am
Location: Singapore

Re: Shrinking a 8GB Archlinux distro for distribution

Postby pepedog » Sun Feb 16, 2014 5:55 pm

dd --help has info
There may be a man dd also
So if last sector was under 2 Gb mark, then with bs=4m count=512 should do
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Shrinking a 8GB Archlinux distro for distribution

Postby hendry » Mon Feb 17, 2014 7:49 am

How can I tell the FS is under the 2 GB mark, on a partition that's filling a 8GB SD card?
hendry
 
Posts: 40
Joined: Wed Jul 31, 2013 8:28 am
Location: Singapore

Re: Shrinking a 8GB Archlinux distro for distribution

Postby sdjf » Mon Feb 17, 2014 11:46 pm

look at the output of df -h and add together partition 1 and rootfs MB or GB used.
sdjf
 
Posts: 178
Joined: Wed May 08, 2013 1:55 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 6 guests