pantz.org banner
Parted and disk alignment
Posted on 03-15-2014 03:55:03 UTC | Updated on 03-15-2014 03:58:41 UTC
Section: /software/parted/ | Permanent Link

I always seem to come across this error every time I'm trying to partition a drive with parted. I want to use the whole drive, but I can never seem to get the alignment right. When you try to partition a drive using parted and you do the "mkpart" command you have to choose partition name, file system type, start, and end. The start and end is where I have the issue. Do I start on zero or 1 and how do I easily know what the end of the disk is? When you do this wrong the error you usually get is "Warning: The resulting partition is not properly aligned for best performance.". That error does not inspire confidence. Here is the best way I have found to use the full disk size with 1 partition.

When asked about start and end we are going to use percentages like so.

(parted) mkpart 
Partition name?  []? 1                                                    
File system type?  [ext2]? ext4                                           
Start? 0%                                                                 
End? 100%

You could also do this from the command line like

sudo parted /dev/sda mkpart primary ext4 0% 100%

Doing this will leave some free space at the start and end of the disk, but it will make sure the partition is properly aligned for best performance.

(parted) print free                                                       
Model: ATA SAMSUNG SSD 830 (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  128GB   128GB                primary
        128GB   128GB   335kB   Free Space

One last check for alignment.

(parted) align-check opt 1                                                
1 aligned

Del.icio.us! | Digg Me! | Reddit!

Related stories

Use FreeBSD 10 as a PF firewall
Posted on 02-02-2014 01:41:29 UTC | Updated on 02-02-2014 01:42:57 UTC
Section: /software/pf/ | Permanent Link

History

Back in 2012 I wrote an entry that said to not use FreeBSD 9.0 as a PF firewall. It was mildly controversial and I was just relaying my experience of installing FreeBSD 9.0 on release day. It was a frustrating experience that I really wanted to work out and I was sadly disappointed that it did not. I wanted to try it again in the future in hopes that the FreeBSD team could put together something that work work better for me. That time is now.

Why try again?

Reading about all of the improvements in FreeBSD 10 was very encouraging. Some of the most encouraging things that inspired me to try again was a fork of PF. The FreeBSD devs forked PF because Gleb Smirnoff wrote an amazing patch to make PF SMP-friendly. But this was not compatible with the newest PF code so hence the fork. Making PF SMP aware improves performance immensely. OpenBSD has not done this nor does it look like it is on their radar.

Since I tried it last the binary package system for FreeBSD has been rewritten. The new package system pkgng is a major improvement over the old package system. Now FreeBSD actually has a package manager that can deal with dependencies well and we can live off of binaries instead of ports (Yea!).

I have been really interested in using ZFS as a file system, and our friends over at Calomel.org have convinced me that the time is right to try it. ZFS has added TRIM support in FreeBSD 10. ZFS also has added LZ4 compression, which is an amazing new fast compression algorithm. Plus you can now install ZFS as your root drive right from the installer. I do wish they would add the ability to choose options like compression during your ZFS install, but hopefully they will add this as advanced options in the future.

Install

The install went great. I followed the great instructions from our friends over at Calomel.org and made my usb boot drive. I fetched the script from Calomel.org and changed a few things. I ran the script and a few mins later I rebooted and hit a nice big error screen.

The error was "ahcich1: Timeout on slot 30". This error was referring to the first channel on my SATA port where my hard drive lives. I could not figure out why it was having this issue until I checked my BIOS. My drives were set to IDE instead of AHCI. For some reason FreeBSD installed fine using IDE as the setting, but on first boot it fell flat on its face. AHCI is better and is what I really wanted it set to, but I never bothered checking. After changing to AHCI in the BIOS FreeBSD booted right up.

The install was done on my internal network so I had the ability to use another machine to do the install and download everything I needed to get it done. Then I tried hooking it up to my external firewall. I could not get lease from Verizon's DHCP server to save my life.

Fighting Verizon DHCP

In the install script I used you have to change your external interface to DHCP and change (spoof) its MAC address to match the MAC that Verizon has in their system. This could be the MAC of your original router or your Verizon router. That MAC was changed correctly to what I have on the OpenBSD machine the was hooked up, but I could not get a lease from the Verizon DHCP server at all.

Long story short, with Verizon you have to release the DHCP lease before you can get a new one. With FreeBSD there is no way to release a DHCP lease with the version of dhclient that comes with FreeBSD. In the Linux version of dhclient you can. I had to end up hooking up my old Verizon router and push the "Release" button on the GUI interface. After doing that and quickly powering off the router I booted right up and got a lease. Now, I also believe if I waited enough hours I could have waited for the lease to expire, but I wanted to get this done so I found a faster way.

Configuration

Installing and configuring the system was pretty easy. I worked through many of the issues I had last time. Let me give you some examples.

Before I used to use Postfix with SASL to talk to remote mail servers using TLS. I now use OpenSMTPD to do this as it is built in and they also have built in CA Certs for Gmail. That solved the annoyance of having to build Postfix from ports. As far as I can tell FreeBSD still does not build Postfix with SASL, but they do build Sendmail with SASL. Go figure.

PF still works great in FreeBSD, but they still do not build in ALTQ as a kernel module or into the kernel. This is not as big of an issue for me as it once was since turning it off I did not see any noticeable difference on my home network. For a big corp that has lots of different users this might be different. For me I can live without it for now as turning it on requires a kernel recompile and I'm trying to avoid that. OpenBSD is abandoning its work on ALTQ as they said it was a hack in the fist place and the code is showing its age with limited 32 bit registers and the like. They are working on a new queuing system called prio. I hope FreeBSD can eventually work this into their fork of PF or make one of their own. What I really want back from ALTQ is priority ACKs. I wish someone would hack in priority acks into the tcp stack as a kernel tunable. That would rock.

All PF tools I installed from packages this time and they worked great right out of the box. No fuss at all. This was a big improvement from last time as most of the PF tools were broken on release day.

Farewell OpenBSD

In the last entry I bid farewell to FreeBSD, but this time I'm waving bye bye to OpenBSD. OpenBSD we need to talk. You are falling behind. FreeBSD is eating your lunch on performance and features.

I'm not saying I won't be back OpenBSD, but I'm going to ride the FreeBSD train for now and see where it takes me. Thanks for all of the stability and security you have given me over the years. Good luck and I hope you can start addressing the issues I mentioned above.

Del.icio.us! | Digg Me! | Reddit!

Related stories

Using an MVNO can save you on your cell phone bill
Posted on 12-22-2013 20:39:21 UTC | Updated on 12-26-2013 03:56:06 UTC
Section: /hardware/cellphone/ | Permanent Link

What is an MVNO?

A mobile virtual network operator (MVNO), is a company that buys access to a primary network operators network at a bulk rate and then resells said service to customers. They use their own customer support, marketing, billing systems, etc in place of the primary carriers. The bulk network access they purchase from the mobile network operator (Verizon, Sprint, ATT, etc) uses the exact same cell towers as the primary carrier. Many MVNO's get the same cell service and access to network improvements at or at very nearly the same time as the network provider's own retail customers. This means the primary differences between the MVNO's and the primary network operators are the type of plans that they offer.

Tiered providers

The larger mobile carriers in the US have always required you pick a plan when you signed up for their phone service. The problem with this model for consumers (not the carriers) is that you are likely paying for more service than what you really need or use. The cable companies work with the same model. Even if you pick the lowest priced plan it is still way more than what you want/need. But you pay for it anyways because it is the cheapest plan offered. Then at the end of the month you see that you used about 33% of the voice/text/data of the lowest plan the carrier offered. How frustrating is that? Well, that is all beginning to change.

This year MVNO's like Ting.com and Zact.com decided that plans are ridiculous and unfair to consumers. They have started a new trend that deals with "tiers" of usage. Every tier gives you a little more text/data/voice. As you use text/data/voice you automatically fall to the next tier. The great thing about tiers is they start at zero. If you don't use the service you don't have to pay for it. If you don't text then you don't pay for texts. If you use just a little bit of the service then you only pay for the smaller tier you fall into. If you need more you just keep moving up the tiers little by little.

Why are tiered providers the better choice for low to medium data/text/voice users?

You are charged based what you use. The larger carriers are not providing any plans that are of good value to the low to medium usage consumer. Can you blame them? They are there to make money for their stock holders and not do what is best for the consumer. Enough people are paying for these plans so that gives them no reason to change. In fact it's getting worse. As most have noticed the data plans have been driving the new breed of carrier plans. They practically give away voice and text now, but if you have a Smartphone your plans start with a $40/month fee just to have the phone and then it goes up from there.

What about heavy data/text/voice users?

Very heavy users are likely to not benefit from MVNO tiers or possibly MVNO's at all. Usually there is a comparison chart on the tiered carriers websites that help you decide if it makes sense. If you are a heavy user then MVNO Republic wireless ($19 unlimited everything, primarily through integrated VoIP) might be a good choice. Also, the Virgin Mobile ($35 for 300 mins, and unlimited data and text) or T mobile prepaid ($30 for 100 mins, and unlimited data and text.) might be good for you. The thing is even though these prices seem cheap the tiered providers can be cheaper, because some of the mentioned plans are per phone. No sharing. With a tiered provider they allow you to share the tiers with as many phones as you want. Adding a phone to a tiered plan is cheap. Like $5-$6 cheap. If you have others you want to put on your plan and they are low usage people as well (Grandparents?) you can really start to see the savings.

Why MVNO's offerings tend to be better than the primary carriers

Look out for the following with different MVNO's

Some of these are not true of all MVNO's, but it is a list of things to look for when you are shopping around.

List of MVNO carriers

Good breakdown of MVNO plans. It is updated often so don't let the date in the url fool you. There is also a good Wikipedia page with a list of US MVNO's.

Which MVNO did I choose?

I selected Ting as my MVNO. It offered me everything I wanted in an provider, but one of the biggest is they allow you to bring compatible phones to their network. They also allow some phone models outside of their network to be used. For example Google's Nexus 5. The unlocked phone that works with GSM and CDMA networks. To see how easy it is to setup the amazing Nexus 5 on Ting please vist our friends at Calomel.org. I also required a provider that used a tier system and not a traditional plan system. There are not many around that do this yet. Ting has a bunch of great features that make it a good MVNO choice.

Best features about Ting

Issues with Ting

If you do go with Ting please use my referral code and get $25 off your signup. I will also get $25, but it would be a nice thank you in help running my website.

So do I go with traditional carrier or an MVNO?

To answer this you really have to get a good handle on your normal monthly usage of voice/text/data. Add them up and average them out over the last 6 months to a year. Go to some different MVNO websites and check out their plans. Here are some questions you are going to need to ask yourself when deciding.

Workarounds for some of the MVNO shortcomings/issues

The larger primary carriers are starting to realize that people are not using voice as much anymore. Text and data are being used as a supplement for these. Texts are a high margin service, but were never charged as much as voice in the past. The carriers did not like that people started using texts instead of voice so they cranked up the price of texts. With the advent of all the tablets and smartphones data is where everything is heading, and the carriers are starting to build their new pricing models around it. Now voice and texts are not what people want as much, but data. So they have started giving out unlimited voice and text, but linking this to expensive data plans with high device buy in prices.

Many of the MVNO's are not taking to this model and are just doing the all services based on rates. But what this means is the more you use the service (voice/text/data) the more you end up paying. So it follows that you are going to do whatever you can to subsidize the usage of these services. If you leverage your use of WiFi wisely you can save big time.

Lets face it, many of us are around WiFi much of our day. If you have an internet connection where ever you are (home,work,coffee shop,etc) you can get a lot of these different services the MVNO offers for free if you just use WiFi as your data connection. Mainly this involves using 3rd party services to supplement things like voice and texts. By doing this you can cut down your usage of these services dramatically when you use WiFi connections.

Using Google Voice will allow you to text (SMS) people using your new Google phone number and it just uses your data connection on your phone or through WiFi. The same goes for voice calls. You can turn off SMS messages all together and save money there. It only uses a very small amount of data to send the Google Voice SMS message. It can not do MMS messages at this time but you can use Hangouts for that.

If you get good with using Google Voice, you will see big savings managing your voice/data plans together (let's say you turn off SMS and use GV for it) and actually gain the features GV has to offer in the process.

Final words

After making the switch to the MVNO provider Ting I have 20 days left before my next billing cycle and my current bill is $12. I'm using my smartphone in the exact manner I had before, so I have given up nothing. I have just changed the way I do things like making calls using GV VoIP and texting people through my GV number instead of my real phone number.

Just remember that switching to an MVNO might not be for you and your usage pattern. It is just something you should consider looking into if your looking save big money on your monthly mobile bills. Make sure you do all of your calculations carefully for how much an MVNO will cost you based on your past and predicted future usage patterns. Then consider all of what I mentioned above to make an informed choice. Good luck!

Del.icio.us! | Digg Me! | Reddit!

Related stories


RSS Feed RSS feed logo
About


3com
3ware
alsa
alsactl
alsamixer
amd
android
apache
areca
arm
ati
auditd
awk
badblocks
bash
bind
bios
bonnie
cable
carp
cat5
cdrom
cellphone
centos
chart
cifs
cisco
cloudera
comcast
commands
comodo
compiz-fusion
corsair
cpufreq
cpufrequtils
cpuspeed
cron
crontab
crossover
cu
cups
cvs
database
dbus
dd
dd_rescue
ddclient
debian
decimal
dhclient
dhcp
diagnostic
diskexplorer
disks
dns
dos
dovecot
drac
dsniff
dvdauthor
e-mail
echo
editor
emerald
ethernet
expect
ext3
fat32
fedora
fetchmail
fiber
filesystems
firefox
firewall
flac
flexlm
floppy
flowtools
fonts
format
freebsd
ftp
gdm
gnome
greasemonkey
greylisting
growisofs
grub
hacking
hadoop
harddrive
hba
hex
hfsc
html
html5
http
idl
ie
ilo
intel
ios
iperf
ipmi
iptables
ipv6
irix
javascript
kde
kernel
kickstart
kmail
kprinter
krecord
kubuntu
kvm
lame
ldap
linux
logfile
lp
lpq
lpr
maradns
matlab
memory
mencoder
mhdd
mkinitrd
mkisofs
moinmoin
motherboard
mouse
movemail
mplayer
multitail
mutt
myodbc
mysql
mythtv
nagios
nameserver
netflow
nginx
nic
ntfs
ntp
nvidia
odbc
openbsd
openntpd
openoffice
openssh
openssl
opteron
parted
partimage
patch
perl
pf
pfflowd
pfsync
photorec
php
pop3
pop3s
ports
postfix
power
procmail
proftpd
proxy
pulseaudio
putty
pxe
python
qemu
r-studio
raid
recovery
redhat
router
rpc
rsync
samba
schedule
scsi
seagate
seatools
sed
sendmail
sgi
shell
siw
smtp
snort
solaris
soundcard
sox
spam
spamd
sql
sqlite
squid
ssh
ssh.com
ssl
su
subnet
subversion
sudo
sun
supermicro
switches
symbols
syslinux
syslog
systemrescuecd
t1
tcpip
tcpwrappers
telnet
terminal
testdisk
tftp
thttpd
thunderbird
timezone
ting
tools
tr
trac
tuning
tunnel
vi
wget
wiki
windows
windowsxp
wireless
wpa_supplicant
x
xauth
xfree86
xfs
xinearama
xmms
youtube
zdump
zic
zlib