Title photo
frugal technology, simple living and guerrilla large-appliance repair

Regular blog here, 'microblog' there

Many of my traditional blog post live on this site, but a great majority of my social-style posts can be found on my much-busier microbloging site at updates.passthejoe.net. It's busier because my BlogPoster "microblogging" script generates short, Twitter-style posts from the Linux or Windows (or anywhere you can run Ruby with too many Gems) command line, uploads them to the web server and send them out on my Twitter and Mastodon feeds.

I used to post to this blog via scripts and Unix/Linux utilities (curl and Unison) that helped me mirror the files locally and on the server. Since this site recently moved hosts, none of that is set up. I'm just using SFTP and SSH to write posts and manage the site.

Disqus comments are not live just yet because I'm not sure about what I'm going to do for the domain on this site. I'll probably restore the old domain at first just to have some continuity, but for now I like using the "free" domain from this site's new host, NearlyFreeSpeech.net.

Sun, 23 Sep 2012

Repartitioning my Debian Wheezy system to make more room

I bit the bullet and did some repartitioning of my Debian Wheezy-running laptop to give myself more space on the Linux side by taking it from the seldom-used Windows side of my dual-boot system.

I had wanted to make my existing Debian partitions bigger, but due to the fact that modifying LVM -- especially with some partitions encrypted -- is a bit too mysterious and difficult, I decided to work with the Windows 7 partitions on the drive instead. Once I shrunk Windows, I planned to use the freed-up space for a new Linux partition. After that I would configure my Debian system to use it.

When I set up this laptop back in 2010, I did a fresh, crapware-free Windows 7 Home Premium installation at the very end of the drive. Windows dumped its main partition and small boot partition right there. At the time I gave something like 100 GB (out of the 320 GB drive) to Windows.

That's where I got my "extra" space for Linux.

I used gParted on my running Debian system to:

  • Shrink the main Windows partition by about 50 GB

  • Move the larger and smaller Windows partitions back to the "right" edge of the drive

  • create a new ext3 partition for Linux (I'm old school ... everything else is ext3, so this is too)

That all went well. While in gParted, I labeled the new ext3 partition data for no reason other than that's what I'm putting there.

I wanted the partition to mount under /media, and I wanted it to automount at boot.

To make that happen:

  • As root (or, alternatively, using sudo), create a directory under /media on which to mount my data partition:

# mkdir /media/data
$ sudo mkdir /media/data

  • Then, also as root (or with sudo), add the partition to /etc/fstab, which I did with the following line, which I put along with the rest of my fstab lines:

    /dev/sda4 /media/data ext3    relatime,noexec     0   2

At this point you could reboot and have your data partition ready to access. Or you could continue in the current sessions and mount the new parition as root (my device being sda4; substitute your device name in this line):

# mount /dev/sda4 /media/data
$ sudo mount /dev/sda4 /media/data

Again, you could just reboot. I recommend this: You want to make sure your new line in/etc/fstab works, and now is a good a time as any to do that.

  • Once I was satisfied that my /media/data directory worked, I created a directory under it for my user account and used chown to tie it to my user and group:

# mkdir /media/data/steven-data
$ sudo mkdir /media/data/steven-data

  • Then give your user and group ownership of the directory (use your username and group name instead of mine; in most home systems, user name and group name are the same):

# chown steven:steven /media/data/steven-data
$ sudo chown steven:steven /media/data/steven-data

  • I then pulled about 20 GB of files, mostly video, from my /home partition and put it in the new data partition. I used a file manager to do this -- Thunar in Xfce or Nautilus in GNOME are what I use generally.

  • Once I was sure everything was working, I was able to delete the things in /home that I successfully copied to /media/data/steven-data.

It went as smoothly as I expect. That means there were problems. I wouldn't expect them and feel comfortable doing this unless I knew what to do and knew that it would be acceptably easy:

  • After shrinking and moving the Windows partitions, Win 7 wouldn't boot from GRUB (or at all, really). This has happened to me before:

The solution is to get a Windows 7 install disc (there are ISO images floating around, that's how I got mine), boot from that and then use it to "repair" the installation. It doesn't take long. For a few links on how to do this, go to this portion of the gParted FAQ.

Once I did the repair, I restarted the computer. GRUB led me to Windows 7, and it now booted fine. While Windows was starting, I let the chkdsk procedure run, and that was it. I got to my Windows desktop. I rebooted again and got back into Debian (which is where I do pretty much everything except for watching the occasional Netflix video).

Now I have an extra 50 GB of ext3 in which to put files. That means I now have a very comfortable /home partition with plenty of room.

I previously reported that my root partition in Debian had only about 800 MB of free space out of 9.2 GB total. When I discovered this, I dumped a few applications and got it to about 1 GB free. Now it's showing 2+ GB free. I don't know exactly what happened, other than the system -- with no intervention -- getting rid of log files, stuff in /tmp and /var, etc.

Bottom line: I now have plenty of space in root and /home, a new Linux partition that will hold plenty of data, and a much smaller Windows 7 installation.

I don't really need Win 7 to be bigger, though I'm about to start learning the Lightworks video editor, which isn't yet available on Linux. I'm hoping that will change before I start running out of space on the Windows side, where the only other thing I use that OS for is Netflix streaming.